Skip to content
This repository was archived by the owner on Feb 12, 2023. It is now read-only.

Commit 1af636d

Browse files
author
Ke, Mingze
committed
Fixed the cross-frame security error
1 parent c39ba00 commit 1af636d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

‎chrome-extension/manifest.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"js": [
1111
"contentScript.js"
1212
],
13-
"run_at": "document_start"
13+
"run_at": "document_start",
14+
"all_frames": true
1415
}],
1516
"icons": {
1617
"128": "assets/icon_128.png"

‎lib/chrome._api.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ chrome._api = (function (window) {
55
'use strict';
66

77
var slice = Array.prototype.slice,
8-
wnd = window.top,
98
undef = undefined,
109
callbackHash = {},
1110
listenerHash = {},
@@ -47,15 +46,15 @@ chrome._api = (function (window) {
4746
}
4847

4948
function invoke(id, method, params) {
50-
wnd.postMessage({
49+
window.postMessage({
5150
jsonrpc: '2.0',
5251
id: id,
5352
method: method,
5453
params: params
5554
}, '*');
5655
}
5756

58-
wnd.addEventListener('message', function (event) {
57+
window.addEventListener('message', function (event) {
5958
var msg = event.data;
6059

6160
if (msg.jsonrpc && !msg.method) {

0 commit comments

Comments
 (0)