forked from mirrors/gecko-dev
Bug 1612140 - Update DOMParser's resulting document to not be affected by <base> r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D210610
This commit is contained in:
parent
ddda244298
commit
0e658dd47c
4 changed files with 7 additions and 284 deletions
|
|
@ -30,11 +30,10 @@ using namespace mozilla;
|
|||
using namespace mozilla::dom;
|
||||
|
||||
DOMParser::DOMParser(nsIGlobalObject* aOwner, nsIPrincipal* aDocPrincipal,
|
||||
nsIURI* aDocumentURI, nsIURI* aBaseURI)
|
||||
nsIURI* aDocumentURI)
|
||||
: mOwner(aOwner),
|
||||
mPrincipal(aDocPrincipal),
|
||||
mDocumentURI(aDocumentURI),
|
||||
mBaseURI(aBaseURI),
|
||||
mForceEnableXULXBL(false),
|
||||
mForceEnableDTD(false) {
|
||||
MOZ_ASSERT(aDocPrincipal);
|
||||
|
|
@ -249,21 +248,18 @@ already_AddRefed<DOMParser> DOMParser::Constructor(const GlobalObject& aOwner,
|
|||
MOZ_ASSERT(NS_IsMainThread());
|
||||
nsCOMPtr<nsIPrincipal> docPrincipal = aOwner.GetSubjectPrincipal();
|
||||
nsCOMPtr<nsIURI> documentURI;
|
||||
nsIURI* baseURI = nullptr;
|
||||
if (docPrincipal->IsSystemPrincipal()) {
|
||||
docPrincipal = NullPrincipal::Create(OriginAttributes());
|
||||
documentURI = docPrincipal->GetURI();
|
||||
} else {
|
||||
// Grab document and base URIs off the window our constructor was
|
||||
// called on. Error out if anything untoward happens.
|
||||
// Grab document URI off the window our constructor was called on.
|
||||
// Error out if anything untoward happens.
|
||||
nsCOMPtr<nsPIDOMWindowInner> window =
|
||||
do_QueryInterface(aOwner.GetAsSupports());
|
||||
if (!window) {
|
||||
rv.Throw(NS_ERROR_UNEXPECTED);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
baseURI = window->GetDocBaseURI();
|
||||
documentURI = window->GetDocumentURI();
|
||||
}
|
||||
|
||||
|
|
@ -275,7 +271,7 @@ already_AddRefed<DOMParser> DOMParser::Constructor(const GlobalObject& aOwner,
|
|||
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(aOwner.GetAsSupports());
|
||||
MOZ_ASSERT(global);
|
||||
RefPtr<DOMParser> domParser =
|
||||
new DOMParser(global, docPrincipal, documentURI, baseURI);
|
||||
new DOMParser(global, docPrincipal, documentURI);
|
||||
return domParser.forget();
|
||||
}
|
||||
|
||||
|
|
@ -291,7 +287,7 @@ already_AddRefed<DOMParser> DOMParser::CreateWithoutGlobal(ErrorResult& aRv) {
|
|||
}
|
||||
|
||||
RefPtr<DOMParser> domParser =
|
||||
new DOMParser(nullptr, docPrincipal, documentURI, nullptr);
|
||||
new DOMParser(nullptr, docPrincipal, documentURI);
|
||||
return domParser.forget();
|
||||
}
|
||||
|
||||
|
|
@ -311,7 +307,7 @@ already_AddRefed<Document> DOMParser::SetUpDocument(DocumentFlavor aFlavor,
|
|||
|
||||
nsCOMPtr<Document> doc;
|
||||
nsresult rv = NS_NewDOMDocument(getter_AddRefs(doc), u""_ns, u""_ns, nullptr,
|
||||
mDocumentURI, mBaseURI, mPrincipal, true,
|
||||
mDocumentURI, mDocumentURI, mPrincipal, true,
|
||||
scriptHandlingObject, aFlavor);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
aRv.Throw(rv);
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ class DOMParser final : public nsISupports, public nsWrapperCache {
|
|||
|
||||
private:
|
||||
DOMParser(nsIGlobalObject* aOwner, nsIPrincipal* aDocPrincipal,
|
||||
nsIURI* aDocumentURI, nsIURI* aBaseURI);
|
||||
nsIURI* aDocumentURI);
|
||||
|
||||
already_AddRefed<Document> SetUpDocument(DocumentFlavor aFlavor,
|
||||
ErrorResult& aRv);
|
||||
|
|
@ -85,7 +85,6 @@ class DOMParser final : public nsISupports, public nsWrapperCache {
|
|||
nsCOMPtr<nsIGlobalObject> mOwner;
|
||||
nsCOMPtr<nsIPrincipal> mPrincipal;
|
||||
nsCOMPtr<nsIURI> mDocumentURI;
|
||||
nsCOMPtr<nsIURI> mBaseURI;
|
||||
|
||||
bool mForceEnableXULXBL;
|
||||
bool mForceEnableDTD;
|
||||
|
|
|
|||
|
|
@ -1,136 +0,0 @@
|
|||
[DOMParser-parseFromString-url-base-pushstate.html]
|
||||
[image/svg+xml invalid XML: created using another iframe's DOMParser from this frame]
|
||||
expected: FAIL
|
||||
|
||||
[application/xml valid: created normally]
|
||||
expected: FAIL
|
||||
|
||||
[text/xml valid: created normally]
|
||||
expected: FAIL
|
||||
|
||||
[application/xhtml+xml valid: created using a parser from the iframe and the method from this frame]
|
||||
expected: FAIL
|
||||
|
||||
[application/xml valid: created using a parser from this frame and the method from the iframe]
|
||||
expected: FAIL
|
||||
|
||||
[application/xhtml+xml invalid XML: created using a parser from the iframe and the method from this frame]
|
||||
expected: FAIL
|
||||
|
||||
[application/xhtml+xml valid: created using a parser from this frame and the method from the iframe]
|
||||
expected: FAIL
|
||||
|
||||
[application/xml valid: created using another iframe's DOMParser from that frame]
|
||||
expected: FAIL
|
||||
|
||||
[image/svg+xml valid: created using another iframe's DOMParser from this frame]
|
||||
expected: FAIL
|
||||
|
||||
[image/svg+xml invalid XML: created using another iframe's DOMParser from that frame]
|
||||
expected: FAIL
|
||||
|
||||
[text/xml invalid XML: created using a parser from this frame and the method from the iframe]
|
||||
expected: FAIL
|
||||
|
||||
[text/xml valid: created using another iframe's DOMParser from this frame]
|
||||
expected: FAIL
|
||||
|
||||
[image/svg+xml invalid XML: created normally]
|
||||
expected: FAIL
|
||||
|
||||
[text/xml valid: created using a parser from this frame and the method from the iframe]
|
||||
expected: FAIL
|
||||
|
||||
[text/xml valid: created using a parser from the iframe and the method from this frame]
|
||||
expected: FAIL
|
||||
|
||||
[application/xhtml+xml invalid XML: created normally]
|
||||
expected: FAIL
|
||||
|
||||
[application/xhtml+xml valid: created normally]
|
||||
expected: FAIL
|
||||
|
||||
[text/html valid: created using another iframe's DOMParser from this frame]
|
||||
expected: FAIL
|
||||
|
||||
[text/xml invalid XML: created normally]
|
||||
expected: FAIL
|
||||
|
||||
[text/html valid: created normally]
|
||||
expected: FAIL
|
||||
|
||||
[text/xml valid: created using another iframe's DOMParser from that frame]
|
||||
expected: FAIL
|
||||
|
||||
[application/xml invalid XML: created using a parser from this frame and the method from the iframe]
|
||||
expected: FAIL
|
||||
|
||||
[application/xhtml+xml invalid XML: created using another iframe's DOMParser from this frame]
|
||||
expected: FAIL
|
||||
|
||||
[application/xml valid: created using another iframe's DOMParser from this frame]
|
||||
expected: FAIL
|
||||
|
||||
[application/xml invalid XML: created using another iframe's DOMParser from that frame]
|
||||
expected: FAIL
|
||||
|
||||
[application/xhtml+xml valid: created using another iframe's DOMParser from that frame]
|
||||
expected: FAIL
|
||||
|
||||
[image/svg+xml valid: created using a parser from the iframe and the method from this frame]
|
||||
expected: FAIL
|
||||
|
||||
[text/html valid: created using a parser from this frame and the method from the iframe]
|
||||
expected: FAIL
|
||||
|
||||
[image/svg+xml invalid XML: created using a parser from the iframe and the method from this frame]
|
||||
expected: FAIL
|
||||
|
||||
[text/xml invalid XML: created using another iframe's DOMParser from this frame]
|
||||
expected: FAIL
|
||||
|
||||
[text/html valid: created using another iframe's DOMParser from that frame]
|
||||
expected: FAIL
|
||||
|
||||
[application/xhtml+xml invalid XML: created using a parser from this frame and the method from the iframe]
|
||||
expected: FAIL
|
||||
|
||||
[application/xml invalid XML: created normally]
|
||||
expected: FAIL
|
||||
|
||||
[application/xhtml+xml invalid XML: created using another iframe's DOMParser from that frame]
|
||||
expected: FAIL
|
||||
|
||||
[image/svg+xml valid: created normally]
|
||||
expected: FAIL
|
||||
|
||||
[image/svg+xml valid: created using a parser from this frame and the method from the iframe]
|
||||
expected: FAIL
|
||||
|
||||
[application/xml invalid XML: created using another iframe's DOMParser from this frame]
|
||||
expected: FAIL
|
||||
|
||||
[application/xml invalid XML: created using a parser from the iframe and the method from this frame]
|
||||
expected: FAIL
|
||||
|
||||
[image/svg+xml invalid XML: created using a parser from this frame and the method from the iframe]
|
||||
expected: FAIL
|
||||
|
||||
[application/xml valid: created using a parser from the iframe and the method from this frame]
|
||||
expected: FAIL
|
||||
|
||||
[application/xhtml+xml valid: created using another iframe's DOMParser from this frame]
|
||||
expected: FAIL
|
||||
|
||||
[text/html valid: created using a parser from the iframe and the method from this frame]
|
||||
expected: FAIL
|
||||
|
||||
[image/svg+xml valid: created using another iframe's DOMParser from that frame]
|
||||
expected: FAIL
|
||||
|
||||
[text/xml invalid XML: created using another iframe's DOMParser from that frame]
|
||||
expected: FAIL
|
||||
|
||||
[text/xml invalid XML: created using a parser from the iframe and the method from this frame]
|
||||
expected: FAIL
|
||||
|
||||
|
|
@ -1,136 +0,0 @@
|
|||
[DOMParser-parseFromString-url-base.html]
|
||||
[image/svg+xml invalid XML: created using another iframe's DOMParser from this frame]
|
||||
expected: FAIL
|
||||
|
||||
[application/xml valid: created normally]
|
||||
expected: FAIL
|
||||
|
||||
[text/xml valid: created normally]
|
||||
expected: FAIL
|
||||
|
||||
[application/xhtml+xml valid: created using a parser from the iframe and the method from this frame]
|
||||
expected: FAIL
|
||||
|
||||
[application/xml valid: created using a parser from this frame and the method from the iframe]
|
||||
expected: FAIL
|
||||
|
||||
[application/xhtml+xml invalid XML: created using a parser from the iframe and the method from this frame]
|
||||
expected: FAIL
|
||||
|
||||
[application/xhtml+xml valid: created using a parser from this frame and the method from the iframe]
|
||||
expected: FAIL
|
||||
|
||||
[application/xml valid: created using another iframe's DOMParser from that frame]
|
||||
expected: FAIL
|
||||
|
||||
[image/svg+xml valid: created using another iframe's DOMParser from this frame]
|
||||
expected: FAIL
|
||||
|
||||
[image/svg+xml invalid XML: created using another iframe's DOMParser from that frame]
|
||||
expected: FAIL
|
||||
|
||||
[text/xml invalid XML: created using a parser from this frame and the method from the iframe]
|
||||
expected: FAIL
|
||||
|
||||
[text/xml valid: created using another iframe's DOMParser from this frame]
|
||||
expected: FAIL
|
||||
|
||||
[image/svg+xml invalid XML: created normally]
|
||||
expected: FAIL
|
||||
|
||||
[text/xml valid: created using a parser from this frame and the method from the iframe]
|
||||
expected: FAIL
|
||||
|
||||
[text/xml valid: created using a parser from the iframe and the method from this frame]
|
||||
expected: FAIL
|
||||
|
||||
[application/xhtml+xml invalid XML: created normally]
|
||||
expected: FAIL
|
||||
|
||||
[application/xhtml+xml valid: created normally]
|
||||
expected: FAIL
|
||||
|
||||
[text/html valid: created using another iframe's DOMParser from this frame]
|
||||
expected: FAIL
|
||||
|
||||
[text/xml invalid XML: created normally]
|
||||
expected: FAIL
|
||||
|
||||
[text/html valid: created normally]
|
||||
expected: FAIL
|
||||
|
||||
[text/xml valid: created using another iframe's DOMParser from that frame]
|
||||
expected: FAIL
|
||||
|
||||
[application/xml invalid XML: created using a parser from this frame and the method from the iframe]
|
||||
expected: FAIL
|
||||
|
||||
[application/xhtml+xml invalid XML: created using another iframe's DOMParser from this frame]
|
||||
expected: FAIL
|
||||
|
||||
[application/xml valid: created using another iframe's DOMParser from this frame]
|
||||
expected: FAIL
|
||||
|
||||
[application/xml invalid XML: created using another iframe's DOMParser from that frame]
|
||||
expected: FAIL
|
||||
|
||||
[application/xhtml+xml valid: created using another iframe's DOMParser from that frame]
|
||||
expected: FAIL
|
||||
|
||||
[image/svg+xml valid: created using a parser from the iframe and the method from this frame]
|
||||
expected: FAIL
|
||||
|
||||
[text/html valid: created using a parser from this frame and the method from the iframe]
|
||||
expected: FAIL
|
||||
|
||||
[image/svg+xml invalid XML: created using a parser from the iframe and the method from this frame]
|
||||
expected: FAIL
|
||||
|
||||
[text/xml invalid XML: created using another iframe's DOMParser from this frame]
|
||||
expected: FAIL
|
||||
|
||||
[text/html valid: created using another iframe's DOMParser from that frame]
|
||||
expected: FAIL
|
||||
|
||||
[application/xhtml+xml invalid XML: created using a parser from this frame and the method from the iframe]
|
||||
expected: FAIL
|
||||
|
||||
[application/xml invalid XML: created normally]
|
||||
expected: FAIL
|
||||
|
||||
[application/xhtml+xml invalid XML: created using another iframe's DOMParser from that frame]
|
||||
expected: FAIL
|
||||
|
||||
[image/svg+xml valid: created normally]
|
||||
expected: FAIL
|
||||
|
||||
[image/svg+xml valid: created using a parser from this frame and the method from the iframe]
|
||||
expected: FAIL
|
||||
|
||||
[application/xml invalid XML: created using another iframe's DOMParser from this frame]
|
||||
expected: FAIL
|
||||
|
||||
[application/xml invalid XML: created using a parser from the iframe and the method from this frame]
|
||||
expected: FAIL
|
||||
|
||||
[image/svg+xml invalid XML: created using a parser from this frame and the method from the iframe]
|
||||
expected: FAIL
|
||||
|
||||
[application/xml valid: created using a parser from the iframe and the method from this frame]
|
||||
expected: FAIL
|
||||
|
||||
[application/xhtml+xml valid: created using another iframe's DOMParser from this frame]
|
||||
expected: FAIL
|
||||
|
||||
[text/html valid: created using a parser from the iframe and the method from this frame]
|
||||
expected: FAIL
|
||||
|
||||
[image/svg+xml valid: created using another iframe's DOMParser from that frame]
|
||||
expected: FAIL
|
||||
|
||||
[text/xml invalid XML: created using another iframe's DOMParser from that frame]
|
||||
expected: FAIL
|
||||
|
||||
[text/xml invalid XML: created using a parser from the iframe and the method from this frame]
|
||||
expected: FAIL
|
||||
|
||||
Loading…
Reference in a new issue