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

Side by Side Diff: third_party/WebKit/Source/modules/fetch/GlobalFetch.cpp

Issue 2713413002: Blink bindings: use v8 to enforce method call access checks (Closed)
Patch Set: Restore comment Created 3 years, 9 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/fetch/GlobalFetch.h" 5 #include "modules/fetch/GlobalFetch.h"
6 6
7 #include "core/frame/LocalDOMWindow.h" 7 #include "core/frame/LocalDOMWindow.h"
8 #include "core/frame/UseCounter.h" 8 #include "core/frame/UseCounter.h"
9 #include "core/inspector/InspectorInstrumentation.h" 9 #include "core/inspector/InspectorInstrumentation.h"
10 #include "core/workers/WorkerGlobalScope.h" 10 #include "core/workers/WorkerGlobalScope.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 } 91 }
92 92
93 DEFINE_TRACE(GlobalFetch::ScopedFetcher) {} 93 DEFINE_TRACE(GlobalFetch::ScopedFetcher) {}
94 94
95 ScriptPromise GlobalFetch::fetch(ScriptState* scriptState, 95 ScriptPromise GlobalFetch::fetch(ScriptState* scriptState,
96 LocalDOMWindow& window, 96 LocalDOMWindow& window,
97 const RequestInfo& input, 97 const RequestInfo& input,
98 const Dictionary& init, 98 const Dictionary& init,
99 ExceptionState& exceptionState) { 99 ExceptionState& exceptionState) {
100 UseCounter::count(window.getExecutionContext(), UseCounter::Fetch); 100 UseCounter::count(window.getExecutionContext(), UseCounter::Fetch);
101 if (!window.frame()) {
102 exceptionState.throwTypeError("The global scope is shutting down.");
103 return ScriptPromise();
104 }
101 return ScopedFetcher::from(window)->fetch(scriptState, input, init, 105 return ScopedFetcher::from(window)->fetch(scriptState, input, init,
102 exceptionState); 106 exceptionState);
103 } 107 }
104 108
105 ScriptPromise GlobalFetch::fetch(ScriptState* scriptState, 109 ScriptPromise GlobalFetch::fetch(ScriptState* scriptState,
106 WorkerGlobalScope& worker, 110 WorkerGlobalScope& worker,
107 const RequestInfo& input, 111 const RequestInfo& input,
108 const Dictionary& init, 112 const Dictionary& init,
109 ExceptionState& exceptionState) { 113 ExceptionState& exceptionState) {
110 // Note that UseCounter doesn't work with SharedWorker or ServiceWorker. 114 // Note that UseCounter doesn't work with SharedWorker or ServiceWorker.
111 UseCounter::count(worker.getExecutionContext(), UseCounter::Fetch); 115 UseCounter::count(worker.getExecutionContext(), UseCounter::Fetch);
112 return ScopedFetcher::from(worker)->fetch(scriptState, input, init, 116 return ScopedFetcher::from(worker)->fetch(scriptState, input, init,
113 exceptionState); 117 exceptionState);
114 } 118 }
115 119
116 } // namespace blink 120 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698