Bug 1328138 - Get rid of document.async
No other browser supports it, it's not in the specs, and the
functionality it enables (synchronous loading of documents) is probably
not desirable.
MozReview-Commit-ID: 8kH56wrie5Y
--- a/dom/webidl/XMLDocument.webidl
+++ b/dom/webidl/XMLDocument.webidl
@@ -11,13 +11,8 @@
// http://dom.spec.whatwg.org/#xmldocument
interface XMLDocument : Document {};
// http://www.whatwg.org/specs/web-apps/current-work/#xmldocument
partial interface XMLDocument {
[Throws, NeedsCallerType]
boolean load(DOMString url);
};
-
-// Gecko extensions?
-partial interface XMLDocument {
- attribute boolean async;
-};
--- a/dom/xml/XMLDocument.cpp
+++ b/dom/xml/XMLDocument.cpp
@@ -227,17 +227,16 @@ NS_NewXBLDocument(nsIDOMDocument** aInst
}
namespace mozilla {
namespace dom {
XMLDocument::XMLDocument(const char* aContentType)
: nsDocument(aContentType),
mChannelIsPending(false),
- mAsync(true),
mLoopingForSyncLoad(false),
mIsPlainDocument(false),
mSuppressParserErrorElement(false),
mSuppressParserErrorConsoleMessages(false)
{
mType = eGenericXML;
}
@@ -456,36 +455,16 @@ XMLDocument::Load(const nsAString& aUrl,
// Start an asynchronous read of the XML document
rv = channel->AsyncOpen2(listener);
if (NS_FAILED(rv)) {
mChannelIsPending = false;
aRv.Throw(rv);
return false;
}
- if (!mAsync) {
- nsAutoSyncOperation sync(this);
- mLoopingForSyncLoad = true;
- SpinEventLoopUntil([&]() { return !mLoopingForSyncLoad; });
-
- // We set return to true unless there was a parsing error
- Element* rootElement = GetRootElement();
- if (!rootElement) {
- return false;
- }
-
- if (rootElement->LocalName().EqualsLiteral("parsererror")) {
- nsAutoString ns;
- rootElement->GetNamespaceURI(ns);
- if (ns.EqualsLiteral("http://www.mozilla.org/newlayout/xml/parsererror.xml")) {
- return false;
- }
- }
- }
-
return true;
}
void
XMLDocument::SetSuppressParserErrorElement(bool aSuppress)
{
mSuppressParserErrorElement = aSuppress;
}
@@ -608,17 +587,16 @@ XMLDocument::Clone(mozilla::dom::NodeInf
NS_ASSERTION(aNodeInfo->NodeInfoManager() == mNodeInfoManager,
"Can't import this document into another document!");
RefPtr<XMLDocument> clone = new XMLDocument();
nsresult rv = CloneDocHelper(clone, aPreallocateChildren);
NS_ENSURE_SUCCESS(rv, rv);
// State from XMLDocument
- clone->mAsync = mAsync;
clone->mIsPlainDocument = mIsPlainDocument;
return CallQueryInterface(clone.get(), aResult);
}
JSObject*
XMLDocument::WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto)
{
--- a/dom/xml/XMLDocument.h
+++ b/dom/xml/XMLDocument.h
@@ -55,24 +55,16 @@ public:
bool aPreallocateChildren) const override;
virtual void DocAddSizeOfExcludingThis(nsWindowSizes* aWindowSizes) const override;
// DocAddSizeOfIncludingThis is inherited from nsIDocument.
// WebIDL API
bool Load(const nsAString& aUrl, CallerType aCallerType, ErrorResult& aRv);
- bool Async() const
- {
- return mAsync;
- }
- void SetAsync(bool aAsync)
- {
- mAsync = aAsync;
- }
// .location is [Unforgeable], so we have to make it clear that the
// nsIDocument version applies to us (it's shadowed by the XPCOM thing on
// nsDocument).
using nsIDocument::GetLocation;
protected:
virtual ~XMLDocument();
@@ -84,17 +76,16 @@ protected:
// mChannelIsPending indicates whether we're currently asynchronously loading
// data from mChannel (via document.load() or normal load). It's set to true
// when we first find out about the channel (StartDocumentLoad) and set to
// false in EndLoad or if ResetToURI() is called. In the latter case our
// mChannel is also cancelled. Note that if this member is true, mChannel
// cannot be null.
bool mChannelIsPending;
- bool mAsync;
bool mLoopingForSyncLoad;
// If true. we're really a Document, not an XMLDocument
bool mIsPlainDocument;
// If true, do not output <parsererror> elements. Per spec, XMLHttpRequest
// shouldn't output them, whereas DOMParser/others should (see bug 918703).
bool mSuppressParserErrorElement;
--- a/testing/web-platform/meta/dom/historical.html.ini
+++ b/testing/web-platform/meta/dom/historical.html.ini
@@ -11,11 +11,8 @@
[Historical DOM features must be removed: createCDATASection]
expected: FAIL
bug: 660660
[Node member must be nuked: rootNode]
disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1303802
bug: 1269155
- [Historical DOM features must be removed: async]
- expected: FAIL
-