mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 742444 - Rejigger unsafeWindow definition to not rely on passing waivers across origins. r=gabor
This commit is contained in:
parent
63e0a08f40
commit
14a57b73c7
@ -156,14 +156,19 @@ const WorkerSandbox = Class({
|
|||||||
// We need 'this === window === top' to be true in toplevel scope:
|
// We need 'this === window === top' to be true in toplevel scope:
|
||||||
get window() content,
|
get window() content,
|
||||||
get top() top,
|
get top() top,
|
||||||
get parent() parent,
|
get parent() parent
|
||||||
// Use the Greasemonkey naming convention to provide access to the
|
|
||||||
// unwrapped window object so the content script can access document
|
|
||||||
// JavaScript values.
|
|
||||||
// NOTE: this functionality is experimental and may change or go away
|
|
||||||
// at any time!
|
|
||||||
get unsafeWindow() window.wrappedJSObject
|
|
||||||
});
|
});
|
||||||
|
// Use the Greasemonkey naming convention to provide access to the
|
||||||
|
// unwrapped window object so the content script can access document
|
||||||
|
// JavaScript values.
|
||||||
|
// NOTE: this functionality is experimental and may change or go away
|
||||||
|
// at any time!
|
||||||
|
//
|
||||||
|
// Note that because waivers aren't propagated between origins, we
|
||||||
|
// need the unsafeWindow getter to live in the sandbox.
|
||||||
|
var unsafeWindowGetter =
|
||||||
|
new content.Function('return window.wrappedJSObject || window;');
|
||||||
|
Object.defineProperty(content, 'unsafeWindow', {get: unsafeWindowGetter});
|
||||||
|
|
||||||
// Load trusted code that will inject content script API.
|
// Load trusted code that will inject content script API.
|
||||||
let ContentWorker = load(content, CONTENT_WORKER_URL);
|
let ContentWorker = load(content, CONTENT_WORKER_URL);
|
||||||
|
@ -166,14 +166,20 @@ const WorkerSandbox = EventEmitter.compose({
|
|||||||
// We need "this === window === top" to be true in toplevel scope:
|
// We need "this === window === top" to be true in toplevel scope:
|
||||||
get window() content,
|
get window() content,
|
||||||
get top() top,
|
get top() top,
|
||||||
get parent() parent,
|
get parent() parent
|
||||||
// Use the Greasemonkey naming convention to provide access to the
|
|
||||||
// unwrapped window object so the content script can access document
|
|
||||||
// JavaScript values.
|
|
||||||
// NOTE: this functionality is experimental and may change or go away
|
|
||||||
// at any time!
|
|
||||||
get unsafeWindow() window.wrappedJSObject
|
|
||||||
});
|
});
|
||||||
|
// Use the Greasemonkey naming convention to provide access to the
|
||||||
|
// unwrapped window object so the content script can access document
|
||||||
|
// JavaScript values.
|
||||||
|
// NOTE: this functionality is experimental and may change or go away
|
||||||
|
// at any time!
|
||||||
|
//
|
||||||
|
// Note that because waivers aren't propagated between origins, we
|
||||||
|
// need the unsafeWindow getter to live in the sandbox.
|
||||||
|
var unsafeWindowGetter =
|
||||||
|
new content.Function('return window.wrappedJSObject || window;');
|
||||||
|
Object.defineProperty(content, 'unsafeWindow', {get: unsafeWindowGetter});
|
||||||
|
|
||||||
|
|
||||||
// Load trusted code that will inject content script API.
|
// Load trusted code that will inject content script API.
|
||||||
let ContentWorker = load(content, CONTENT_WORKER_URL);
|
let ContentWorker = load(content, CONTENT_WORKER_URL);
|
||||||
|
Loading…
Reference in New Issue
Block a user