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

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

Issue 2691333002: Replace [CallWith=ExecutionContext] with [CallWith=ScriptState] (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClient.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/ServiceWorkerLinkResource.h" 5 #include "modules/serviceworkers/ServiceWorkerLinkResource.h"
6 6
7 #include "bindings/core/v8/ExceptionState.h" 7 #include "bindings/core/v8/ExceptionState.h"
8 #include "bindings/core/v8/ScriptState.h"
8 #include "core/dom/Document.h" 9 #include "core/dom/Document.h"
9 #include "core/frame/DOMWindow.h" 10 #include "core/frame/DOMWindow.h"
10 #include "core/frame/LocalFrame.h" 11 #include "core/frame/LocalFrame.h"
11 #include "core/html/HTMLLinkElement.h" 12 #include "core/html/HTMLLinkElement.h"
12 #include "core/inspector/ConsoleMessage.h" 13 #include "core/inspector/ConsoleMessage.h"
13 #include "core/loader/FrameLoaderClient.h" 14 #include "core/loader/FrameLoaderClient.h"
14 #include "modules/serviceworkers/NavigatorServiceWorker.h" 15 #include "modules/serviceworkers/NavigatorServiceWorker.h"
15 #include "modules/serviceworkers/ServiceWorkerContainer.h" 16 #include "modules/serviceworkers/ServiceWorkerContainer.h"
16 #include "public/platform/Platform.h" 17 #include "public/platform/Platform.h"
17 #include "public/platform/WebScheduler.h" 18 #include "public/platform/WebScheduler.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 String scope = m_owner->scope(); 75 String scope = m_owner->scope();
75 KURL scopeURL; 76 KURL scopeURL;
76 if (scope.isNull()) 77 if (scope.isNull())
77 scopeURL = KURL(scriptURL, "./"); 78 scopeURL = KURL(scriptURL, "./");
78 else 79 else
79 scopeURL = document.completeURL(scope); 80 scopeURL = document.completeURL(scope);
80 scopeURL.removeFragmentIdentifier(); 81 scopeURL.removeFragmentIdentifier();
81 82
82 String errorMessage; 83 String errorMessage;
83 ServiceWorkerContainer* container = NavigatorServiceWorker::serviceWorker( 84 ServiceWorkerContainer* container = NavigatorServiceWorker::serviceWorker(
84 &document, *document.frame()->domWindow()->navigator(), errorMessage); 85 ScriptState::forMainWorld(m_owner->document().frame()),
86 *document.frame()->domWindow()->navigator(), errorMessage);
85 87
86 if (!container) { 88 if (!container) {
87 document.addConsoleMessage(ConsoleMessage::create( 89 document.addConsoleMessage(ConsoleMessage::create(
88 JSMessageSource, ErrorMessageLevel, 90 JSMessageSource, ErrorMessageLevel,
89 "Cannot register service worker with <link> element. " + errorMessage)); 91 "Cannot register service worker with <link> element. " + errorMessage));
90 WTF::makeUnique<RegistrationCallback>(m_owner)->onError( 92 WTF::makeUnique<RegistrationCallback>(m_owner)->onError(
91 WebServiceWorkerError(WebServiceWorkerError::ErrorTypeSecurity, 93 WebServiceWorkerError(WebServiceWorkerError::ErrorTypeSecurity,
92 errorMessage)); 94 errorMessage));
93 return; 95 return;
94 } 96 }
95 97
96 container->registerServiceWorkerImpl( 98 container->registerServiceWorkerImpl(
97 &document, scriptURL, scopeURL, 99 &document, scriptURL, scopeURL,
98 WTF::makeUnique<RegistrationCallback>(m_owner)); 100 WTF::makeUnique<RegistrationCallback>(m_owner));
99 } 101 }
100 102
101 bool ServiceWorkerLinkResource::hasLoaded() const { 103 bool ServiceWorkerLinkResource::hasLoaded() const {
102 return false; 104 return false;
103 } 105 }
104 106
105 void ServiceWorkerLinkResource::ownerRemoved() { 107 void ServiceWorkerLinkResource::ownerRemoved() {
106 process(); 108 process();
107 } 109 }
108 110
109 ServiceWorkerLinkResource::ServiceWorkerLinkResource(HTMLLinkElement* owner) 111 ServiceWorkerLinkResource::ServiceWorkerLinkResource(HTMLLinkElement* owner)
110 : LinkResource(owner) {} 112 : LinkResource(owner) {}
111 113
112 } // namespace blink 114 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/serviceworkers/ServiceWorkerClient.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698