From 044d1a38e2011d477563f44749ff376411d4486c Mon Sep 17 00:00:00 2001 From: Kyle Huey Date: Tue, 10 Aug 2010 21:10:36 -0700 Subject: [PATCH 1/3] Backed out changeset 1b12ed9d1c48 --- content/html/document/src/nsHTMLFragmentContentSink.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/content/html/document/src/nsHTMLFragmentContentSink.cpp b/content/html/document/src/nsHTMLFragmentContentSink.cpp index 918d33ec4f2e..996f2f6a1089 100644 --- a/content/html/document/src/nsHTMLFragmentContentSink.cpp +++ b/content/html/document/src/nsHTMLFragmentContentSink.cpp @@ -1233,9 +1233,6 @@ 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 get appended to - // the fragment itself, and won't be popped off in CloseContainer. if (mSkip || mIgnoreNextCloseHead) { return rv; } From 73aa6b4ba36e7c48e6889efbaf91ddee971ce7e0 Mon Sep 17 00:00:00 2001 From: Kyle Huey <me@kylehuey.com> Date: Tue, 10 Aug 2010 21:12:06 -0700 Subject: [PATCH 2/3] Backed out changeset 40ad71a60486 --- .../libeditor/html/tests/test_bug520189.html | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/editor/libeditor/html/tests/test_bug520189.html b/editor/libeditor/html/tests/test_bug520189.html index 3b244b5f45e1..d62a9db220f1 100644 --- a/editor/libeditor/html/tests/test_bug520189.html +++ b/editor/libeditor/html/tests/test_bug520189.html @@ -202,26 +202,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,39 +301,39 @@ 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") }, From ee8098277d3a6c0f3a1e4cfd2c95a8aa02091ca2 Mon Sep 17 00:00:00 2001 From: Kyle Huey <me@kylehuey.com> Date: Tue, 10 Aug 2010 21:14:51 -0700 Subject: [PATCH 3/3] Backed out changeset 0aa4ad290221 --- .../src/nsHTMLFragmentContentSink.cpp | 6 +- .../libeditor/html/tests/test_bug520189.html | 69 +++++-------------- 2 files changed, 19 insertions(+), 56 deletions(-) diff --git a/content/html/document/src/nsHTMLFragmentContentSink.cpp b/content/html/document/src/nsHTMLFragmentContentSink.cpp index 996f2f6a1089..823ca70b9cd7 100644 --- a/content/html/document/src/nsHTMLFragmentContentSink.cpp +++ b/content/html/document/src/nsHTMLFragmentContentSink.cpp @@ -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,7 +1229,7 @@ nsHTMLParanoidFragmentSink::AddLeaf(const nsIParserNode& aNode) nsresult rv = NS_OK; - if (mSkip || mIgnoreNextCloseHead) { + if (mSkip) { return rv; } diff --git a/editor/libeditor/html/tests/test_bug520189.html b/editor/libeditor/html/tests/test_bug520189.html index d62a9db220f1..8bf41534ba09 100644 --- a/editor/libeditor/html/tests/test_bug520189.html +++ b/editor/libeditor/html/tests/test_bug520189.html @@ -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>xxxfoo"; const nestedStylePayload = "foo#bar2{-moz-binding:url('data:text/xml,');baz"; const validImgSrc1Payload = "foobaz"; const validImgSrc2Payload = "foobaz"; @@ -336,27 +333,6 @@ var tests = [ 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) {