Skip to content

Commit 218eb2c

Browse files
committed
Warn about not allowing access to file URLs
Fix #219.
1 parent 77c1278 commit 218eb2c

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

src/browser/extension/devpanel/index.js

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import configureStore from '../../../app/stores/panelStore';
77
import getPreloadedState from '../background/getPreloadedState';
88

99
const position = location.hash;
10+
const messageStyle = { padding: '20px', width: '100%', textAlign: 'center' };
11+
1012
let rendered;
1113
let store;
1214
let bgConnection;
@@ -32,15 +34,27 @@ function renderNA() {
3234
if (rendered === false) return;
3335
rendered = false;
3436
naTimeout = setTimeout(() => {
35-
const node = document.getElementById('root');
36-
unmountComponentAtNode(node);
37-
render(
38-
<div style={{ padding: '20px', width: '100%', textAlign: 'center' }}>
39-
No store found. Make sure to follow <a href="https://github.com/zalmoxisus/redux-devtools-extension#usage" target="_blank">the instructions</a>.
40-
</div>,
41-
node
42-
);
43-
store = undefined;
37+
chrome.devtools.inspectedWindow.getResources(resources => {
38+
let message;
39+
if (resources[0].url.substr(0, 4) === 'file') {
40+
message = (
41+
<div style={messageStyle}>
42+
No store found. Most likely you didn't allow access to file URLs. <a href="https://github.com/zalmoxisus/redux-devtools-extension/blob/master/docs/Troubleshooting.md#access-file-url-file" target="_blank">See details</a>.
43+
</div>
44+
);
45+
} else {
46+
message = (
47+
<div style={messageStyle}>
48+
No store found. Make sure to follow <a href="https://github.com/zalmoxisus/redux-devtools-extension#usage" target="_blank">the instructions</a>.
49+
</div>
50+
);
51+
}
52+
53+
const node = document.getElementById('root');
54+
unmountComponentAtNode(node);
55+
render(message, node);
56+
store = undefined;
57+
});
4458
}, 1500);
4559
}
4660

0 commit comments

Comments
 (0)