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

Side by Side Diff: third_party/WebKit/Source/core/fileapi/URLFileAPI.cpp

Issue 1908263002: Don't expose URL.createObjectURL and revokeObjectURL to Service Workers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "core/fileapi/URLFileAPI.h"
6
7 #include "bindings/core/v8/ExceptionState.h"
8 #include "core/dom/DOMURL.h"
9 #include "core/dom/ExecutionContext.h"
10 #include "core/fileapi/Blob.h"
11 #include "core/html/PublicURLManager.h"
12
13 namespace blink {
14
15 // static
16 String URLFileAPI::createObjectURL(ExecutionContext* executionContext, Blob* blo b, ExceptionState& exceptionState)
17 {
18 DCHECK(blob);
19 if (!executionContext)
sof 2016/04/22 06:19:29 assert instead? i.e., can the current execution co
jsbell 2016/04/22 18:14:34 That's how I found the code. :( I'll switch it to
20 return String();
21 if (blob->hasBeenClosed()) {
22 exceptionState.throwDOMException(InvalidStateError, String(blob->isFile( ) ? "File" : "Blob") + " has been closed.");
23 return String();
24 }
25 return DOMURL::createPublicURL(executionContext, blob, blob->uuid());
26 }
27
28 // static
29 void URLFileAPI::revokeObjectURL(ExecutionContext* executionContext, const Strin g& urlString)
30 {
31 if (!executionContext)
32 return;
33
34 KURL url(KURL(), urlString);
35 executionContext->removeURLFromMemoryCache(url);
36 executionContext->publicURLManager().revoke(url);
37 }
38
39 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698