Skip to content

Instantly share code, notes, and snippets.

@HerrZatacke
Created June 10, 2018 15:30
Show Gist options
  • Save HerrZatacke/95590030a67628fe8d02094cacaf1e4d to your computer and use it in GitHub Desktop.
Save HerrZatacke/95590030a67628fe8d02094cacaf1e4d to your computer and use it in GitHub Desktop.
electron-issue 12185
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
<style>
pre {
color: red;
}
body {
font-family: sans-serif;
}
</style>
</head>
<body>
<p>this file can be found here: <code>index.html</code></p>
<p>navigate to the "Performance"-Tab in the DevTools. This should log the following:</p>
<pre>
[63452:0610/171848.080:ERROR:CONSOLE(0)] "Failed to load https://chrome-devtools-frontend.appspot.com/serve_file/@7accc8730b0f99b5e7c0702ea89d1fa7c17bfe33/product_registry_impl/product_registry_impl_module.js: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'chrome-devtools://devtools' is therefore not allowed access. The response had HTTP status code 404.", source: chrome-devtools://devtools/bundled/inspector.html?remoteBase=https://chrome-devtools-frontend.appspot.com/serve_file/@7accc8730b0f99b5e7c0702ea89d1fa7c17bfe33/&can_dock=true&toolbarColor=rgba(223,223,223,1)&textColor=rgba(0,0,0,1)&experiments=true (0)
[63452:0610/171848.080:ERROR:CONSOLE(22)] "Empty response arrived for script 'https://chrome-devtools-frontend.appspot.com/serve_file/@7accc8730b0f99b5e7c0702ea89d1fa7c17bfe33/product_registry_impl/product_registry_impl_module.js'", source: chrome-devtools://devtools/bundled/inspector.js (22)
[63452:0610/171848.081:ERROR:CONSOLE(105)] "Uncaught (in promise) Error: Could not instantiate: ProductRegistryImpl.Registry", source: chrome-devtools://devtools/bundled/inspector.js (105)
[63452:0610/171848.081:ERROR:CONSOLE(105)] "Uncaught (in promise) Error: Could not instantiate: ProductRegistryImpl.Registry", source: chrome-devtools://devtools/bundled/inspector.js (105)
[63452:0610/171848.081:ERROR:CONSOLE(105)] "Uncaught (in promise) Error: Could not instantiate: ProductRegistryImpl.Registry", source: chrome-devtools://devtools/bundled/inspector.js (105)
</pre>
<p>Navigate to the "Network"-Tab in the DevTools.</p>
<p>click <button>Test</button></p>
<p>each click should produce this error:</p>
<pre>
[63240:0610/171951.634:ERROR:CONSOLE(105)] "Uncaught (in promise) Error: Could not instantiate: ProductRegistryImpl.Registry", source: chrome-devtools://devtools/bundled/inspector.js (105)
</pre>
<p>sometimes the error is not shown instantly, but with a delay of about a second</p>
<script>
document.querySelector('button').addEventListener('click', () => {
fetch("data:text/plain;base64,dGVzdCB0ZXh0") // this is "test text" encoded
.then((res) => (res.text()))
.then((text) => {
console.log(text);
})
.catch((er) => {
console.log(er.message);
})
})
</script>
</body>
</html>
const path = require('path');
const { app, BrowserWindow } = require('electron');
const createMainWindow = () => {
let win = new BrowserWindow({
show: false,
});
win.show();
win.webContents.openDevTools();
win.loadFile(path.join(process.cwd(), 'index.html'));
win.on('closed', () => {
win = null;
});
return win;
};
// global reference to mainWindow (necessary to prevent window from being garbage collected)
let mainWindow;
app.on('ready', () => {
mainWindow = createMainWindow();
});
{
"name": "electron-issue-12185",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "electron index.js"
},
"devDependencies": {
"electron": "2.0.2"
}
}
@mohmed1500
Copy link

mohmed1500 commented Jul 11, 2018

تل

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment