зеркало из https://github.com/mozilla/gecko-dev.git
Merge from mc
This commit is contained in:
Коммит
6113e54f25
|
@ -1100,10 +1100,6 @@ nsHTMLParanoidFragmentSink::CloseContainer(const nsHTMLTag aTag)
|
|||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if (mIgnoreNextCloseHead && aTag == eHTMLTag_head) {
|
||||
mIgnoreNextCloseHead = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
if (mSkip) {
|
||||
mSkip = PR_FALSE;
|
||||
return rv;
|
||||
|
@ -1233,10 +1229,7 @@ nsHTMLParanoidFragmentSink::AddLeaf(const nsIParserNode& aNode)
|
|||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// We need to explicitly skip adding leaf nodes in the paranoid sink,
|
||||
// otherwise things like the textnode under <title> get appended to
|
||||
// the fragment itself, and won't be popped off in CloseContainer.
|
||||
if (mSkip || mIgnoreNextCloseHead) {
|
||||
if (mSkip) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,8 +52,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=520182
|
|||
<div id="jj" contenteditable="true"></div>
|
||||
<iframe id="kk" src="about:blank"></iframe>
|
||||
<div id="ll" contenteditable="true"></div>
|
||||
<iframe id="mm" src="about:blank"></iframe>
|
||||
<div id="nn" contenteditable="true"></div>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
@ -75,7 +73,6 @@ const invalidStyle3Payload = "foo<style>@import 'xxx.css';</style>baz";
|
|||
const invalidStyle4Payload = "foo<span style=\"@import 'xxx.css';\">bar</span>baz";
|
||||
const invalidStyle5Payload = "foo<span style=\"@font-face{font-family:xxx;src:'xxx.ttf';}\">bar</span>baz";
|
||||
const invalidStyle6Payload = "foo<span style=\"@namespace xxx url(http://example.com/);\">bar</span>baz";
|
||||
const invalidStyle7Payload = "<html><head><title>xxx</title></head><body>foo</body></html>";
|
||||
const nestedStylePayload = "foo<style>#bar1{-moz-binding:url('data:text/xml,<?xml version="1.0"><binding xmlns="http://www.mozilla.org/xbl" id="binding-1"/>');<style></style>#bar2{-moz-binding:url('data:text/xml,<?xml version="1.0"><binding xmlns="http://www.mozilla.org/xbl" id="binding-2"/>');</style>baz";
|
||||
const validImgSrc1Payload = "foo<img src=\"data:image/png,bar\">baz";
|
||||
const validImgSrc2Payload = "foo<img src=\"javascript:void('bar');\">baz";
|
||||
|
@ -202,26 +199,26 @@ var tests = [
|
|||
{
|
||||
id: "s",
|
||||
isIFrame: true,
|
||||
payload: invalidStyle3Payload,
|
||||
payload: invalidStyle1Payload,
|
||||
rootElement: function() document.getElementById("s").contentDocument.documentElement,
|
||||
checkResult: function(html) is(html.indexOf("xxx"), -1, "Should not have retained the import style")
|
||||
},
|
||||
{
|
||||
id: "t",
|
||||
payload: invalidStyle3Payload,
|
||||
payload: invalidStyle1Payload,
|
||||
rootElement: function() document.getElementById("t"),
|
||||
checkResult: function(html) is(html.indexOf("xxx"), -1, "Should not have retained the import style")
|
||||
},
|
||||
{
|
||||
id: "u",
|
||||
isIFrame: true,
|
||||
payload: invalidStyle4Payload,
|
||||
payload: invalidStyle2Payload,
|
||||
rootElement: function() document.getElementById("u").contentDocument.documentElement,
|
||||
checkResult: function(html) is(html.indexOf("xxx"), -1, "Should not have retained the import style")
|
||||
},
|
||||
{
|
||||
id: "v",
|
||||
payload: invalidStyle4Payload,
|
||||
payload: invalidStyle2Payload,
|
||||
rootElement: function() document.getElementById("v"),
|
||||
checkResult: function(html) is(html.indexOf("xxx"), -1, "Should not have retained the import style")
|
||||
},
|
||||
|
@ -301,62 +298,41 @@ var tests = [
|
|||
{
|
||||
id: "gg",
|
||||
isIFrame: true,
|
||||
payload: validImgSrc1Payload,
|
||||
payload: invalidStyle6Payload,
|
||||
rootElement: function() document.getElementById("gg").contentDocument.documentElement,
|
||||
checkResult: function(html) isnot(html.indexOf("bar"), -1, "Should have retained the src attribute for the image")
|
||||
},
|
||||
{
|
||||
id: "hh",
|
||||
payload: validImgSrc1Payload,
|
||||
payload: invalidStyle6Payload,
|
||||
rootElement: function() document.getElementById("hh"),
|
||||
checkResult: function(html) isnot(html.indexOf("bar"), -1, "Should have retained the src attribute for the image")
|
||||
},
|
||||
{
|
||||
id: "ii",
|
||||
isIFrame: true,
|
||||
payload: validImgSrc2Payload,
|
||||
payload: invalidStyle6Payload,
|
||||
rootElement: function() document.getElementById("ii").contentDocument.documentElement,
|
||||
checkResult: function(html) isnot(html.indexOf("bar"), -1, "Should have retained the src attribute for the image")
|
||||
},
|
||||
{
|
||||
id: "jj",
|
||||
payload: validImgSrc2Payload,
|
||||
payload: invalidStyle6Payload,
|
||||
rootElement: function() document.getElementById("jj"),
|
||||
checkResult: function(html) isnot(html.indexOf("bar"), -1, "Should have retained the src attribute for the image")
|
||||
},
|
||||
{
|
||||
id: "kk",
|
||||
isIFrame: true,
|
||||
payload: validImgSrc3Payload,
|
||||
payload: invalidStyle6Payload,
|
||||
rootElement: function() document.getElementById("kk").contentDocument.documentElement,
|
||||
checkResult: function(html) isnot(html.indexOf("bar"), -1, "Should have retained the src attribute for the image")
|
||||
},
|
||||
{
|
||||
id: "ll",
|
||||
payload: validImgSrc3Payload,
|
||||
payload: invalidStyle6Payload,
|
||||
rootElement: function() document.getElementById("ll"),
|
||||
checkResult: function(html) isnot(html.indexOf("bar"), -1, "Should have retained the src attribute for the image")
|
||||
},
|
||||
{
|
||||
id: "mm",
|
||||
isIFrame: true,
|
||||
insertHTML: true,
|
||||
payload: invalidStyle7Payload,
|
||||
rootElement: function() document.getElementById("mm").contentDocument.documentElement,
|
||||
checkResult: function(html) {
|
||||
is(html.indexOf("xxx"), -1, "Should not have retained the title text");
|
||||
isnot(html.indexOf("foo"), -1, "Should have retained the body text");
|
||||
}
|
||||
},
|
||||
{
|
||||
id: "nn",
|
||||
insertHTML: true,
|
||||
payload: invalidStyle7Payload,
|
||||
rootElement: function() document.getElementById("nn"),
|
||||
checkResult: function(html) {
|
||||
is(html.indexOf("xxx"), -1, "Should not have retained the title text");
|
||||
isnot(html.indexOf("foo"), -1, "Should have retained the body text");
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
|
@ -381,37 +357,28 @@ function runTest(test) {
|
|||
} else
|
||||
elem.focus();
|
||||
|
||||
if ("insertHTML" in test) {
|
||||
if ("isIFrame" in test) {
|
||||
elem.contentDocument.execCommand("inserthtml", false, test.payload);
|
||||
} else {
|
||||
getSelection().collapse(elem, 0);
|
||||
document.execCommand("inserthtml", false, test.payload);
|
||||
}
|
||||
} else {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
var clipboard = Components.classes["@mozilla.org/widget/clipboard;1"]
|
||||
.getService(Components.interfaces.nsIClipboard);
|
||||
var clipboard = Components.classes["@mozilla.org/widget/clipboard;1"]
|
||||
.getService(Components.interfaces.nsIClipboard);
|
||||
|
||||
var trans = Components.classes["@mozilla.org/widget/transferable;1"]
|
||||
.createInstance(Components.interfaces.nsITransferable);
|
||||
var data = Components.classes["@mozilla.org/supports-string;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsString);
|
||||
data.data = test.payload;
|
||||
trans.addDataFlavor("text/html");
|
||||
trans.setTransferData("text/html", data, data.data.length * 2);
|
||||
clipboard.setData(trans, null, Components.interfaces.nsIClipboard.kGlobalClipboard);
|
||||
var trans = Components.classes["@mozilla.org/widget/transferable;1"]
|
||||
.createInstance(Components.interfaces.nsITransferable);
|
||||
var data = Components.classes["@mozilla.org/supports-string;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsString);
|
||||
data.data = test.payload;
|
||||
trans.addDataFlavor("text/html");
|
||||
trans.setTransferData("text/html", data, data.data.length * 2);
|
||||
clipboard.setData(trans, null, Components.interfaces.nsIClipboard.kGlobalClipboard);
|
||||
|
||||
var mainWindow = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsIWebNavigation)
|
||||
.QueryInterface(Components.interfaces.nsIDocShellTreeItem)
|
||||
.rootTreeItem
|
||||
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsIDOMWindow);
|
||||
var mainWindow = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsIWebNavigation)
|
||||
.QueryInterface(Components.interfaces.nsIDocShellTreeItem)
|
||||
.rootTreeItem
|
||||
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsIDOMWindow);
|
||||
|
||||
mainWindow.goDoCommand("cmd_paste");
|
||||
}
|
||||
mainWindow.goDoCommand("cmd_paste");
|
||||
|
||||
if ("checkResult" in test) {
|
||||
if ("isIFrame" in test) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче