Commit d01fac89 authored by Yutaka Hirano's avatar Yutaka Hirano Committed by Commit Bot

Define WindowOrWorkerGlobalScope.crossOriginIsolated

Define the property behind a runtime enabled flag. Currently it always
return false. I'll modify the implementation later.

Bug: 1018680
Change-Id: I9971668254a6faa71c4ffb1a26e839d55760a10f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2245949Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#778633}
parent 3b3b3087
...@@ -152,6 +152,11 @@ unsigned ExecutionContext::ContextLifecycleStateObserverCountForTesting() ...@@ -152,6 +152,11 @@ unsigned ExecutionContext::ContextLifecycleStateObserverCountForTesting()
return lifecycle_state_observers; return lifecycle_state_observers;
} }
bool ExecutionContext::IsCrossOriginIsolated() const {
// TODO(yhirano): Implement this.
return false;
}
void ExecutionContext::AddConsoleMessageImpl(mojom::ConsoleMessageSource source, void ExecutionContext::AddConsoleMessageImpl(mojom::ConsoleMessageSource source,
mojom::ConsoleMessageLevel level, mojom::ConsoleMessageLevel level,
const String& message, const String& message,
......
...@@ -339,6 +339,9 @@ class CORE_EXPORT ExecutionContext : public Supplementable<ExecutionContext>, ...@@ -339,6 +339,9 @@ class CORE_EXPORT ExecutionContext : public Supplementable<ExecutionContext>,
} }
unsigned ContextLifecycleStateObserverCountForTesting() const; unsigned ContextLifecycleStateObserverCountForTesting() const;
// Implementation of WindowOrWorkerGlobalScope.crossOriginIsolated.
bool IsCrossOriginIsolated() const;
protected: protected:
explicit ExecutionContext(v8::Isolate* isolate); explicit ExecutionContext(v8::Isolate* isolate);
~ExecutionContext() override; ~ExecutionContext() override;
......
...@@ -239,4 +239,9 @@ ScriptPromise WindowOrWorkerGlobalScope::createImageBitmap( ...@@ -239,4 +239,9 @@ ScriptPromise WindowOrWorkerGlobalScope::createImageBitmap(
script_state, bitmap_source, sx, sy, sw, sh, options, exception_state); script_state, bitmap_source, sx, sy, sw, sh, options, exception_state);
} }
bool WindowOrWorkerGlobalScope::crossOriginIsolated(
const ExecutionContext& execution_context) {
return execution_context.IsCrossOriginIsolated();
}
} // namespace blink } // namespace blink
...@@ -99,6 +99,8 @@ class CORE_EXPORT WindowOrWorkerGlobalScope { ...@@ -99,6 +99,8 @@ class CORE_EXPORT WindowOrWorkerGlobalScope {
int sh, int sh,
const ImageBitmapOptions*, const ImageBitmapOptions*,
ExceptionState&); ExceptionState&);
static bool crossOriginIsolated(const ExecutionContext&);
}; };
} // namespace blink } // namespace blink
......
...@@ -58,4 +58,7 @@ typedef (HTMLImageElement or ...@@ -58,4 +58,7 @@ typedef (HTMLImageElement or
ImageBitmapSource imageBitmap, optional ImageBitmapOptions options = {}); ImageBitmapSource imageBitmap, optional ImageBitmapOptions options = {});
[CallWith=ScriptState, RaisesException] Promise<ImageBitmap> createImageBitmap( [CallWith=ScriptState, RaisesException] Promise<ImageBitmap> createImageBitmap(
ImageBitmapSource imageBitmap, long sx, long sy, long sw, long sh, optional ImageBitmapOptions options = {}); ImageBitmapSource imageBitmap, long sx, long sy, long sw, long sh, optional ImageBitmapOptions options = {});
[RuntimeEnabled=CrossOriginIsolation]
readonly attribute boolean crossOriginIsolated;
}; };
...@@ -372,6 +372,10 @@ ...@@ -372,6 +372,10 @@
{ {
name: "CorsRFC1918", name: "CorsRFC1918",
}, },
{
name: "CrossOriginIsolation",
status: "experimental",
},
{ {
name: "CSS3Text", name: "CSS3Text",
status: "experimental", status: "experimental",
......
...@@ -7,6 +7,6 @@ PASS Same-origin popup with coop unsafe-none without coep ...@@ -7,6 +7,6 @@ PASS Same-origin popup with coop unsafe-none without coep
PASS historical: "same-site" popup with coop unsafe-none without coep PASS historical: "same-site" popup with coop unsafe-none without coep
PASS Same-origin popup without coep PASS Same-origin popup without coep
PASS historical: "same-site" popup without coep PASS historical: "same-site" popup without coep
FAIL Bonus: window.crossOriginIsolated assert_true: expected true got undefined FAIL Bonus: window.crossOriginIsolated assert_true: expected true got false
Harness: the test ran to completion. Harness: the test ran to completion.
This is a testharness.js-based test.
PASS Cross-Origin-Opener-Policy only works over secure contexts
FAIL Bonus: window.crossOriginIsolated assert_false: expected false got undefined
Harness: the test ran to completion.
This is a testharness.js-based test. This is a testharness.js-based test.
FAIL postMessaging to a dedicated sub-worker allows them to see each others' modifications Worker is not defined FAIL postMessaging to a dedicated sub-worker allows them to see each others' modifications Worker is not defined
FAIL Bonus: self.crossOriginIsolated assert_true: expected true got undefined FAIL Bonus: self.crossOriginIsolated assert_true: expected true got false
Harness: the test ran to completion. Harness: the test ran to completion.
This is a testharness.js-based test. This is a testharness.js-based test.
PASS postMessaging to a dedicated sub-worker allows them to see each others' modifications PASS postMessaging to a dedicated sub-worker allows them to see each others' modifications
FAIL Bonus: self.crossOriginIsolated assert_true: expected true got undefined FAIL Bonus: self.crossOriginIsolated assert_true: expected true got false
Harness: the test ran to completion. Harness: the test ran to completion.
...@@ -3,6 +3,6 @@ FAIL SharedArrayBuffer constructor does not exist without COOP+COEP assert_equal ...@@ -3,6 +3,6 @@ FAIL SharedArrayBuffer constructor does not exist without COOP+COEP assert_equal
FAIL SharedArrayBuffer over MessageChannel without COOP+COEP assert_throws_dom: function "() => channel.port1.postMessage(sab)" did not throw FAIL SharedArrayBuffer over MessageChannel without COOP+COEP assert_throws_dom: function "() => channel.port1.postMessage(sab)" did not throw
FAIL SharedArrayBuffer over BroadcastChannel without COOP+COEP assert_throws_dom: function "() => channel.postMessage(sab)" did not throw FAIL SharedArrayBuffer over BroadcastChannel without COOP+COEP assert_throws_dom: function "() => channel.postMessage(sab)" did not throw
FAIL SharedArrayBuffer over postMessage() without COOP+COEP assert_throws_dom: function "() => self.postMessage(sab)" did not throw FAIL SharedArrayBuffer over postMessage() without COOP+COEP assert_throws_dom: function "() => self.postMessage(sab)" did not throw
FAIL Bonus: self.crossOriginIsolated assert_false: expected false got undefined PASS Bonus: self.crossOriginIsolated
Harness: the test ran to completion. Harness: the test ran to completion.
...@@ -2,6 +2,6 @@ This is a testharness.js-based test. ...@@ -2,6 +2,6 @@ This is a testharness.js-based test.
FAIL SharedArrayBuffer constructor does not exist without COOP+COEP assert_equals: expected (undefined) undefined but got (function) function "function SharedArrayBuffer() { [native code] }" FAIL SharedArrayBuffer constructor does not exist without COOP+COEP assert_equals: expected (undefined) undefined but got (function) function "function SharedArrayBuffer() { [native code] }"
FAIL SharedArrayBuffer over MessageChannel without COOP+COEP assert_throws_dom: function "() => channel.port1.postMessage(sab)" did not throw FAIL SharedArrayBuffer over MessageChannel without COOP+COEP assert_throws_dom: function "() => channel.port1.postMessage(sab)" did not throw
FAIL SharedArrayBuffer over BroadcastChannel without COOP+COEP assert_throws_dom: function "() => channel.postMessage(sab)" did not throw FAIL SharedArrayBuffer over BroadcastChannel without COOP+COEP assert_throws_dom: function "() => channel.postMessage(sab)" did not throw
FAIL Bonus: self.crossOriginIsolated assert_false: expected false got undefined PASS Bonus: self.crossOriginIsolated
Harness: the test ran to completion. Harness: the test ran to completion.
...@@ -2,6 +2,6 @@ This is a testharness.js-based test. ...@@ -2,6 +2,6 @@ This is a testharness.js-based test.
FAIL SharedArrayBuffer constructor does not exist without COOP+COEP assert_equals: expected (undefined) undefined but got (function) function "function SharedArrayBuffer() { [native code] }" FAIL SharedArrayBuffer constructor does not exist without COOP+COEP assert_equals: expected (undefined) undefined but got (function) function "function SharedArrayBuffer() { [native code] }"
FAIL SharedArrayBuffer over MessageChannel without COOP+COEP assert_throws_dom: function "() => channel.port1.postMessage(sab)" did not throw FAIL SharedArrayBuffer over MessageChannel without COOP+COEP assert_throws_dom: function "() => channel.port1.postMessage(sab)" did not throw
FAIL SharedArrayBuffer over BroadcastChannel without COOP+COEP assert_throws_dom: function "() => channel.postMessage(sab)" did not throw FAIL SharedArrayBuffer over BroadcastChannel without COOP+COEP assert_throws_dom: function "() => channel.postMessage(sab)" did not throw
FAIL Bonus: self.crossOriginIsolated assert_false: expected false got undefined PASS Bonus: self.crossOriginIsolated
Harness: the test ran to completion. Harness: the test ran to completion.
...@@ -2,6 +2,6 @@ This is a testharness.js-based test. ...@@ -2,6 +2,6 @@ This is a testharness.js-based test.
FAIL SharedArrayBuffer constructor does not exist without COOP+COEP assert_equals: expected (undefined) undefined but got (function) function "function SharedArrayBuffer() { [native code] }" FAIL SharedArrayBuffer constructor does not exist without COOP+COEP assert_equals: expected (undefined) undefined but got (function) function "function SharedArrayBuffer() { [native code] }"
FAIL SharedArrayBuffer over MessageChannel without COOP+COEP assert_throws_dom: function "() => channel.port1.postMessage(sab)" did not throw FAIL SharedArrayBuffer over MessageChannel without COOP+COEP assert_throws_dom: function "() => channel.port1.postMessage(sab)" did not throw
FAIL SharedArrayBuffer over BroadcastChannel without COOP+COEP assert_throws_dom: function "() => channel.postMessage(sab)" did not throw FAIL SharedArrayBuffer over BroadcastChannel without COOP+COEP assert_throws_dom: function "() => channel.postMessage(sab)" did not throw
FAIL Bonus: self.crossOriginIsolated assert_false: expected false got undefined PASS Bonus: self.crossOriginIsolated
Harness: the test ran to completion. Harness: the test ran to completion.
...@@ -5,6 +5,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE ...@@ -5,6 +5,7 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
PASS oldChildWindow.closed is newChildWindow.closed PASS oldChildWindow.closed is newChildWindow.closed
PASS oldChildWindow.cookieStore.onchange is newChildWindow.cookieStore.onchange PASS oldChildWindow.cookieStore.onchange is newChildWindow.cookieStore.onchange
PASS oldChildWindow.crossOriginIsolated is newChildWindow.crossOriginIsolated
PASS oldChildWindow.defaultStatus is newChildWindow.defaultStatus PASS oldChildWindow.defaultStatus is newChildWindow.defaultStatus
PASS oldChildWindow.defaultstatus is newChildWindow.defaultstatus PASS oldChildWindow.defaultstatus is newChildWindow.defaultstatus
PASS oldChildWindow.devicePixelRatio is newChildWindow.devicePixelRatio PASS oldChildWindow.devicePixelRatio is newChildWindow.devicePixelRatio
......
...@@ -4,6 +4,7 @@ Tests property access on a cached DOMWindow after the associated frame is remove ...@@ -4,6 +4,7 @@ Tests property access on a cached DOMWindow after the associated frame is remove
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS childWindow.closed is true PASS childWindow.closed is true
PASS childWindow.crossOriginIsolated is false
PASS childWindow.defaultStatus is '' PASS childWindow.defaultStatus is ''
PASS childWindow.defaultstatus is '' PASS childWindow.defaultstatus is ''
PASS childWindow.devicePixelRatio is 0 PASS childWindow.devicePixelRatio is 0
......
...@@ -4,6 +4,7 @@ Tests property access on a cached DOMWindow after the associated frame is no lon ...@@ -4,6 +4,7 @@ Tests property access on a cached DOMWindow after the associated frame is no lon
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS childWindow.closed is true PASS childWindow.closed is true
PASS childWindow.crossOriginIsolated is false
PASS childWindow.defaultStatus is '' PASS childWindow.defaultStatus is ''
PASS childWindow.defaultstatus is '' PASS childWindow.defaultstatus is ''
PASS childWindow.devicePixelRatio is 0 PASS childWindow.devicePixelRatio is 0
......
...@@ -3740,6 +3740,7 @@ interface WorkerGlobalScope : EventTarget ...@@ -3740,6 +3740,7 @@ interface WorkerGlobalScope : EventTarget
attribute @@toStringTag attribute @@toStringTag
getter addressSpace getter addressSpace
getter caches getter caches
getter crossOriginIsolated
getter crypto getter crypto
getter fonts getter fonts
getter indexedDB getter indexedDB
......
...@@ -3794,6 +3794,7 @@ Starting worker: resources/global-interface-listing-worker.js ...@@ -3794,6 +3794,7 @@ Starting worker: resources/global-interface-listing-worker.js
[Worker] attribute @@toStringTag [Worker] attribute @@toStringTag
[Worker] getter addressSpace [Worker] getter addressSpace
[Worker] getter caches [Worker] getter caches
[Worker] getter crossOriginIsolated
[Worker] getter crypto [Worker] getter crypto
[Worker] getter fonts [Worker] getter fonts
[Worker] getter indexedDB [Worker] getter indexedDB
......
...@@ -11709,6 +11709,7 @@ interface webkitURL ...@@ -11709,6 +11709,7 @@ interface webkitURL
getter caches getter caches
getter clientInformation getter clientInformation
getter cookieStore getter cookieStore
getter crossOriginIsolated
getter crypto getter crypto
getter customElements getter customElements
getter defaultStatus getter defaultStatus
......
...@@ -3612,6 +3612,7 @@ Starting worker: resources/global-interface-listing-worker.js ...@@ -3612,6 +3612,7 @@ Starting worker: resources/global-interface-listing-worker.js
[Worker] attribute @@toStringTag [Worker] attribute @@toStringTag
[Worker] getter addressSpace [Worker] getter addressSpace
[Worker] getter caches [Worker] getter caches
[Worker] getter crossOriginIsolated
[Worker] getter crypto [Worker] getter crypto
[Worker] getter fonts [Worker] getter fonts
[Worker] getter indexedDB [Worker] getter indexedDB
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment