Bug 1335654 part 4. Fix some CrossOriginXrayWrapper error reporting bits to follow the HTML spec for cross-origin objects. r=bholley

This commit is contained in:
Boris Zbarsky 2017-02-02 12:48:49 -05:00
parent bcc1d4ab44
commit 0041276515
2 changed files with 4 additions and 8 deletions

View File

@ -8,6 +8,8 @@
#include "AccessCheck.h"
#include "ChromeObjectWrapper.h"
#include "XrayWrapper.h"
#include "nsJSUtils.h"
#include "mozilla/ErrorResult.h"
#include "jsapi.h"
@ -287,7 +289,7 @@ CrossOriginXrayWrapper::defineProperty(JSContext* cx, JS::Handle<JSObject*> wrap
JS::Handle<PropertyDescriptor> desc,
JS::ObjectOpResult& result) const
{
JS_ReportErrorASCII(cx, "Permission denied to define property on cross-origin object");
AccessCheck::reportCrossOriginDenial(cx, id, NS_LITERAL_CSTRING("define"));
return false;
}
@ -295,7 +297,7 @@ bool
CrossOriginXrayWrapper::delete_(JSContext* cx, JS::Handle<JSObject*> wrapper,
JS::Handle<jsid> id, JS::ObjectOpResult& result) const
{
JS_ReportErrorASCII(cx, "Permission denied to delete property on cross-origin object");
AccessCheck::reportCrossOriginDenial(cx, id, NS_LITERAL_CSTRING("delete"));
return false;
}

View File

@ -6,12 +6,6 @@
[[[SetPrototypeOf\]\] should throw]
expected: FAIL
[[[Delete\]\] Should throw on cross-origin objects]
expected: FAIL
[[[DefineOwnProperty\]\] Should throw for cross-origin objects]
expected: FAIL
[[[OwnPropertyKeys\]\] should return all properties from cross-origin objects]
expected: FAIL