Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: third_party/WebKit/Source/modules/serviceworkers/InstallEvent.cpp

Issue 2815313002: Reland of Move ScriptState::GetExecutionContext (Part 5) (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/serviceworkers/InstallEvent.h" 5 #include "modules/serviceworkers/InstallEvent.h"
6 6
7 #include "bindings/core/v8/ScriptState.h" 7 #include "bindings/core/v8/ScriptState.h"
8 #include "core/dom/ExceptionCode.h" 8 #include "core/dom/ExceptionCode.h"
9 #include "core/dom/ExecutionContext.h"
9 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h" 10 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h"
10 #include "public/platform/WebSecurityOrigin.h" 11 #include "public/platform/WebSecurityOrigin.h"
11 12
12 namespace blink { 13 namespace blink {
13 14
14 InstallEvent* InstallEvent::Create(const AtomicString& type, 15 InstallEvent* InstallEvent::Create(const AtomicString& type,
15 const ExtendableEventInit& event_init) { 16 const ExtendableEventInit& event_init) {
16 return new InstallEvent(type, event_init); 17 return new InstallEvent(type, event_init);
17 } 18 }
18 19
(...skipping 30 matching lines...) Expand all
49 parsed_origins[i] = SecurityOrigin::CreateFromString(origin_list[i]); 50 parsed_origins[i] = SecurityOrigin::CreateFromString(origin_list[i]);
50 // Invalid URLs will result in a unique origin. And in general 51 // Invalid URLs will result in a unique origin. And in general
51 // unique origins should not be accepted. 52 // unique origins should not be accepted.
52 if (parsed_origins[i]->IsUnique()) { 53 if (parsed_origins[i]->IsUnique()) {
53 exception_state.ThrowTypeError("Invalid origin URL: " + origin_list[i]); 54 exception_state.ThrowTypeError("Invalid origin URL: " + origin_list[i]);
54 return; 55 return;
55 } 56 }
56 } 57 }
57 } 58 }
58 59
59 ExecutionContext* execution_context = script_state->GetExecutionContext(); 60 ExecutionContext* execution_context = ExecutionContext::From(script_state);
60 ServiceWorkerGlobalScopeClient* client = 61 ServiceWorkerGlobalScopeClient* client =
61 ServiceWorkerGlobalScopeClient::From(execution_context); 62 ServiceWorkerGlobalScopeClient::From(execution_context);
62 63
63 String scope_path = static_cast<KURL>(client->Scope()).GetPath(); 64 String scope_path = static_cast<KURL>(client->Scope()).GetPath();
64 RefPtr<SecurityOrigin> origin = execution_context->GetSecurityOrigin(); 65 RefPtr<SecurityOrigin> origin = execution_context->GetSecurityOrigin();
65 66
66 if (!options.hasScopes() || options.scopes().IsEmpty()) { 67 if (!options.hasScopes() || options.scopes().IsEmpty()) {
67 exception_state.ThrowTypeError("At least one scope is required"); 68 exception_state.ThrowTypeError("At least one scope is required");
68 return; 69 return;
69 } 70 }
(...skipping 28 matching lines...) Expand all
98 InstallEvent::InstallEvent(const AtomicString& type, 99 InstallEvent::InstallEvent(const AtomicString& type,
99 const ExtendableEventInit& initializer) 100 const ExtendableEventInit& initializer)
100 : ExtendableEvent(type, initializer) {} 101 : ExtendableEvent(type, initializer) {}
101 102
102 InstallEvent::InstallEvent(const AtomicString& type, 103 InstallEvent::InstallEvent(const AtomicString& type,
103 const ExtendableEventInit& initializer, 104 const ExtendableEventInit& initializer,
104 WaitUntilObserver* observer) 105 WaitUntilObserver* observer)
105 : ExtendableEvent(type, initializer, observer) {} 106 : ExtendableEvent(type, initializer, observer) {}
106 107
107 } // namespace blink 108 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698