OLD | NEW |
1 | 1 |
2 // Copyright 2014 The Chromium Authors. All rights reserved. | 2 // Copyright 2014 The Chromium Authors. All rights reserved. |
3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
5 | 5 |
6 #include "modules/serviceworkers/ServiceWorkerContainer.h" | 6 #include "modules/serviceworkers/ServiceWorkerContainer.h" |
7 | 7 |
8 #include "bindings/core/v8/Dictionary.h" | 8 #include "bindings/core/v8/Dictionary.h" |
9 #include "bindings/core/v8/ScriptFunction.h" | 9 #include "bindings/core/v8/ScriptFunction.h" |
10 #include "bindings/core/v8/ScriptPromise.h" | 10 #include "bindings/core/v8/ScriptPromise.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 return NavigatorServiceWorker::from(m_page->document()); | 155 return NavigatorServiceWorker::from(m_page->document()); |
156 } | 156 } |
157 v8::Isolate* isolate() { return v8::Isolate::GetCurrent(); } | 157 v8::Isolate* isolate() { return v8::Isolate::GetCurrent(); } |
158 ScriptState* getScriptState() { | 158 ScriptState* getScriptState() { |
159 return ScriptState::forMainWorld(m_page->document().frame()); | 159 return ScriptState::forMainWorld(m_page->document().frame()); |
160 } | 160 } |
161 | 161 |
162 void provide(std::unique_ptr<WebServiceWorkerProvider> provider) { | 162 void provide(std::unique_ptr<WebServiceWorkerProvider> provider) { |
163 Supplement<Document>::provideTo( | 163 Supplement<Document>::provideTo( |
164 m_page->document(), ServiceWorkerContainerClient::supplementName(), | 164 m_page->document(), ServiceWorkerContainerClient::supplementName(), |
165 ServiceWorkerContainerClient::create(std::move(provider))); | 165 new ServiceWorkerContainerClient(m_page->document(), |
| 166 std::move(provider))); |
166 } | 167 } |
167 | 168 |
168 void setPageURL(const String& url) { | 169 void setPageURL(const String& url) { |
169 // For URL completion. | 170 // For URL completion. |
170 m_page->document().setURL(KURL(KURL(), url)); | 171 m_page->document().setURL(KURL(KURL(), url)); |
171 | 172 |
172 // The basis for security checks. | 173 // The basis for security checks. |
173 m_page->document().setSecurityOrigin(SecurityOrigin::createFromString(url)); | 174 m_page->document().setSecurityOrigin(SecurityOrigin::createFromString(url)); |
174 } | 175 } |
175 | 176 |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 ScriptState::Scope scriptScope(getScriptState()); | 369 ScriptState::Scope scriptScope(getScriptState()); |
369 container->getRegistration(getScriptState(), ""); | 370 container->getRegistration(getScriptState(), ""); |
370 EXPECT_EQ(1ul, stubProvider.getRegistrationCallCount()); | 371 EXPECT_EQ(1ul, stubProvider.getRegistrationCallCount()); |
371 EXPECT_EQ(WebURL(KURL(KURL(), "http://localhost/x/index.html")), | 372 EXPECT_EQ(WebURL(KURL(KURL(), "http://localhost/x/index.html")), |
372 stubProvider.getRegistrationURL()); | 373 stubProvider.getRegistrationURL()); |
373 } | 374 } |
374 } | 375 } |
375 | 376 |
376 } // namespace | 377 } // namespace |
377 } // namespace blink | 378 } // namespace blink |
OLD | NEW |