mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1213815 - Update URLSearchParams and URLUtils in webidl files, r=bz
This commit is contained in:
parent
da940cb9e1
commit
1cb308cc63
@ -216,13 +216,6 @@ Link::SetPathname(const nsAString &aPathname, ErrorResult& aError)
|
||||
|
||||
void
|
||||
Link::SetSearch(const nsAString& aSearch, ErrorResult& aError)
|
||||
{
|
||||
SetSearchInternal(aSearch);
|
||||
UpdateURLSearchParams();
|
||||
}
|
||||
|
||||
void
|
||||
Link::SetSearchInternal(const nsAString& aSearch)
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri(GetURIToMutate());
|
||||
nsCOMPtr<nsIURL> url(do_QueryInterface(uri));
|
||||
@ -482,7 +475,6 @@ Link::ResetLinkState(bool aNotify, bool aHasHref)
|
||||
|
||||
// If we've cached the URI, reset always invalidates it.
|
||||
mCachedURI = nullptr;
|
||||
UpdateURLSearchParams();
|
||||
|
||||
// Update our state back to the default.
|
||||
mLinkState = defaultState;
|
||||
@ -571,67 +563,5 @@ Link::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
||||
return n;
|
||||
}
|
||||
|
||||
URLSearchParams*
|
||||
Link::SearchParams()
|
||||
{
|
||||
CreateSearchParamsIfNeeded();
|
||||
return mSearchParams;
|
||||
}
|
||||
|
||||
void
|
||||
Link::URLSearchParamsUpdated(URLSearchParams* aSearchParams)
|
||||
{
|
||||
MOZ_ASSERT(mSearchParams);
|
||||
MOZ_ASSERT(mSearchParams == aSearchParams);
|
||||
|
||||
nsString search;
|
||||
mSearchParams->Serialize(search);
|
||||
SetSearchInternal(search);
|
||||
}
|
||||
|
||||
void
|
||||
Link::UpdateURLSearchParams()
|
||||
{
|
||||
if (!mSearchParams) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsAutoCString search;
|
||||
nsCOMPtr<nsIURI> uri(GetURI());
|
||||
nsCOMPtr<nsIURL> url(do_QueryInterface(uri));
|
||||
if (url) {
|
||||
nsresult rv = url->GetQuery(search);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Failed to get the query from a nsIURL.");
|
||||
}
|
||||
}
|
||||
|
||||
mSearchParams->ParseInput(search);
|
||||
}
|
||||
|
||||
void
|
||||
Link::CreateSearchParamsIfNeeded()
|
||||
{
|
||||
if (!mSearchParams) {
|
||||
mSearchParams = new URLSearchParams(this, this);
|
||||
UpdateURLSearchParams();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Link::Unlink()
|
||||
{
|
||||
if (mSearchParams) {
|
||||
mSearchParams = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Link::Traverse(nsCycleCollectionTraversalCallback &cb)
|
||||
{
|
||||
Link* tmp = this;
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSearchParams);
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
@ -13,7 +13,6 @@
|
||||
|
||||
#include "mozilla/IHistory.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/dom/URLSearchParams.h"
|
||||
#include "nsIContent.h" // for nsLinkState
|
||||
|
||||
namespace mozilla {
|
||||
@ -28,7 +27,7 @@ class Element;
|
||||
{ 0xb25edee6, 0xdd35, 0x4f8b, \
|
||||
{ 0xab, 0x90, 0x66, 0xd0, 0xbd, 0x3c, 0x22, 0xd5 } }
|
||||
|
||||
class Link : public URLSearchParamsObserver
|
||||
class Link : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(MOZILLA_DOM_LINK_IMPLEMENTATION_IID)
|
||||
@ -74,7 +73,6 @@ public:
|
||||
void GetHostname(nsAString &_hostname, ErrorResult& aError);
|
||||
void GetPathname(nsAString &_pathname, ErrorResult& aError);
|
||||
void GetSearch(nsAString &_search, ErrorResult& aError);
|
||||
URLSearchParams* SearchParams();
|
||||
void GetPort(nsAString &_port, ErrorResult& aError);
|
||||
void GetHash(nsAString &_hash, ErrorResult& aError);
|
||||
|
||||
@ -113,9 +111,6 @@ public:
|
||||
|
||||
bool ElementHasHref() const;
|
||||
|
||||
// URLSearchParamsObserver
|
||||
void URLSearchParamsUpdated(URLSearchParams* aSearchParams) override;
|
||||
|
||||
protected:
|
||||
virtual ~Link();
|
||||
|
||||
@ -134,12 +129,6 @@ protected:
|
||||
nsIURI* GetCachedURI() const { return mCachedURI; }
|
||||
bool HasCachedURI() const { return !!mCachedURI; }
|
||||
|
||||
void UpdateURLSearchParams();
|
||||
|
||||
// CC methods
|
||||
void Unlink();
|
||||
void Traverse(nsCycleCollectionTraversalCallback &cb);
|
||||
|
||||
private:
|
||||
/**
|
||||
* Unregisters from History so this node no longer gets notifications about
|
||||
@ -150,10 +139,6 @@ private:
|
||||
already_AddRefed<nsIURI> GetURIToMutate();
|
||||
void SetHrefAttribute(nsIURI *aURI);
|
||||
|
||||
void CreateSearchParamsIfNeeded();
|
||||
|
||||
void SetSearchInternal(const nsAString& aSearch);
|
||||
|
||||
mutable nsCOMPtr<nsIURI> mCachedURI;
|
||||
|
||||
Element * const mElement;
|
||||
@ -167,9 +152,6 @@ private:
|
||||
bool mNeedsRegistration;
|
||||
|
||||
bool mRegistered;
|
||||
|
||||
protected:
|
||||
RefPtr<URLSearchParams> mSearchParams;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(Link, MOZILLA_DOM_LINK_IMPLEMENTATION_IID)
|
||||
|
@ -19,8 +19,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=887836
|
||||
</div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
<a href="http://www.example.net?a=b&c=d" id="anchor">foobar</a>
|
||||
<area href="http://www.example.net?a=b&c=d" id="area">foobar</area>
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 887836 **/
|
||||
@ -127,20 +125,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=887836
|
||||
runTest();
|
||||
}
|
||||
|
||||
function testElement(e) {
|
||||
ok(e, 'element exists');
|
||||
ok(e.searchParams, "e.searchParams exists!");
|
||||
ok(e.searchParams.has('a'), "e.searchParams.has('a')");
|
||||
is(e.searchParams.get('a'), 'b', "e.searchParams.get('a')");
|
||||
ok(e.searchParams.has('c'), "e.searchParams.has('c')");
|
||||
is(e.searchParams.get('c'), 'd', "e.searchParams.get('c')");
|
||||
|
||||
e.searchParams.set('e', 'f');
|
||||
ok(e.href.indexOf('e=f') != 1, 'e is right');
|
||||
|
||||
runTest();
|
||||
}
|
||||
|
||||
function testEncoding() {
|
||||
var encoding = [ [ '1', '1' ],
|
||||
[ 'a b', 'a+b' ],
|
||||
@ -319,8 +303,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=887836
|
||||
testCopyURLSearchParams,
|
||||
testParserURLSearchParams,
|
||||
testURL,
|
||||
function() { testElement(document.getElementById('anchor')) },
|
||||
function() { testElement(document.getElementById('area')) },
|
||||
testEncoding,
|
||||
testOrdering,
|
||||
testDelete,
|
||||
|
@ -63,13 +63,11 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(HTMLAnchorElement)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(HTMLAnchorElement,
|
||||
nsGenericHTMLElement)
|
||||
tmp->Link::Traverse(cb);
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mRelList)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(HTMLAnchorElement,
|
||||
nsGenericHTMLElement)
|
||||
tmp->Link::Unlink();
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mRelList)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
|
@ -40,13 +40,11 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(HTMLAreaElement)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(HTMLAreaElement,
|
||||
nsGenericHTMLElement)
|
||||
tmp->Link::Traverse(cb);
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mRelList)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(HTMLAreaElement,
|
||||
nsGenericHTMLElement)
|
||||
tmp->Link::Unlink();
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mRelList)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
|
@ -48,7 +48,6 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(HTMLLinkElement)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(HTMLLinkElement,
|
||||
nsGenericHTMLElement)
|
||||
tmp->nsStyleLinkElement::Traverse(cb);
|
||||
tmp->Link::Traverse(cb);
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mRelList)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mImportLoader)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
@ -56,7 +55,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(HTMLLinkElement,
|
||||
nsGenericHTMLElement)
|
||||
tmp->nsStyleLinkElement::Unlink();
|
||||
tmp->Link::Unlink();
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mRelList)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mImportLoader)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
@ -49,12 +49,10 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(SVGAElement)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(SVGAElement,
|
||||
SVGAElementBase)
|
||||
tmp->Link::Traverse(cb);
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(SVGAElement,
|
||||
SVGAElementBase)
|
||||
tmp->Link::Unlink();
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(SVGAElement, SVGAElementBase)
|
||||
|
@ -32,8 +32,8 @@ interface HTMLAnchorElement : HTMLElement {
|
||||
[SetterThrows]
|
||||
attribute DOMString text;
|
||||
};
|
||||
HTMLAnchorElement implements URLUtils;
|
||||
HTMLAnchorElement implements URLUtilsSearchParams;
|
||||
|
||||
HTMLAnchorElement implements HTMLHyperlinkElementUtils;
|
||||
|
||||
// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
|
||||
partial interface HTMLAnchorElement {
|
||||
|
@ -31,16 +31,9 @@ interface HTMLAreaElement : HTMLElement {
|
||||
[SetterThrows, Pref="network.http.enablePerElementReferrer"]
|
||||
attribute DOMString referrer;
|
||||
readonly attribute DOMTokenList relList;
|
||||
|
||||
// not implemented.
|
||||
//
|
||||
// [SetterThrows]
|
||||
// attribute DOMString hreflang;
|
||||
// [SetterThrows]
|
||||
// attribute DOMString type;
|
||||
};
|
||||
HTMLAreaElement implements URLUtils;
|
||||
HTMLAreaElement implements URLUtilsSearchParams;
|
||||
|
||||
HTMLAreaElement implements HTMLHyperlinkElementUtils;
|
||||
|
||||
// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
|
||||
partial interface HTMLAreaElement {
|
||||
|
@ -4,25 +4,26 @@
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* The origin of this IDL file is
|
||||
* http://url.spec.whatwg.org/#urlutils
|
||||
*
|
||||
* To the extent possible under law, the editors have waived all copyright
|
||||
* and related or neighboring rights to this work. In addition, as of 17
|
||||
* February 2013, the editors have made this specification available under
|
||||
* the Open Web Foundation Agreement Version 1.0, which is available at
|
||||
* http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0.
|
||||
* https://html.spec.whatwg.org/multipage/semantics.html#htmlhyperlinkelementutils
|
||||
* © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
|
||||
* Opera Software ASA. You are granted a license to use, reproduce
|
||||
* and create derivative works of this document.
|
||||
*/
|
||||
|
||||
[NoInterfaceObject,
|
||||
Exposed=(Window, Worker)]
|
||||
interface URLUtils {
|
||||
[NoInterfaceObject]
|
||||
interface HTMLHyperlinkElementUtils {
|
||||
// Bug 824857: no support for stringifier attributes yet.
|
||||
// stringifier attribute USVString href;
|
||||
[Throws, CrossOriginWritable=Location]
|
||||
|
||||
// Bug 824857 should remove this.
|
||||
[Throws]
|
||||
stringifier;
|
||||
|
||||
[Throws]
|
||||
attribute USVString href;
|
||||
|
||||
[Throws]
|
||||
readonly attribute USVString origin;
|
||||
|
||||
[Throws]
|
||||
attribute USVString protocol;
|
||||
[Throws]
|
||||
@ -39,17 +40,6 @@ interface URLUtils {
|
||||
attribute USVString pathname;
|
||||
[Throws]
|
||||
attribute USVString search;
|
||||
|
||||
[Throws]
|
||||
attribute USVString hash;
|
||||
|
||||
// Bug 824857 should remove this.
|
||||
[Throws]
|
||||
stringifier;
|
||||
};
|
||||
|
||||
[NoInterfaceObject,
|
||||
Exposed=(Window, Worker)]
|
||||
interface URLUtilsSearchParams {
|
||||
readonly attribute URLSearchParams searchParams;
|
||||
};
|
@ -13,13 +13,41 @@
|
||||
|
||||
[Unforgeable]
|
||||
interface Location {
|
||||
// Bug 824857: no support for stringifier attributes yet.
|
||||
// stringifier attribute USVString href;
|
||||
|
||||
// Bug 824857 should remove this.
|
||||
[Throws]
|
||||
stringifier;
|
||||
|
||||
[Throws, CrossOriginWritable]
|
||||
attribute USVString href;
|
||||
[Throws]
|
||||
readonly attribute USVString origin;
|
||||
[Throws]
|
||||
attribute USVString protocol;
|
||||
[Throws]
|
||||
attribute USVString host;
|
||||
[Throws]
|
||||
attribute USVString hostname;
|
||||
[Throws]
|
||||
attribute USVString port;
|
||||
[Throws]
|
||||
attribute USVString pathname;
|
||||
[Throws]
|
||||
attribute USVString search;
|
||||
[Throws]
|
||||
attribute USVString hash;
|
||||
|
||||
[Throws, UnsafeInPrerendering]
|
||||
void assign(DOMString url);
|
||||
|
||||
[Throws, CrossOriginCallable, UnsafeInPrerendering]
|
||||
void replace(DOMString url);
|
||||
|
||||
// XXXbz there is no forceget argument in the spec! See bug 1037721.
|
||||
[Throws, UnsafeInPrerendering]
|
||||
void reload(optional boolean forceget = false);
|
||||
};
|
||||
|
||||
Location implements URLUtils;
|
||||
// Bug 1085214 [SameObject] readonly attribute USVString[] ancestorOrigins;
|
||||
};
|
||||
|
@ -17,9 +17,44 @@
|
||||
Constructor(DOMString url, optional DOMString base),
|
||||
Exposed=(Window,Worker)]
|
||||
interface URL {
|
||||
[Throws]
|
||||
stringifier;
|
||||
|
||||
[Throws]
|
||||
attribute USVString href;
|
||||
|
||||
[Throws]
|
||||
readonly attribute USVString origin;
|
||||
|
||||
[Throws]
|
||||
attribute USVString protocol;
|
||||
|
||||
[Throws]
|
||||
attribute USVString username;
|
||||
|
||||
[Throws]
|
||||
attribute USVString password;
|
||||
|
||||
[Throws]
|
||||
attribute USVString host;
|
||||
|
||||
[Throws]
|
||||
attribute USVString hostname;
|
||||
|
||||
[Throws]
|
||||
attribute USVString port;
|
||||
|
||||
[Throws]
|
||||
attribute USVString pathname;
|
||||
|
||||
[Throws]
|
||||
attribute USVString search;
|
||||
|
||||
readonly attribute URLSearchParams searchParams;
|
||||
|
||||
[Throws]
|
||||
attribute USVString hash;
|
||||
};
|
||||
URL implements URLUtils;
|
||||
URL implements URLUtilsSearchParams;
|
||||
|
||||
partial interface URL {
|
||||
[Throws]
|
||||
|
@ -1,30 +0,0 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*
|
||||
* The origin of this IDL file is
|
||||
* http://url.spec.whatwg.org/#urlutils
|
||||
*
|
||||
* To the extent possible under law, the editors have waived all copyright
|
||||
* and related or neighboring rights to this work. In addition, as of 21
|
||||
* May 2013, the editors have made this specification available under
|
||||
* the Open Web Foundation Agreement Version 1.0, which is available at
|
||||
* http://www.openwebfoundation.org/legal/the-owf-1-0-agreements/owfa-1-0.
|
||||
*/
|
||||
|
||||
[NoInterfaceObject,
|
||||
Exposed=(Window, Worker)]
|
||||
interface URLUtilsReadOnly {
|
||||
stringifier;
|
||||
readonly attribute USVString href;
|
||||
|
||||
readonly attribute USVString protocol;
|
||||
readonly attribute USVString host;
|
||||
readonly attribute USVString hostname;
|
||||
readonly attribute USVString port;
|
||||
readonly attribute USVString pathname;
|
||||
readonly attribute USVString search;
|
||||
readonly attribute USVString hash;
|
||||
readonly attribute USVString origin;
|
||||
};
|
@ -13,5 +13,21 @@
|
||||
*/
|
||||
|
||||
[Exposed=Worker]
|
||||
interface WorkerLocation { };
|
||||
WorkerLocation implements URLUtilsReadOnly;
|
||||
interface WorkerLocation {
|
||||
// Bug 824857: no support for stringifier attributes yet.
|
||||
// stringifier attribute USVString href;
|
||||
|
||||
// Bug 824857 should remove this.
|
||||
stringifier;
|
||||
|
||||
readonly attribute USVString href;
|
||||
|
||||
readonly attribute USVString origin;
|
||||
readonly attribute USVString protocol;
|
||||
readonly attribute USVString host;
|
||||
readonly attribute USVString hostname;
|
||||
readonly attribute USVString port;
|
||||
readonly attribute USVString pathname;
|
||||
readonly attribute USVString search;
|
||||
readonly attribute USVString hash;
|
||||
};
|
||||
|
@ -203,6 +203,7 @@ WEBIDL_FILES = [
|
||||
'HTMLHeadingElement.webidl',
|
||||
'HTMLHRElement.webidl',
|
||||
'HTMLHtmlElement.webidl',
|
||||
'HTMLHyperlinkElementUtils.webidl',
|
||||
'HTMLIFrameElement.webidl',
|
||||
'HTMLImageElement.webidl',
|
||||
'HTMLInputElement.webidl',
|
||||
@ -574,8 +575,6 @@ WEBIDL_FILES = [
|
||||
'UndoManager.webidl',
|
||||
'URL.webidl',
|
||||
'URLSearchParams.webidl',
|
||||
'URLUtils.webidl',
|
||||
'URLUtilsReadOnly.webidl',
|
||||
'USSDSession.webidl',
|
||||
'ValidityState.webidl',
|
||||
'VideoPlaybackQuality.webidl',
|
||||
|
@ -117,18 +117,6 @@ Link::SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
Link::URLSearchParamsUpdated(URLSearchParams* aSearchParams)
|
||||
{
|
||||
NS_NOTREACHED("Unexpected call to Link::URLSearchParamsUpdated");
|
||||
}
|
||||
|
||||
void
|
||||
Link::UpdateURLSearchParams()
|
||||
{
|
||||
NS_NOTREACHED("Unexpected call to Link::UpdateURLSearchParams");
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(URLSearchParams)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(URLSearchParams)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
Loading…
Reference in New Issue
Block a user