mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 1543245 - Prevent HTML script tags from loading twice when using PrototypeDocument. r=smaug
HTML script tags were being loaded once by the element when it was bound to the tree and a second time by the PrototypeDocumentContentSink. This patch disables the script element from loading itself. Differential Revision: https://phabricator.services.mozilla.com/D26823
This commit is contained in:
parent
67a7d1d576
commit
4ac9a7a0eb
@ -1034,6 +1034,15 @@ nsresult PrototypeDocumentContentSink::CreateElementFromPrototype(
|
||||
|
||||
rv = AddAttributes(aPrototype, result);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
if (xtfNi->Equals(nsGkAtoms::script, kNameSpaceID_XHTML) ||
|
||||
xtfNi->Equals(nsGkAtoms::script, kNameSpaceID_SVG)) {
|
||||
nsCOMPtr<nsIScriptElement> sele = do_QueryInterface(result);
|
||||
MOZ_ASSERT(sele, "Node didn't QI to script.");
|
||||
// Script loading is handled by the this content sink, so prevent the
|
||||
// script from loading when it is bound to the document.
|
||||
sele->PreventExecution();
|
||||
}
|
||||
}
|
||||
|
||||
result.forget(aResult);
|
||||
|
Loading…
Reference in New Issue
Block a user