mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Introduce GlobalScope::api_base_url
This commit is contained in:
parent
cb02d7911a
commit
3302a53d38
5 changed files with 26 additions and 18 deletions
|
@ -58,8 +58,9 @@ impl ServiceWorkerContainerMethods for ServiceWorkerContainer {
|
|||
script_url: USVString,
|
||||
options: &RegistrationOptions) -> Fallible<Root<ServiceWorkerRegistration>> {
|
||||
let USVString(ref script_url) = script_url;
|
||||
let api_base_url = self.global_scope().api_base_url();
|
||||
// Step 3-4
|
||||
let script_url = match self.global().r().api_base_url().join(script_url) {
|
||||
let script_url = match api_base_url.join(script_url) {
|
||||
Ok(url) => url,
|
||||
Err(_) => return Err(Error::Type("Invalid script URL".to_owned()))
|
||||
};
|
||||
|
@ -77,7 +78,7 @@ impl ServiceWorkerContainerMethods for ServiceWorkerContainer {
|
|||
let scope = match options.scope {
|
||||
Some(ref scope) => {
|
||||
let &USVString(ref inner_scope) = scope;
|
||||
match self.global().r().api_base_url().join(inner_scope) {
|
||||
match api_base_url.join(inner_scope) {
|
||||
Ok(url) => url,
|
||||
Err(_) => return Err(Error::Type("Invalid scope URL".to_owned()))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue