Merge remote-tracking branch 'upstream/master' into feat-cow-infra

This commit is contained in:
yvt 2021-07-14 01:00:04 +09:00
commit 863c90acd8
6 changed files with 16 additions and 20 deletions

View file

@ -53,7 +53,7 @@ use net_traits::IpcSend;
use parking_lot::Mutex;
use script_traits::{WorkerGlobalScopeInit, WorkerScriptLoadOrigin};
use servo_rand::random;
use servo_url::ServoUrl;
use servo_url::{ImmutableOrigin, ServoUrl};
use std::mem::replace;
use std::sync::atomic::AtomicBool;
use std::sync::Arc;
@ -310,7 +310,7 @@ impl DedicatedWorkerGlobalScope {
#[allow(unsafe_code)]
// https://html.spec.whatwg.org/multipage/#run-a-worker
pub fn run_worker_scope(
init: WorkerGlobalScopeInit,
mut init: WorkerGlobalScopeInit,
worker_url: ServoUrl,
from_devtools_receiver: IpcReceiver<DevtoolScriptControlMsg>,
worker: TrustedWorkerAddress,
@ -387,6 +387,17 @@ impl DedicatedWorkerGlobalScope {
devtools_mpsc_chan,
);
// Step 8 "Set up a worker environment settings object [...]"
//
// <https://html.spec.whatwg.org/multipage/#script-settings-for-workers>
//
// > The origin: Return a unique opaque origin if `worker global
// > scope`'s url's scheme is "data", and `inherited origin`
// > otherwise.
if worker_url.scheme() == "data" {
init.origin = ImmutableOrigin::new_opaque();
}
let global = DedicatedWorkerGlobalScope::new(
init,
DOMString::from_string(worker_name),
@ -453,7 +464,7 @@ impl DedicatedWorkerGlobalScope {
.mem_profiler_chan()
.run_with_memory_reporting(
|| {
// Step 29, Run the responsible event loop specified
// Step 27, Run the responsible event loop specified
// by inside settings until it is destroyed.
// The worker processing model remains on this step
// until the event loop is destroyed,

View file

@ -280,7 +280,7 @@ impl ServiceWorkerGlobalScope {
}
#[allow(unsafe_code)]
// https://html.spec.whatwg.org/multipage/#run-a-worker
// https://w3c.github.io/ServiceWorker/#run-service-worker-algorithm
pub fn run_serviceworker_scope(
scope_things: ScopeThings,
own_sender: Sender<ServiceWorkerScriptMsg>,
@ -382,7 +382,7 @@ impl ServiceWorkerGlobalScope {
.mem_profiler_chan()
.run_with_memory_reporting(
|| {
// Step 29, Run the responsible event loop specified
// Step 18, Run the responsible event loop specified
// by inside settings until it is destroyed.
// The worker processing model remains on this step
// until the event loop is destroyed,