mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Bug 784233 - Relax __exposedProps__ check for sandboxes until we can repack AMO addons. r=gal
This commit is contained in:
parent
cdae47e099
commit
71db56f8c9
@ -45,5 +45,6 @@ DEPRECATED_OPERATION(InputEncoding)
|
||||
DEPRECATED_OPERATION(MozBeforePaint)
|
||||
DEPRECATED_OPERATION(MozBlobBuilder)
|
||||
DEPRECATED_OPERATION(DOMExceptionCode)
|
||||
DEPRECATED_OPERATION(NoExposedProps)
|
||||
DEPRECATED_OPERATION(MutationEvent)
|
||||
DEPRECATED_OPERATION(MozSlice)
|
||||
|
@ -95,12 +95,10 @@ function COWTests() {
|
||||
const PROPS_TO_TEST = ['foo', 'bar', 'prototype'];
|
||||
|
||||
var empty = {};
|
||||
var nonempty = {foo: 42, bar: 33};
|
||||
// Once we flip the default for __exposedProps__, this should behave
|
||||
// the same as for function objects below.
|
||||
is(getCOW(empty).foo, undefined,
|
||||
"shouldn't throw when accessing exposed properties that doesn't exist");
|
||||
PROPS_TO_TEST.forEach(function(name) {
|
||||
isPropHidden(getCOW(nonempty), name, "object without exposedProps");
|
||||
});
|
||||
|
||||
// Test function objects without __exposedProps__
|
||||
var func = function(x) { return 42; };
|
||||
|
@ -427,6 +427,26 @@ ExposedPropertiesOnly::check(JSContext *cx, JSObject *wrapper, jsid id, Wrapper:
|
||||
if (!wrapperAC.enter(cx, wrapper))
|
||||
return false;
|
||||
|
||||
// Make a temporary exception for objects in a chrome sandbox to help
|
||||
// out jetpack. See bug 784233.
|
||||
if (!JS_ObjectIsFunction(cx, wrappedObject) &&
|
||||
strcmp(js::GetObjectJSClass(JS_GetGlobalForObject(cx, wrappedObject))->name, "Sandbox"))
|
||||
{
|
||||
// This little loop hole will go away soon! See bug 553102.
|
||||
nsCOMPtr<nsPIDOMWindow> win =
|
||||
do_QueryInterface(nsJSUtils::GetStaticScriptGlobal(cx, wrapper));
|
||||
if (win) {
|
||||
nsCOMPtr<nsIDocument> doc =
|
||||
do_QueryInterface(win->GetExtantDocument());
|
||||
if (doc) {
|
||||
doc->WarnOnceAbout(nsIDocument::eNoExposedProps,
|
||||
/* asError = */ true);
|
||||
}
|
||||
}
|
||||
|
||||
perm = PermitPropertyAccess;
|
||||
return true;
|
||||
}
|
||||
return PermitIfUniversalXPConnect(cx, id, act, perm); // Deny
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user