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

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

Issue 2821443002: Revert of Move ScriptState::GetExecutionContext (Part 5) (Closed)
Patch Set: Revert 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"
10 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h" 9 #include "modules/serviceworkers/ServiceWorkerGlobalScopeClient.h"
11 #include "public/platform/WebSecurityOrigin.h" 10 #include "public/platform/WebSecurityOrigin.h"
12 11
13 namespace blink { 12 namespace blink {
14 13
15 InstallEvent* InstallEvent::Create(const AtomicString& type, 14 InstallEvent* InstallEvent::Create(const AtomicString& type,
16 const ExtendableEventInit& event_init) { 15 const ExtendableEventInit& event_init) {
17 return new InstallEvent(type, event_init); 16 return new InstallEvent(type, event_init);
18 } 17 }
19 18
(...skipping 30 matching lines...) Expand all
50 parsed_origins[i] = SecurityOrigin::CreateFromString(origin_list[i]); 49 parsed_origins[i] = SecurityOrigin::CreateFromString(origin_list[i]);
51 // Invalid URLs will result in a unique origin. And in general 50 // Invalid URLs will result in a unique origin. And in general
52 // unique origins should not be accepted. 51 // unique origins should not be accepted.
53 if (parsed_origins[i]->IsUnique()) { 52 if (parsed_origins[i]->IsUnique()) {
54 exception_state.ThrowTypeError("Invalid origin URL: " + origin_list[i]); 53 exception_state.ThrowTypeError("Invalid origin URL: " + origin_list[i]);
55 return; 54 return;
56 } 55 }
57 } 56 }
58 } 57 }
59 58
60 ExecutionContext* execution_context = ExecutionContext::From(script_state); 59 ExecutionContext* execution_context = script_state->GetExecutionContext();
61 ServiceWorkerGlobalScopeClient* client = 60 ServiceWorkerGlobalScopeClient* client =
62 ServiceWorkerGlobalScopeClient::From(execution_context); 61 ServiceWorkerGlobalScopeClient::From(execution_context);
63 62
64 String scope_path = static_cast<KURL>(client->Scope()).GetPath(); 63 String scope_path = static_cast<KURL>(client->Scope()).GetPath();
65 RefPtr<SecurityOrigin> origin = execution_context->GetSecurityOrigin(); 64 RefPtr<SecurityOrigin> origin = execution_context->GetSecurityOrigin();
66 65
67 if (!options.hasScopes() || options.scopes().IsEmpty()) { 66 if (!options.hasScopes() || options.scopes().IsEmpty()) {
68 exception_state.ThrowTypeError("At least one scope is required"); 67 exception_state.ThrowTypeError("At least one scope is required");
69 return; 68 return;
70 } 69 }
(...skipping 28 matching lines...) Expand all
99 InstallEvent::InstallEvent(const AtomicString& type, 98 InstallEvent::InstallEvent(const AtomicString& type,
100 const ExtendableEventInit& initializer) 99 const ExtendableEventInit& initializer)
101 : ExtendableEvent(type, initializer) {} 100 : ExtendableEvent(type, initializer) {}
102 101
103 InstallEvent::InstallEvent(const AtomicString& type, 102 InstallEvent::InstallEvent(const AtomicString& type,
104 const ExtendableEventInit& initializer, 103 const ExtendableEventInit& initializer,
105 WaitUntilObserver* observer) 104 WaitUntilObserver* observer)
106 : ExtendableEvent(type, initializer, observer) {} 105 : ExtendableEvent(type, initializer, observer) {}
107 106
108 } // namespace blink 107 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698