зеркало из https://github.com/mozilla/gecko-dev.git
Bug 849730 - Let objectClassIs through for COWs. r=mrbkap
This commit is contained in:
Родитель
cc67001730
Коммит
510b8a85e9
|
@ -0,0 +1,7 @@
|
|||
const Cu = Components.utils;
|
||||
|
||||
function run_test() {
|
||||
var sb = new Cu.Sandbox('http://www.example.com');
|
||||
sb.arr = [3, 4];
|
||||
do_check_true(Cu.evalInSandbox('Array.isArray(arr);', sb));
|
||||
}
|
|
@ -16,6 +16,7 @@ tail =
|
|||
[test_bug805807.js]
|
||||
[test_bug809652.js]
|
||||
[test_bug845201.js]
|
||||
[test_bug849730.js]
|
||||
[test_bug_442086.js]
|
||||
[test_file.js]
|
||||
[test_blob.js]
|
||||
|
|
|
@ -147,6 +147,16 @@ ChromeObjectWrapper::get(JSContext *cx, JSObject *wrapper, JSObject *receiver,
|
|||
return js::GetGeneric(cx, wrapperProto, receiver, id, vp);
|
||||
}
|
||||
|
||||
// SecurityWrapper categorically returns false for objectClassIs, but the
|
||||
// contacts API depends on Array.isArray returning true for COW-implemented
|
||||
// contacts. This isn't really ideal, but make it work for now.
|
||||
bool
|
||||
ChromeObjectWrapper::objectClassIs(JSObject *obj, js::ESClassValue classValue,
|
||||
JSContext *cx)
|
||||
{
|
||||
return CrossCompartmentWrapper::objectClassIs(obj, classValue, cx);
|
||||
}
|
||||
|
||||
// This mechanism isn't ideal because we end up calling enter() on the base class
|
||||
// twice (once during enter() here and once during the trap itself), and policy
|
||||
// enforcement or COWs isn't cheap. But it results in the cleanest code, and this
|
||||
|
|
|
@ -37,6 +37,9 @@ class ChromeObjectWrapper : public ChromeObjectWrapperBase
|
|||
virtual bool get(JSContext *cx, JSObject *wrapper, JSObject *receiver,
|
||||
jsid id, js::Value *vp) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool objectClassIs(JSObject *obj, js::ESClassValue classValue,
|
||||
JSContext *cx) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool enter(JSContext *cx, JSObject *wrapper, jsid id,
|
||||
js::Wrapper::Action act, bool *bp) MOZ_OVERRIDE;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче