WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Fixed idl and removed static initializers
bug-71968-20111206134525.patch (text/plain), 19.30 KB, created by
Erik Arvidsson
on 2011-12-06 13:45:26 PST
(
hide
)
Description:
Fixed idl and removed static initializers
Filename:
MIME Type:
Creator:
Erik Arvidsson
Created:
2011-12-06 13:45:26 PST
Size:
19.30 KB
patch
obsolete
>Subversion Revision: 102153 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 55134a76069b61f9a0899e986c46fd1ffc9dfa76..0d1c8a7c97b0d154d8ca02540f5f1d2ea3e5a274 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,59 @@ >+2011-12-06 Kaustubh Atrawalkar <kaustubh@motorola.com> >+ >+ Implement URL API >+ https://bugs.webkit.org/show_bug.cgi?id=71968 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Initial implementation of DOMURL IDL attributes. >+ >+ Tests: fast/dom/DOMURL/check-instanceof-domurl-functions.html >+ fast/dom/DOMURL/domurl-attribute-hash.html >+ fast/dom/DOMURL/domurl-attribute-host.html >+ fast/dom/DOMURL/domurl-attribute-hostname.html >+ fast/dom/DOMURL/domurl-attribute-pathname.html >+ fast/dom/DOMURL/domurl-attribute-port.html >+ fast/dom/DOMURL/domurl-attribute-protocol.html >+ fast/dom/DOMURL/domurl-attribute-search.html >+ fast/dom/DOMURL/stringifier-domurl-attribute-href.html >+ >+ * html/DOMURL.cpp: >+ (WebCore::DOMURL::DOMURL): >+ (WebCore::DOMURL::contextDestroyed): >+ (WebCore::DOMURL::createObjectURL): >+ (WebCore::DOMURL::revokeObjectURL): >+ (WebCore::DOMURL::host): >+ (WebCore::DOMURL::setHost): >+ (WebCore::DOMURL::setHostname): >+ (WebCore::DOMURL::port): >+ (WebCore::DOMURL::setPort): >+ (WebCore::DOMURL::setPathname): >+ (WebCore::DOMURL::search): >+ (WebCore::DOMURL::setSearch): >+ (WebCore::DOMURL::hash): >+ (WebCore::DOMURL::setHash): >+ (WebCore::DOMURL::setFilename): >+ (WebCore::DOMURL::origin): >+ (WebCore::DOMURL::getParameter): >+ (WebCore::DOMURL::appendParameter): >+ (WebCore::DOMURL::clearParameter): >+ * html/DOMURL.h: >+ (WebCore::DOMURL::create): >+ (WebCore::DOMURL::protocol): >+ (WebCore::DOMURL::setProtocol): >+ (WebCore::DOMURL::username): >+ (WebCore::DOMURL::setUsername): >+ (WebCore::DOMURL::password): >+ (WebCore::DOMURL::setPassword): >+ (WebCore::DOMURL::hostname): >+ (WebCore::DOMURL::pathname): >+ (WebCore::DOMURL::filename): >+ (WebCore::DOMURL::href): >+ (WebCore::DOMURL::setHref): >+ (WebCore::DOMURL::toString): >+ * html/DOMURL.idl: >+ * page/DOMWindow.idl: >+ > 2011-12-06 Andreas Kling <kling@webkit.org> > > MediaList: Remove constructor that takes a CSSImportRule*. >diff --git a/Source/WebCore/html/DOMURL.cpp b/Source/WebCore/html/DOMURL.cpp >index e42060d484298b7f4918b89c7a9eb48de4b37a03..109a1f00b34920f9c01408992e9266f73ef21a42 100644 >--- a/Source/WebCore/html/DOMURL.cpp >+++ b/Source/WebCore/html/DOMURL.cpp >@@ -1,5 +1,6 @@ > /* > * Copyright (C) 2011 Google Inc. All rights reserved. >+ * Copyright (C) 2011 Motorola Mobility Inc. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -24,45 +25,75 @@ > */ > > #include "config.h" >- >-#if ENABLE(BLOB) >- > #include "DOMURL.h" > >-#include "Blob.h" >-#include "BlobURL.h" > #include "KURL.h" >+#include "NotImplemented.h" > #include "ScriptExecutionContext.h" >-#include "ThreadableBlobRegistry.h" >+#include "SecurityOrigin.h" > #include <wtf/MainThread.h> > >+#if ENABLE(BLOB) >+#include "Blob.h" >+#include "BlobURL.h" >+#include "ThreadableBlobRegistry.h" > #if ENABLE(MEDIA_STREAM) > #include "MediaStream.h" > #include "MediaStreamRegistry.h" > #endif >+#endif >+ >+#if ENABLE(BLOB) >+#if ENABLE(MEDIA_STREAM) >+ >+static HashSet<String>& publicStreamURLs() >+{ >+ DEFINE_STATIC_LOCAL(HashSet<String>, staticPublicStreamURLs, ()); >+ return staticPublicStreamURLs; >+} >+ >+#endif >+ >+static HashSet<String>& publicBlobURLs() >+{ >+ DEFINE_STATIC_LOCAL(HashSet<String>, staticPublicBlobURLs, ()); >+ return staticPublicBlobURLs; >+} >+ >+#endif > > namespace WebCore { > >-DOMURL::DOMURL(ScriptExecutionContext* scriptExecutionContext) >- : ContextDestructionObserver(scriptExecutionContext) >+DOMURL::DOMURL(const String& url, const String& baseURL) >+ : ContextDestructionObserver(0) > { >+ m_href = KURL(KURL(), url); >+ // Resolve the URL relative to baseURL if is provide. >+ if (!baseURL.isEmpty()) >+ m_href = KURL(m_href, baseURL); > } > > DOMURL::~DOMURL() > { > } > >+#if ENABLE(BLOB) >+DOMURL::DOMURL(ScriptExecutionContext* scriptExecutionContext) >+ : ContextDestructionObserver(scriptExecutionContext) >+{ >+} >+ > void DOMURL::contextDestroyed() > { > ContextDestructionObserver::contextDestroyed(); > >- HashSet<String>::iterator publicBlobURLsEnd = m_publicBlobURLs.end(); >- for (HashSet<String>::iterator iter = m_publicBlobURLs.begin(); iter != publicBlobURLsEnd; ++iter) >+ HashSet<String>::iterator publicBlobURLsEnd = publicBlobURLs().end(); >+ for (HashSet<String>::iterator iter = publicBlobURLs().begin(); iter != publicBlobURLsEnd; ++iter) > ThreadableBlobRegistry::unregisterBlobURL(KURL(ParsedURLString, *iter)); > > #if ENABLE(MEDIA_STREAM) >- HashSet<String>::iterator publicStreamURLsEnd = m_publicStreamURLs.end(); >- for (HashSet<String>::iterator iter = m_publicStreamURLs.begin(); iter != publicStreamURLsEnd; ++iter) >+ HashSet<String>::iterator publicStreamURLsEnd = publicStreamURLs().end(); >+ for (HashSet<String>::iterator iter = publicStreamURLs().begin(); iter != publicStreamURLsEnd; ++iter) > MediaStreamRegistry::registry().unregisterMediaStreamURL(KURL(ParsedURLString, *iter)); > #endif > } >@@ -70,10 +101,10 @@ void DOMURL::contextDestroyed() > #if ENABLE(MEDIA_STREAM) > String DOMURL::createObjectURL(MediaStream* stream) > { >- if (!m_scriptExecutionContext || !stream) >+ if (!stream) > return String(); > >- KURL publicURL = BlobURL::createPublicURL(scriptExecutionContext()->securityOrigin()); >+ KURL publicURL = BlobURL::createPublicURL(SecurityOrigin::createUnique().get()); > if (publicURL.isEmpty()) > return String(); > >@@ -81,7 +112,7 @@ String DOMURL::createObjectURL(MediaStream* stream) > ASSERT(isMainThread()); > > MediaStreamRegistry::registry().registerMediaStreamURL(publicURL, stream); >- m_publicStreamURLs.add(publicURL.string()); >+ publicStreamURLs().add(publicURL.string()); > > return publicURL.string(); > } >@@ -89,42 +120,185 @@ String DOMURL::createObjectURL(MediaStream* stream) > > String DOMURL::createObjectURL(Blob* blob) > { >- if (!m_scriptExecutionContext || !blob) >+ if (!blob) > return String(); > >- KURL publicURL = BlobURL::createPublicURL(scriptExecutionContext()->securityOrigin()); >+ KURL publicURL = BlobURL::createPublicURL(SecurityOrigin::createUnique().get()); > if (publicURL.isEmpty()) > return String(); > > ThreadableBlobRegistry::registerBlobURL(publicURL, blob->url()); >- m_publicBlobURLs.add(publicURL.string()); >+ publicBlobURLs().add(publicURL.string()); > > return publicURL.string(); > } > > void DOMURL::revokeObjectURL(const String& urlString) > { >- if (!m_scriptExecutionContext) >- return; >- > KURL url(KURL(), urlString); > >- if (m_publicBlobURLs.contains(url.string())) { >+ if (publicBlobURLs().contains(url.string())) { > ThreadableBlobRegistry::unregisterBlobURL(url); >- m_publicBlobURLs.remove(url.string()); >+ publicBlobURLs().remove(url.string()); > } >- > #if ENABLE(MEDIA_STREAM) >- if (m_publicStreamURLs.contains(url.string())) { >+ if (publicStreamURLs().contains(url.string())) { > // FIXME: make sure of this assertion below. Raise a spec question if required. > // Since WebWorkers cannot obtain Stream objects, we should be on the main thread. > ASSERT(isMainThread()); > MediaStreamRegistry::registry().unregisterMediaStreamURL(url); >- m_publicStreamURLs.remove(url.string()); >+ publicStreamURLs().remove(url.string()); > } > #endif > } >+#endif >+ >+String DOMURL::host() const >+{ >+ if (m_href.hostEnd() == m_href.pathStart()) >+ return m_href.host(); >+ if (isDefaultPortForProtocol(m_href.port(), m_href.protocol())) >+ return m_href.host(); >+ return m_href.host() + ":" + String::number(m_href.port()); >+} >+ >+void DOMURL::setHost(const String& value) >+{ >+ if (value.isEmpty()) >+ return; >+ >+ if (!m_href.canSetHostOrPort()) >+ return; >+ >+ size_t colon = value.find(':'); >+ if (!colon) >+ return; >+ >+ if (colon == notFound) >+ m_href.setHostAndPort(value); >+ else { >+ unsigned portStart = colon + 1; >+ unsigned portEnd = portStart; >+ >+ while (isASCIIDigit(value[portEnd])) >+ ++portEnd; >+ >+ unsigned port = value.substring(portStart, portEnd - portStart).toUInt(); >+ if (!port) >+ m_href.setHostAndPort(value.substring(0, colon + 1) + "0"); >+ else { >+ if (isDefaultPortForProtocol(port, m_href.protocol())) >+ m_href.setHostAndPort(value.substring(0, colon)); >+ else >+ m_href.setHostAndPort(value.substring(0, portEnd)); >+ } >+ } >+} >+ >+void DOMURL::setHostname(const String& value) >+{ >+ unsigned i = 0; >+ unsigned hostLength = value.length(); >+ while (value[i] == '/') >+ i++; >+ >+ if (i == hostLength) >+ return; >+ >+ if (!m_href.canSetHostOrPort()) >+ return; >+ >+ m_href.setHost(value.substring(i)); >+} >+ >+String DOMURL::port() const >+{ >+ if (href().hasPort()) >+ return String::number(href().port()); >+ >+ return emptyString(); >+} >+ >+void DOMURL::setPort(const String& value) >+{ >+ if (!m_href.canSetHostOrPort()) >+ return; >+ >+ unsigned port = value.toUInt(); >+ if (isDefaultPortForProtocol(port, m_href.protocol())) >+ m_href.removePort(); >+ else >+ m_href.setPort(value.toUInt()); >+} >+ >+void DOMURL::setPathname(const String& value) >+{ >+ if (!m_href.canSetPathname()) >+ return; >+ >+ String newPathname = (value[0] == '/') ? value : ("/" + value); >+ m_href.setPath(newPathname); >+} >+ >+String DOMURL::search() const >+{ >+ String query = href().query(); >+ return query.isEmpty() ? emptyString() : "?" + query; >+} >+ >+void DOMURL::setSearch(const String& value) >+{ >+ String newSearch = (value[0] == '?') ? value.substring(1) : value; >+ m_href.setQuery(newSearch); >+} >+ >+String DOMURL::hash() const >+{ >+ String fragment = href().fragmentIdentifier(); >+ return fragment.isEmpty() ? emptyString() : "#" + fragment; >+} >+ >+void DOMURL::setHash(const String& value) >+{ >+ String newHash = (value[0] == '#') ? value.substring(1) : value; >+ m_href.setFragmentIdentifier(newHash); >+} >+ >+void DOMURL::setFilename(const String&) >+{ >+ // FIXME: Implement me. >+ notImplemented(); >+} >+ >+String DOMURL::origin() const >+{ >+ RefPtr<SecurityOrigin> origin = SecurityOrigin::create(href()); >+ return origin->toString(); >+} >+ >+String DOMURL::getParameter(const String&) >+{ >+ // FIXME: Implement me. >+ notImplemented(); >+ return String(); >+} >+ >+void DOMURL::appendParameter(const String&, const PassRefPtr<DOMStringList>) >+{ >+ // FIXME: Implement me. >+ notImplemented(); >+} >+ >+void DOMURL::appendParameter(const String&, const String&) >+{ >+ // FIXME: Implement me. >+ notImplemented(); >+} >+void DOMURL::clearParameter(const String&) >+{ >+ // FIXME: Implement me. >+ notImplemented(); >+} > > } // namespace WebCore > >-#endif // ENABLE(BLOB) >diff --git a/Source/WebCore/html/DOMURL.h b/Source/WebCore/html/DOMURL.h >index d02fe887cc8ce953c48901533778ac08e4e71290..1f33880da04c1734a546d08829acaa1029e5bb52 100644 >--- a/Source/WebCore/html/DOMURL.h >+++ b/Source/WebCore/html/DOMURL.h >@@ -1,5 +1,6 @@ > /* > * Copyright (C) 2011 Google Inc. All rights reserved. >+ * Copyright (C) 2011 Motorola Mobility Inc. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -26,9 +27,9 @@ > #ifndef DOMURL_h > #define DOMURL_h > >-#if ENABLE(BLOB) >- > #include "ActiveDOMObject.h" >+#include "DOMStringList.h" >+#include "KURL.h" > #include "PlatformString.h" > #include <wtf/HashSet.h> > #include <wtf/PassRefPtr.h> >@@ -42,28 +43,72 @@ class ScriptExecutionContext; > > class DOMURL : public RefCounted<DOMURL>, public ContextDestructionObserver { > public: >- static PassRefPtr<DOMURL> create(ScriptExecutionContext* scriptExecutionContext) { return adoptRef(new DOMURL(scriptExecutionContext)); } >+ static PassRefPtr<DOMURL> create(const String& url, const String& baseURL) { return adoptRef(new DOMURL(url, baseURL)); } >+ static PassRefPtr<DOMURL> create(const String& url) { return adoptRef(new DOMURL(url, emptyString())); } > ~DOMURL(); > >+ String protocol() const { return href().protocol() + ":"; } >+ void setProtocol(const String& value) { m_href.setProtocol(value); } >+ >+ String username() const { return href().user(); } >+ void setUsername(const String& value) { m_href.setUser(value); } >+ >+ String password() const { return href().pass(); } >+ void setPassword(const String& value) { m_href.setPass(value); } >+ >+ String host() const; >+ void setHost(const String&); >+ >+ String hostname() const { return href().host(); } >+ void setHostname(const String&); >+ >+ String port() const; >+ void setPort(const String&); >+ >+ String pathname() const { return href().path(); } >+ void setPathname(const String&); >+ >+ String search() const; >+ void setSearch(const String&); >+ >+ String hash() const; >+ void setHash(const String&); >+ >+ String filename() const { return href().lastPathComponent(); } >+ void setFilename(const String&); >+ >+ String origin() const; >+ >+ KURL href() const { return m_href; } >+ void setHref(const String& value) { m_href = KURL(KURL(), value); } >+ >+ String toString() const { return m_href.string(); } >+ >+ String getParameter(const String&); >+ void appendParameter(const String&, const String&); >+ void appendParameter(const String&, const PassRefPtr<DOMStringList>); >+ void clearParameter(const String&); >+ >+#if ENABLE(BLOB) >+ static PassRefPtr<DOMURL> create(ScriptExecutionContext* scriptExecutionContext) { return adoptRef(new DOMURL(scriptExecutionContext)); } >+ static String createObjectURL(Blob*); >+ static void revokeObjectURL(const String&); > #if ENABLE(MEDIA_STREAM) >- String createObjectURL(MediaStream*); >+ static String createObjectURL(MediaStream*); >+#endif > #endif >- String createObjectURL(Blob*); >- void revokeObjectURL(const String&); > > private: >- explicit DOMURL(ScriptExecutionContext*); >+ KURL m_href; > >- virtual void contextDestroyed(); >+ DOMURL(const String&, const String&); > >- HashSet<String> m_publicBlobURLs; >-#if ENABLE(MEDIA_STREAM) >- HashSet<String> m_publicStreamURLs; >+#if ENABLE(BLOB) >+ explicit DOMURL(ScriptExecutionContext*); >+ virtual void contextDestroyed(); > #endif > }; > > } // namespace WebCore > >-#endif // ENABLE(BLOB) >- > #endif // DOMURL_h >diff --git a/Source/WebCore/html/DOMURL.idl b/Source/WebCore/html/DOMURL.idl >index d6d55790f7a0cc7bfd7430054af28311bb1b36db..6587f90f54e04336ccbd368bd2757cd99eb86fd6 100644 >--- a/Source/WebCore/html/DOMURL.idl >+++ b/Source/WebCore/html/DOMURL.idl >@@ -1,5 +1,6 @@ > /* > * Copyright (C) 2011 Google Inc. All rights reserved. >+ * Copyright (C) 2011 Motorola Mobility Inc. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -25,16 +26,35 @@ > > module html { > interface [ >- Conditional=BLOB, >- OmitConstructor, > GenerateNativeConverter, > GenerateToJS, >- NoStaticTables >+ Replaceable, >+ Constructor(in DOMString url, in [Optional=CallWithNullValue] DOMString baseURL) > ] DOMURL { >+ attribute DOMString protocol; >+ attribute DOMString username; >+ attribute DOMString password; >+ attribute DOMString host; >+ attribute DOMString hostname; >+ attribute DOMString port; >+ attribute DOMString pathname; >+ attribute DOMString search; >+ attribute DOMString hash; >+ >+ attribute DOMString filename; >+ readonly attribute DOMString origin; >+ stringifier attribute DOMString href; >+ >+ [DontEnum] DOMString toString(); >+ DOMString getParameter(in DOMString name); >+ void appendParameter(in DOMString name, in DOMString values); >+ void appendParameter(in DOMString name, in DOMString[] values); >+ void clearParameter(in DOMString name); >+ > #if defined(ENABLE_MEDIA_STREAM) && ENABLE_MEDIA_STREAM >- [ConvertNullStringTo=Undefined] DOMString createObjectURL(in MediaStream stream); >+ static [Conditional=BLOB,ConvertNullStringTo=Undefined] DOMString createObjectURL(in MediaStream stream); > #endif >- [ConvertNullStringTo=Undefined] DOMString createObjectURL(in Blob blob); >- void revokeObjectURL(in DOMString url); >+ static [Conditional=BLOB,ConvertNullStringTo=Undefined] DOMString createObjectURL(in Blob blob); >+ static [Conditional=BLOB] void revokeObjectURL(in DOMString url); > }; > } >diff --git a/Source/WebCore/page/DOMWindow.idl b/Source/WebCore/page/DOMWindow.idl >index 209bf43738b8ef27d64ec9c376454f5e8a733139..9c6f87c878078e79a8e553448ecbe25a998a8091 100644 >--- a/Source/WebCore/page/DOMWindow.idl >+++ b/Source/WebCore/page/DOMWindow.idl >@@ -813,7 +813,7 @@ module window { > > attribute [Conditional=BLOB] WebKitBlobBuilderConstructor WebKitBlobBuilder; > >- readonly attribute [Conditional=BLOB] DOMURL webkitURL; >+ attribute DOMURLConstructor webkitURL; > > #if defined(ENABLE_QUOTA) && ENABLE_QUOTA > readonly attribute [EnabledAtRuntime=Quota] StorageInfo webkitStorageInfo; >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index d5c21d89c47b962ddbe53fc8c831e76056af2df3..02d281a9ce45ee93ff9a8e9df377e49cff9fea74 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,32 @@ >+2011-12-06 Kaustubh Atrawalkar <kaustubh@motorola.com> >+ >+ Implement URL API. >+ https://bugs.webkit.org/show_bug.cgi?id=71968 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Initial implementation of IDL Attributes. Added test cases. >+ >+ * fast/dom/DOMURL: Added. >+ * fast/dom/DOMURL/check-instanceof-domurl-functions-expected.txt: Added. >+ * fast/dom/DOMURL/check-instanceof-domurl-functions.html: Added. >+ * fast/dom/DOMURL/domurl-attribute-hash-expected.txt: Added. >+ * fast/dom/DOMURL/domurl-attribute-hash.html: Added. >+ * fast/dom/DOMURL/domurl-attribute-host-expected.txt: Added. >+ * fast/dom/DOMURL/domurl-attribute-host.html: Added. >+ * fast/dom/DOMURL/domurl-attribute-hostname-expected.txt: Added. >+ * fast/dom/DOMURL/domurl-attribute-hostname.html: Added. >+ * fast/dom/DOMURL/domurl-attribute-pathname-expected.txt: Added. >+ * fast/dom/DOMURL/domurl-attribute-pathname.html: Added. >+ * fast/dom/DOMURL/domurl-attribute-port-expected.txt: Added. >+ * fast/dom/DOMURL/domurl-attribute-port.html: Added. >+ * fast/dom/DOMURL/domurl-attribute-protocol-expected.txt: Added. >+ * fast/dom/DOMURL/domurl-attribute-protocol.html: Added. >+ * fast/dom/DOMURL/domurl-attribute-search-expected.txt: Added. >+ * fast/dom/DOMURL/domurl-attribute-search.html: Added. >+ * fast/dom/DOMURL/stringifier-domurl-attribute-href-expected.txt: Added. >+ * fast/dom/DOMURL/stringifier-domurl-attribute-href.html: Added. >+ > 2011-12-06 Vsevolod Vlasov <vsevik@chromium.org> > > Unreviewed chromium expectations update.
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 71968
:
114916
|
115121
|
115138
|
115532
|
115780
|
116327
|
116565
|
118024
|
118104
|
118145
|
118290
|
118365
|
118687