| Index: third_party/WebKit/Source/core/dom/DOMURL.cpp
|
| diff --git a/third_party/WebKit/Source/core/dom/DOMURL.cpp b/third_party/WebKit/Source/core/dom/DOMURL.cpp
|
| index e0679ba650f8e1e82540b1aaa50af0a9466605d9..1b1373b96f9ef4f977f6d0c17e8fd3e6b5227c86 100644
|
| --- a/third_party/WebKit/Source/core/dom/DOMURL.cpp
|
| +++ b/third_party/WebKit/Source/core/dom/DOMURL.cpp
|
| @@ -30,24 +30,37 @@
|
| #include "bindings/core/v8/ExceptionState.h"
|
| #include "core/dom/ExceptionCode.h"
|
| #include "core/dom/ExecutionContext.h"
|
| +#include "core/dom/URLSearchParams.h"
|
| #include "core/fetch/MemoryCache.h"
|
| #include "core/fileapi/Blob.h"
|
| #include "core/html/PublicURLManager.h"
|
| #include "platform/blob/BlobURL.h"
|
| #include "platform/weborigin/SecurityOrigin.h"
|
| +#include "wtf/TemporaryChange.h"
|
|
|
| namespace blink {
|
|
|
| DOMURL::DOMURL(const String& url, const KURL& base, ExceptionState& exceptionState)
|
| {
|
| - if (!base.isValid())
|
| + if (!base.isValid()) {
|
| exceptionState.throwTypeError("Invalid base URL");
|
| + return;
|
| + }
|
|
|
| m_url = KURL(base, url);
|
| if (!m_url.isValid())
|
| exceptionState.throwTypeError("Invalid URL");
|
| }
|
|
|
| +DOMURL::~DOMURL()
|
| +{
|
| +}
|
| +
|
| +DEFINE_TRACE(DOMURL)
|
| +{
|
| + visitor->trace(m_searchParams);
|
| +}
|
| +
|
| void DOMURL::setInput(const String& value)
|
| {
|
| KURL url(blankURL(), value);
|
| @@ -58,6 +71,16 @@ void DOMURL::setInput(const String& value)
|
| m_url = KURL();
|
| m_input = value;
|
| }
|
| + update();
|
| +}
|
| +
|
| +void DOMURL::setSearch(const String& value)
|
| +{
|
| + DOMURLUtils::setSearch(value);
|
| + if (!value.isEmpty() && value[0] == '?')
|
| + updateSearchParams(value.substring(1));
|
| + else
|
| + updateSearchParams(value);
|
| }
|
|
|
| String DOMURL::createObjectURL(ExecutionContext* executionContext, Blob* blob, ExceptionState& exceptionState)
|
| @@ -101,4 +124,27 @@ void DOMURL::revokeObjectUUID(ExecutionContext* executionContext, const String&
|
| executionContext->publicURLManager().revoke(uuid);
|
| }
|
|
|
| +URLSearchParams* DOMURL::searchParams()
|
| +{
|
| + if (!m_searchParams)
|
| + m_searchParams = URLSearchParams::create(url().query(), this);
|
| +
|
| + return m_searchParams;
|
| +}
|
| +
|
| +void DOMURL::update()
|
| +{
|
| + updateSearchParams(url().query());
|
| +}
|
| +
|
| +void DOMURL::updateSearchParams(const String& queryString)
|
| +{
|
| + if (!m_searchParams)
|
| + return;
|
| +
|
| + TemporaryChange<bool> scope(m_isInUpdate, true);
|
| + ASSERT(m_searchParams->urlObject() == this);
|
| + m_searchParams->setInput(queryString);
|
| +}
|
| +
|
| } // namespace blink
|
|
|