| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2012 Motorola Mobility Inc. | 3 * Copyright (C) 2012 Motorola Mobility Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 #include "core/dom/DOMURL.h" | 27 #include "core/dom/DOMURL.h" |
| 28 | 28 |
| 29 #include "bindings/core/v8/ExceptionMessages.h" | 29 #include "bindings/core/v8/ExceptionMessages.h" |
| 30 #include "bindings/core/v8/ExceptionState.h" | 30 #include "bindings/core/v8/ExceptionState.h" |
| 31 #include "core/dom/ExceptionCode.h" | 31 #include "core/dom/ExceptionCode.h" |
| 32 #include "core/dom/ExecutionContext.h" | 32 #include "core/dom/ExecutionContext.h" |
| 33 #include "core/dom/URLSearchParams.h" | 33 #include "core/dom/URLSearchParams.h" |
| 34 #include "core/fetch/MemoryCache.h" | 34 #include "core/fetch/MemoryCache.h" |
| 35 #include "core/fileapi/Blob.h" | 35 #include "core/fileapi/Blob.h" |
| 36 #include "core/frame/Deprecation.h" |
| 37 #include "core/frame/UseCounter.h" |
| 36 #include "core/html/PublicURLManager.h" | 38 #include "core/html/PublicURLManager.h" |
| 37 #include "platform/blob/BlobURL.h" | 39 #include "platform/blob/BlobURL.h" |
| 38 #include "platform/weborigin/SecurityOrigin.h" | 40 #include "platform/weborigin/SecurityOrigin.h" |
| 39 #include "wtf/TemporaryChange.h" | 41 #include "wtf/TemporaryChange.h" |
| 40 | 42 |
| 41 namespace blink { | 43 namespace blink { |
| 42 | 44 |
| 43 DOMURL::DOMURL(const String& url, const KURL& base, ExceptionState& exceptionSta
te) | 45 DOMURL::DOMURL(const String& url, const KURL& base, ExceptionState& exceptionSta
te) |
| 44 { | 46 { |
| 45 if (!base.isValid()) { | 47 if (!base.isValid()) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 updateSearchParams(value.substring(1)); | 83 updateSearchParams(value.substring(1)); |
| 82 else | 84 else |
| 83 updateSearchParams(value); | 85 updateSearchParams(value); |
| 84 } | 86 } |
| 85 | 87 |
| 86 String DOMURL::createObjectURL(ExecutionContext* executionContext, Blob* blob, E
xceptionState& exceptionState) | 88 String DOMURL::createObjectURL(ExecutionContext* executionContext, Blob* blob, E
xceptionState& exceptionState) |
| 87 { | 89 { |
| 88 DCHECK(blob); | 90 DCHECK(blob); |
| 89 if (!executionContext) | 91 if (!executionContext) |
| 90 return String(); | 92 return String(); |
| 93 |
| 94 if (executionContext->isServiceWorkerGlobalScope()) |
| 95 Deprecation::countDeprecation(executionContext, UseCounter::URLMethodCre
ateObjectURLServiceWorker); |
| 96 |
| 91 if (blob->hasBeenClosed()) { | 97 if (blob->hasBeenClosed()) { |
| 92 exceptionState.throwDOMException(InvalidStateError, String(blob->isFile(
) ? "File" : "Blob") + " has been closed."); | 98 exceptionState.throwDOMException(InvalidStateError, String(blob->isFile(
) ? "File" : "Blob") + " has been closed."); |
| 93 return String(); | 99 return String(); |
| 94 } | 100 } |
| 95 return createPublicURL(executionContext, blob, blob->uuid()); | 101 return createPublicURL(executionContext, blob, blob->uuid()); |
| 96 } | 102 } |
| 97 | 103 |
| 98 String DOMURL::createPublicURL(ExecutionContext* executionContext, URLRegistrabl
e* registrable, const String& uuid) | 104 String DOMURL::createPublicURL(ExecutionContext* executionContext, URLRegistrabl
e* registrable, const String& uuid) |
| 99 { | 105 { |
| 100 KURL publicURL = BlobURL::createPublicURL(executionContext->getSecurityOrigi
n()); | 106 KURL publicURL = BlobURL::createPublicURL(executionContext->getSecurityOrigi
n()); |
| 101 if (publicURL.isEmpty()) | 107 if (publicURL.isEmpty()) |
| 102 return String(); | 108 return String(); |
| 103 | 109 |
| 104 executionContext->publicURLManager().registerURL(executionContext->getSecuri
tyOrigin(), publicURL, registrable, uuid); | 110 executionContext->publicURLManager().registerURL(executionContext->getSecuri
tyOrigin(), publicURL, registrable, uuid); |
| 105 | 111 |
| 106 return publicURL.getString(); | 112 return publicURL.getString(); |
| 107 } | 113 } |
| 108 | 114 |
| 109 void DOMURL::revokeObjectURL(ExecutionContext* executionContext, const String& u
rlString) | 115 void DOMURL::revokeObjectURL(ExecutionContext* executionContext, const String& u
rlString) |
| 110 { | 116 { |
| 111 if (!executionContext) | 117 if (!executionContext) |
| 112 return; | 118 return; |
| 113 | 119 |
| 120 if (executionContext->isServiceWorkerGlobalScope()) |
| 121 Deprecation::countDeprecation(executionContext, UseCounter::URLMethodRev
okeObjectURLServiceWorker); |
| 122 |
| 114 KURL url(KURL(), urlString); | 123 KURL url(KURL(), urlString); |
| 115 executionContext->removeURLFromMemoryCache(url); | 124 executionContext->removeURLFromMemoryCache(url); |
| 116 executionContext->publicURLManager().revoke(url); | 125 executionContext->publicURLManager().revoke(url); |
| 117 } | 126 } |
| 118 | 127 |
| 119 void DOMURL::revokeObjectUUID(ExecutionContext* executionContext, const String&
uuid) | 128 void DOMURL::revokeObjectUUID(ExecutionContext* executionContext, const String&
uuid) |
| 120 { | 129 { |
| 121 if (!executionContext) | 130 if (!executionContext) |
| 122 return; | 131 return; |
| 123 | 132 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 141 { | 150 { |
| 142 if (!m_searchParams) | 151 if (!m_searchParams) |
| 143 return; | 152 return; |
| 144 | 153 |
| 145 TemporaryChange<bool> scope(m_isInUpdate, true); | 154 TemporaryChange<bool> scope(m_isInUpdate, true); |
| 146 ASSERT(m_searchParams->urlObject() == this); | 155 ASSERT(m_searchParams->urlObject() == this); |
| 147 m_searchParams->setInput(queryString); | 156 m_searchParams->setInput(queryString); |
| 148 } | 157 } |
| 149 | 158 |
| 150 } // namespace blink | 159 } // namespace blink |
| OLD | NEW |