Bug 1082450 - Rip exposedProps out of Social API code. r=Gijs

This commit is contained in:
Bobby Holley 2014-10-15 15:05:08 +02:00
Родитель fef572e932
Коммит a1ebfbe84e
3 изменённых файлов: 26 добавлений и 22 удалений

Просмотреть файл

@ -149,12 +149,6 @@ function ParentPort(portid, browserPromise, clientWindow) {
}
ParentPort.prototype = {
__exposedProps__: {
onmessage: "rw",
postMessage: "r",
close: "r",
toString: "r"
},
__proto__: AbstractPort.prototype,
_portType: "parent",

Просмотреть файл

@ -116,22 +116,17 @@ FrameWorker.prototype = {
});
// the "navigator" object in a worker is a subset of the full navigator;
// specifically, just the interfaces 'NavigatorID' and 'NavigatorOnLine'
let navigator = {
__exposedProps__: {
"appName": "r",
"appVersion": "r",
"platform": "r",
"userAgent": "r",
"onLine": "r"
},
let navigator = Cu.cloneInto({
// interface NavigatorID
appName: workerWindow.navigator.appName,
appVersion: workerWindow.navigator.appVersion,
platform: workerWindow.navigator.platform,
userAgent: workerWindow.navigator.userAgent,
// interface NavigatorOnLine
get onLine() workerWindow.navigator.onLine
};
}, sandbox);
Object.defineProperty(Cu.waiveXrays(navigator), 'onLine', {
configurable: true, enumerable: true,
get: Cu.exportFunction(() => workerWindow.navigator.onLine, sandbox)
});
sandbox.navigator = navigator;
// Our importScripts function needs to 'eval' the script code from inside

Просмотреть файл

@ -108,12 +108,27 @@ function attachToWindow(provider, targetWindow) {
configurable: true,
writable: true,
value: function() {
return {
port: port,
__exposedProps__: {
port: "r"
// We do a bunch of hacky stuff to expose this API to content without
// relying on ChromeObjectWrapper functionality that is now unsupported.
// The content-facing API here should really move to JS-Implemented
// WebIDL.
let workerAPI = Cu.cloneInto({
port: {
postMessage: port.postMessage.bind(port),
close: port.close.bind(port),
toString: port.toString.bind(port)
}
};
}, targetWindow, {cloneFunctions: true});
// Jump through hoops to define the accessor property.
let abstractPortPrototype = Object.getPrototypeOf(Object.getPrototypeOf(port));
let desc = Object.getOwnPropertyDescriptor(port.__proto__.__proto__, 'onmessage');
desc.get = Cu.exportFunction(desc.get.bind(port), targetWindow);
desc.set = Cu.exportFunction(desc.set.bind(port), targetWindow);
Object.defineProperty(workerAPI.wrappedJSObject.port, 'onmessage', desc);
return workerAPI;
}
},
hasBeenIdleFor: {