mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
2c48de6a45
This can happen if chrome sets its proto to a content object from a different scope than the one doing the wrapping. In this case, the prototype chain looks like this: chromeobj => CCW(examplecom_obj) => CCW(examplecom_scope.Object.prototype) When wrapping chromeobj for exampleorg_scope, things will look like this: COW(chromeobj) => CCW(examplecom_obj) => CCW(examplecom_scope.Object.prototype) Note that we don't remap the proto of CCW(examplecom_scope) to exampleorg_scope.Object.prototype, because the proto remapping only happens when the object we're wrapping is chrome. There's no reason it has to be this way, but even if we changed it we still wouldn't get the nice remapped lookup behavior to exampleorg_scope.Object.prototype, because the proxy handler for CCW(examplecom_obj) isn't a ChromeObjectWrapper, and thus doesn't know how to to the prototype bouncing correctly. Anyway, I suspect this case isn't worth worrying about as long as we don't crash.
12 lines
392 B
JavaScript
12 lines
392 B
JavaScript
function run_test() {
|
|
var Cu = Components.utils;
|
|
var sb1 = Cu.Sandbox('http://example.com');
|
|
var sb2 = Cu.Sandbox('http://example.org');
|
|
var chromeObj = {foo: 2};
|
|
var sb1obj = Cu.evalInSandbox('new Object()', sb1);
|
|
chromeObj.__proto__ = sb1obj;
|
|
sb2.wrapMe = chromeObj;
|
|
do_check_true(true, "Didn't crash");
|
|
do_check_eq(sb2.wrapMe.__proto__, sb1obj, 'proto set correctly');
|
|
}
|