Sat, 03 Jan 2015 20:18:00 +0100
Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.
michael@0 | 1 | <?xml version="1.0"?> |
michael@0 | 2 | <?xml-stylesheet href="chrome://global/skin" |
michael@0 | 3 | type="text/css"?> |
michael@0 | 4 | <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" |
michael@0 | 5 | type="text/css"?> |
michael@0 | 6 | <!-- |
michael@0 | 7 | https://bugzilla.mozilla.org/show_bug.cgi?id=780908 |
michael@0 | 8 | |
michael@0 | 9 | adapted from test_bug607584.xul by Kent James <kent@caspia.com> |
michael@0 | 10 | --> |
michael@0 | 11 | <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" |
michael@0 | 12 | title="Mozilla Bug 780908" onload="runTest();"> |
michael@0 | 13 | <script type="application/javascript" |
michael@0 | 14 | src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/> |
michael@0 | 15 | <script type="application/javascript" |
michael@0 | 16 | src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> |
michael@0 | 17 | |
michael@0 | 18 | <body xmlns="http://www.w3.org/1999/xhtml"> |
michael@0 | 19 | <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=780908" |
michael@0 | 20 | target="_blank">Mozilla Bug 780908</a> |
michael@0 | 21 | <p/> |
michael@0 | 22 | <editor xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" |
michael@0 | 23 | id="editor" |
michael@0 | 24 | type="content-primary" |
michael@0 | 25 | editortype="html" |
michael@0 | 26 | style="width: 400px; height: 100px; border: thin solid black"/> |
michael@0 | 27 | <p/> |
michael@0 | 28 | <pre id="test"> |
michael@0 | 29 | </pre> |
michael@0 | 30 | </body> |
michael@0 | 31 | <script class="testbody" type="application/javascript"> |
michael@0 | 32 | <![CDATA[ |
michael@0 | 33 | |
michael@0 | 34 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 35 | |
michael@0 | 36 | function EditorContentListener(aEditor) |
michael@0 | 37 | { |
michael@0 | 38 | this.init(aEditor); |
michael@0 | 39 | } |
michael@0 | 40 | |
michael@0 | 41 | EditorContentListener.prototype = { |
michael@0 | 42 | init : function(aEditor) |
michael@0 | 43 | { |
michael@0 | 44 | this.mEditor = aEditor; |
michael@0 | 45 | }, |
michael@0 | 46 | |
michael@0 | 47 | QueryInterface : function(aIID) |
michael@0 | 48 | { |
michael@0 | 49 | if (aIID.equals(Components.interfaces.nsIWebProgressListener) || |
michael@0 | 50 | aIID.equals(Components.interfaces.nsISupportsWeakReference) || |
michael@0 | 51 | aIID.equals(Components.interfaces.nsISupports)) |
michael@0 | 52 | return this; |
michael@0 | 53 | throw Components.results.NS_NOINTERFACE; |
michael@0 | 54 | }, |
michael@0 | 55 | |
michael@0 | 56 | onStateChange : function(aWebProgress, aRequest, aStateFlags, aStatus) |
michael@0 | 57 | { |
michael@0 | 58 | if (aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_STOP) |
michael@0 | 59 | { |
michael@0 | 60 | var editor = this.mEditor.getEditor(this.mEditor.contentWindow); |
michael@0 | 61 | if (editor) { |
michael@0 | 62 | this.mEditor.focus(); |
michael@0 | 63 | editor instanceof Components.interfaces.nsIHTMLEditor; |
michael@0 | 64 | editor.returnInParagraphCreatesNewParagraph = true; |
michael@0 | 65 | source = "<html><body><table><head></table></body></html>"; |
michael@0 | 66 | editor.rebuildDocumentFromSource(source); |
michael@0 | 67 | ok(true, "Don't crash when head appears after body"); |
michael@0 | 68 | source = "<html></head><head><body></body></html>"; |
michael@0 | 69 | editor.rebuildDocumentFromSource(source); |
michael@0 | 70 | ok(true, "Don't crash when /head appears before head"); |
michael@0 | 71 | SimpleTest.finish(); |
michael@0 | 72 | progress.removeProgressListener(this); |
michael@0 | 73 | } |
michael@0 | 74 | } |
michael@0 | 75 | |
michael@0 | 76 | }, |
michael@0 | 77 | |
michael@0 | 78 | |
michael@0 | 79 | onProgressChange : function(aWebProgress, aRequest, |
michael@0 | 80 | aCurSelfProgress, aMaxSelfProgress, |
michael@0 | 81 | aCurTotalProgress, aMaxTotalProgress) |
michael@0 | 82 | { |
michael@0 | 83 | }, |
michael@0 | 84 | |
michael@0 | 85 | onLocationChange : function(aWebProgress, aRequest, aLocation, aFlags) |
michael@0 | 86 | { |
michael@0 | 87 | }, |
michael@0 | 88 | |
michael@0 | 89 | onStatusChange : function(aWebProgress, aRequest, aStatus, aMessage) |
michael@0 | 90 | { |
michael@0 | 91 | }, |
michael@0 | 92 | |
michael@0 | 93 | onSecurityChange : function(aWebProgress, aRequest, aState) |
michael@0 | 94 | { |
michael@0 | 95 | }, |
michael@0 | 96 | |
michael@0 | 97 | mEditor: null |
michael@0 | 98 | }; |
michael@0 | 99 | |
michael@0 | 100 | var progress, progressListener; |
michael@0 | 101 | |
michael@0 | 102 | function runTest() { |
michael@0 | 103 | var newEditorElement = document.getElementById("editor"); |
michael@0 | 104 | newEditorElement.makeEditable("html", true); |
michael@0 | 105 | var docShell = newEditorElement.boxObject.QueryInterface(Components.interfaces.nsIEditorBoxObject).docShell; |
michael@0 | 106 | progress = docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIWebProgress); |
michael@0 | 107 | progressListener = new EditorContentListener(newEditorElement); |
michael@0 | 108 | progress.addProgressListener(progressListener, Components.interfaces.nsIWebProgress.NOTIFY_ALL); |
michael@0 | 109 | newEditorElement.setAttribute("src", "data:text/html,"); |
michael@0 | 110 | } |
michael@0 | 111 | ]]> |
michael@0 | 112 | </script> |
michael@0 | 113 | </window> |