mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1083427 - Remove exposedProps from sandbox code. r=gabor
This commit is contained in:
parent
822502877c
commit
4a39398fbf
@ -176,12 +176,8 @@ const WorkerSandbox = Class({
|
||||
// by trading two methods that allow to send events to the other side:
|
||||
// - `onEvent` called by content script
|
||||
// - `result.emitToContent` called by addon script
|
||||
// Bug 758203: We have to explicitely define `__exposedProps__` in order
|
||||
// to allow access to these chrome object attributes from this sandbox with
|
||||
// content priviledges
|
||||
// https://developer.mozilla.org/en/XPConnect_wrappers#Other_security_wrappers
|
||||
let onEvent = onContentEvent.bind(null, this);
|
||||
let chromeAPI = createChromeAPI();
|
||||
let chromeAPI = createChromeAPI(ContentWorker);
|
||||
let result = Cu.waiveXrays(ContentWorker).inject(content, chromeAPI, onEvent, options);
|
||||
|
||||
// Merge `emitToContent` into our private model of the
|
||||
@ -379,29 +375,16 @@ function emitToContent (workerSandbox, args) {
|
||||
return modelFor(workerSandbox).emitToContent(args);
|
||||
}
|
||||
|
||||
function createChromeAPI () {
|
||||
return {
|
||||
function createChromeAPI (scope) {
|
||||
return Cu.cloneInto({
|
||||
timers: {
|
||||
setTimeout: timer.setTimeout,
|
||||
setInterval: timer.setInterval,
|
||||
clearTimeout: timer.clearTimeout,
|
||||
clearInterval: timer.clearInterval,
|
||||
__exposedProps__: {
|
||||
setTimeout: 'r',
|
||||
setInterval: 'r',
|
||||
clearTimeout: 'r',
|
||||
clearInterval: 'r'
|
||||
},
|
||||
setTimeout: timer.setTimeout.bind(timer),
|
||||
setInterval: timer.setInterval.bind(timer),
|
||||
clearTimeout: timer.clearTimeout.bind(timer),
|
||||
clearInterval: timer.clearInterval.bind(timer),
|
||||
},
|
||||
sandbox: {
|
||||
evaluate: evaluate,
|
||||
__exposedProps__: {
|
||||
evaluate: 'r'
|
||||
}
|
||||
},
|
||||
__exposedProps__: {
|
||||
timers: 'r',
|
||||
sandbox: 'r'
|
||||
}
|
||||
};
|
||||
}, scope, {cloneFunctions: true});
|
||||
}
|
||||
|
@ -184,34 +184,17 @@ const WorkerSandbox = EventEmitter.compose({
|
||||
// by trading two methods that allow to send events to the other side:
|
||||
// - `onEvent` called by content script
|
||||
// - `result.emitToContent` called by addon script
|
||||
// Bug 758203: We have to explicitely define `__exposedProps__` in order
|
||||
// to allow access to these chrome object attributes from this sandbox with
|
||||
// content priviledges
|
||||
// https://developer.mozilla.org/en/XPConnect_wrappers#Other_security_wrappers
|
||||
let chromeAPI = {
|
||||
let chromeAPI = Cu.cloneInto({
|
||||
timers: {
|
||||
setTimeout: timer.setTimeout,
|
||||
setInterval: timer.setInterval,
|
||||
clearTimeout: timer.clearTimeout,
|
||||
clearInterval: timer.clearInterval,
|
||||
__exposedProps__: {
|
||||
setTimeout: 'r',
|
||||
setInterval: 'r',
|
||||
clearTimeout: 'r',
|
||||
clearInterval: 'r'
|
||||
}
|
||||
setTimeout: timer.setTimeout.bind(timer),
|
||||
setInterval: timer.setInterval.bind(timer),
|
||||
clearTimeout: timer.clearTimeout.bind(timer),
|
||||
clearInterval: timer.clearInterval.bind(timer),
|
||||
},
|
||||
sandbox: {
|
||||
evaluate: evaluate,
|
||||
__exposedProps__: {
|
||||
evaluate: 'r',
|
||||
}
|
||||
},
|
||||
__exposedProps__: {
|
||||
timers: 'r',
|
||||
sandbox: 'r',
|
||||
}
|
||||
};
|
||||
}, ContentWorker, {cloneFunctions: true});
|
||||
let onEvent = this._onContentEvent.bind(this);
|
||||
let result = Cu.waiveXrays(ContentWorker).inject(content, chromeAPI, onEvent, options);
|
||||
this._emitToContent = result;
|
||||
|
Loading…
Reference in New Issue
Block a user