зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1587007 - P2 - Having two different error message when the prefs for COOP and COEP are enabled or not; r=jandem
Differential Revision: https://phabricator.services.mozilla.com/D50966 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
212da22601
Коммит
883d58bccf
|
@ -14,3 +14,14 @@ assertEq(ex.toString(),
|
|||
`TypeError: The SharedArrayBuffer object cannot be serialized. The ` +
|
||||
`Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy HTTP ` +
|
||||
`headers will enable this in the future.`);
|
||||
|
||||
var h = newGlobal({enableCoopAndCoep: true});
|
||||
try {
|
||||
h.serialize(sab);
|
||||
} catch (e) {
|
||||
ex = e;
|
||||
}
|
||||
assertEq(ex.toString(),
|
||||
`TypeError: The SharedArrayBuffer object cannot be serialized. The ` +
|
||||
`Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy HTTP ` +
|
||||
`headers can be used to enable this.`);
|
||||
|
|
|
@ -472,6 +472,7 @@ MSG_DEF(JSMSG_SC_DUP_TRANSFERABLE, 0, JSEXN_TYPEERR, "duplicate transferable
|
|||
MSG_DEF(JSMSG_SC_NOT_TRANSFERABLE, 0, JSEXN_TYPEERR, "invalid transferable array for structured clone")
|
||||
MSG_DEF(JSMSG_SC_UNSUPPORTED_TYPE, 0, JSEXN_TYPEERR, "unsupported type for structured data")
|
||||
MSG_DEF(JSMSG_SC_NOT_CLONABLE, 1, JSEXN_TYPEERR, "The {0} object cannot be serialized. The Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy HTTP headers will enable this in the future.")
|
||||
MSG_DEF(JSMSG_SC_NOT_CLONABLE_WITH_COOP_COEP, 1, JSEXN_TYPEERR, "The {0} object cannot be serialized. The Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy HTTP headers can be used to enable this.")
|
||||
MSG_DEF(JSMSG_SC_SAB_DISABLED, 0, JSEXN_TYPEERR, "SharedArrayBuffer not cloned - shared memory disabled in receiver")
|
||||
MSG_DEF(JSMSG_SC_SAB_REFCNT_OFLO, 0, JSEXN_TYPEERR, "SharedArrayBuffer has too many references")
|
||||
MSG_DEF(JSMSG_SC_SHMEM_TRANSFERABLE, 0, JSEXN_TYPEERR, "Shared memory objects must not be in the transfer list")
|
||||
|
|
|
@ -1253,8 +1253,12 @@ bool JSStructuredCloneWriter::writeSharedArrayBuffer(HandleObject obj) {
|
|||
MOZ_ASSERT(obj->canUnwrapAs<SharedArrayBufferObject>());
|
||||
|
||||
if (!cloneDataPolicy.isSharedArrayBufferAllowed()) {
|
||||
JS_ReportErrorNumberASCII(context(), GetErrorMessage, nullptr,
|
||||
JSMSG_SC_NOT_CLONABLE, "SharedArrayBuffer");
|
||||
auto errorMsg =
|
||||
context()->realm()->creationOptions().getCoopAndCoepEnabled()
|
||||
? JSMSG_SC_NOT_CLONABLE_WITH_COOP_COEP
|
||||
: JSMSG_SC_NOT_CLONABLE;
|
||||
JS_ReportErrorNumberASCII(context(), GetErrorMessage, nullptr, errorMsg,
|
||||
"SharedArrayBuffer");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1293,8 +1297,12 @@ bool JSStructuredCloneWriter::writeSharedWasmMemory(HandleObject obj) {
|
|||
|
||||
// Check the policy here so that we can report a sane error.
|
||||
if (!cloneDataPolicy.isSharedArrayBufferAllowed()) {
|
||||
JS_ReportErrorNumberASCII(context(), GetErrorMessage, nullptr,
|
||||
JSMSG_SC_NOT_CLONABLE, "WebAssembly.Memory");
|
||||
auto errorMsg =
|
||||
context()->realm()->creationOptions().getCoopAndCoepEnabled()
|
||||
? JSMSG_SC_NOT_CLONABLE_WITH_COOP_COEP
|
||||
: JSMSG_SC_NOT_CLONABLE;
|
||||
JS_ReportErrorNumberASCII(context(), GetErrorMessage, nullptr, errorMsg,
|
||||
"WebAssembly.Memory");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2217,8 +2225,12 @@ bool JSStructuredCloneReader::readArrayBuffer(uint32_t nbytes,
|
|||
|
||||
bool JSStructuredCloneReader::readSharedArrayBuffer(MutableHandleValue vp) {
|
||||
if (!cloneDataPolicy.isSharedArrayBufferAllowed()) {
|
||||
JS_ReportErrorNumberASCII(context(), GetErrorMessage, nullptr,
|
||||
JSMSG_SC_NOT_CLONABLE, "SharedArrayBuffer");
|
||||
auto errorMsg =
|
||||
context()->realm()->creationOptions().getCoopAndCoepEnabled()
|
||||
? JSMSG_SC_NOT_CLONABLE_WITH_COOP_COEP
|
||||
: JSMSG_SC_NOT_CLONABLE;
|
||||
JS_ReportErrorNumberASCII(context(), GetErrorMessage, nullptr, errorMsg,
|
||||
"SharedArrayBuffer");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2277,8 +2289,12 @@ bool JSStructuredCloneReader::readSharedWasmMemory(uint32_t nbytes,
|
|||
}
|
||||
|
||||
if (!cloneDataPolicy.isSharedArrayBufferAllowed()) {
|
||||
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
|
||||
JSMSG_SC_NOT_CLONABLE, "WebAssembly.Memory");
|
||||
auto errorMsg =
|
||||
context()->realm()->creationOptions().getCoopAndCoepEnabled()
|
||||
? JSMSG_SC_NOT_CLONABLE_WITH_COOP_COEP
|
||||
: JSMSG_SC_NOT_CLONABLE;
|
||||
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, errorMsg,
|
||||
"WebAssembly.Memory");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -945,14 +945,14 @@
|
|||
# When this pref is enabled document loads with a mismatched
|
||||
# Cross-Origin-Embedder-Policy header will fail to load
|
||||
- name: browser.tabs.remote.useCrossOriginEmbedderPolicy
|
||||
type: bool
|
||||
type: RelaxedAtomicBool
|
||||
value: false
|
||||
mirror: always
|
||||
|
||||
# When this pref is enabled top level loads with a mismatched
|
||||
# Cross-Origin-Opener-Policy header will be loaded in a separate process.
|
||||
- name: browser.tabs.remote.useCrossOriginOpenerPolicy
|
||||
type: bool
|
||||
type: RelaxedAtomicBool
|
||||
value: false
|
||||
mirror: always
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче