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

Unified Diff: Source/core/html/DOMURL.cpp

Issue 24066010: Implement URLUtils and URL interface (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: git rebase Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/html/DOMURL.cpp
diff --git a/Source/core/html/DOMURL.cpp b/Source/core/html/DOMURL.cpp
index a7b7f7175cbd97dc2faed6c1d0564bcd552ae7b5..3c7e30444d8cd3e20de71d5b5efd02680d836708 100644
--- a/Source/core/html/DOMURL.cpp
+++ b/Source/core/html/DOMURL.cpp
@@ -25,19 +25,44 @@
*/
#include "config.h"
-
#include "core/html/DOMURL.h"
+#include "bindings/v8/ExceptionMessages.h"
+#include "bindings/v8/ExceptionState.h"
+#include "core/dom/ExceptionCode.h"
#include "core/dom/ScriptExecutionContext.h"
#include "core/fetch/MemoryCache.h"
#include "core/fileapi/Blob.h"
#include "core/fileapi/BlobURL.h"
#include "core/html/PublicURLManager.h"
-#include "weborigin/KURL.h"
+#include "weborigin/SecurityOrigin.h"
#include "wtf/MainThread.h"
namespace WebCore {
+DOMURL::DOMURL(const String& url, const KURL& base, ExceptionState& es)
+{
+ ScriptWrappable::init(this);
+ if (!base.isValid())
+ es.throwDOMException(SyntaxError, ExceptionMessages::failedToConstruct("URL", "Invalid base URL"));
+
+ m_url = KURL(base, url);
+ if (!m_url.isValid())
+ es.throwDOMException(SyntaxError, ExceptionMessages::failedToConstruct("URL", "Invalid URL"));
+}
+
+void DOMURL::setInput(const String& value)
+{
+ KURL url(blankURL(), value);
+ if (url.isValid()) {
+ m_url = url;
+ m_input = String();
+ } else {
+ m_url = KURL();
+ m_input = value;
+ }
+}
+
String DOMURL::createObjectURL(ScriptExecutionContext* scriptExecutionContext, Blob* blob)
{
if (!scriptExecutionContext || !blob)

Powered by Google App Engine
This is Rietveld 408576698