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=434998 |
michael@0 | 8 | --> |
michael@0 | 9 | <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" |
michael@0 | 10 | title="Mozilla Bug 434998" onload="runTest();"> |
michael@0 | 11 | <script type="application/javascript" |
michael@0 | 12 | src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/> |
michael@0 | 13 | <script type="application/javascript" |
michael@0 | 14 | src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> |
michael@0 | 15 | |
michael@0 | 16 | <body xmlns="http://www.w3.org/1999/xhtml"> |
michael@0 | 17 | <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=434998" |
michael@0 | 18 | target="_blank">Mozilla Bug 434998</a> |
michael@0 | 19 | <p/> |
michael@0 | 20 | <editor xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" |
michael@0 | 21 | id="editor" |
michael@0 | 22 | type="content-primary" |
michael@0 | 23 | editortype="html" |
michael@0 | 24 | style="width: 400px; height: 100px; border: thin solid black"/> |
michael@0 | 25 | <p/> |
michael@0 | 26 | <pre id="test"> |
michael@0 | 27 | </pre> |
michael@0 | 28 | </body> |
michael@0 | 29 | <script class="testbody" type="application/javascript"> |
michael@0 | 30 | <![CDATA[ |
michael@0 | 31 | |
michael@0 | 32 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 33 | |
michael@0 | 34 | function EditorContentListener(aEditor) |
michael@0 | 35 | { |
michael@0 | 36 | this.init(aEditor); |
michael@0 | 37 | } |
michael@0 | 38 | |
michael@0 | 39 | EditorContentListener.prototype = { |
michael@0 | 40 | init : function(aEditor) |
michael@0 | 41 | { |
michael@0 | 42 | this.mEditor = aEditor; |
michael@0 | 43 | }, |
michael@0 | 44 | |
michael@0 | 45 | QueryInterface : function(aIID) |
michael@0 | 46 | { |
michael@0 | 47 | if (aIID.equals(Components.interfaces.nsIWebProgressListener) || |
michael@0 | 48 | aIID.equals(Components.interfaces.nsISupportsWeakReference) || |
michael@0 | 49 | aIID.equals(Components.interfaces.nsISupports)) |
michael@0 | 50 | return this; |
michael@0 | 51 | throw Components.results.NS_NOINTERFACE; |
michael@0 | 52 | }, |
michael@0 | 53 | |
michael@0 | 54 | onStateChange : function(aWebProgress, aRequest, aStateFlags, aStatus) |
michael@0 | 55 | { |
michael@0 | 56 | if (aStateFlags & Components.interfaces.nsIWebProgressListener.STATE_STOP) |
michael@0 | 57 | { |
michael@0 | 58 | var editor = this.mEditor.getEditor(this.mEditor.contentWindow); |
michael@0 | 59 | if (editor) { |
michael@0 | 60 | // Should not throw |
michael@0 | 61 | var threw = false; |
michael@0 | 62 | try { |
michael@0 | 63 | this.mEditor.contentDocument.execCommand("bold", false, null); |
michael@0 | 64 | } catch (e) { |
michael@0 | 65 | threw = true; |
michael@0 | 66 | } |
michael@0 | 67 | ok(!threw, "The execCommand API should work on <xul:editor>"); |
michael@0 | 68 | progress.removeProgressListener(progressListener, Components.interfaces.nsIWebProgress.NOTIFY_ALL); |
michael@0 | 69 | SimpleTest.finish(); |
michael@0 | 70 | } |
michael@0 | 71 | } |
michael@0 | 72 | }, |
michael@0 | 73 | |
michael@0 | 74 | |
michael@0 | 75 | onProgressChange : function(aWebProgress, aRequest, |
michael@0 | 76 | aCurSelfProgress, aMaxSelfProgress, |
michael@0 | 77 | aCurTotalProgress, aMaxTotalProgress) |
michael@0 | 78 | { |
michael@0 | 79 | }, |
michael@0 | 80 | |
michael@0 | 81 | onLocationChange : function(aWebProgress, aRequest, aLocation, aFlags) |
michael@0 | 82 | { |
michael@0 | 83 | }, |
michael@0 | 84 | |
michael@0 | 85 | onStatusChange : function(aWebProgress, aRequest, aStatus, aMessage) |
michael@0 | 86 | { |
michael@0 | 87 | }, |
michael@0 | 88 | |
michael@0 | 89 | onSecurityChange : function(aWebProgress, aRequest, aState) |
michael@0 | 90 | { |
michael@0 | 91 | }, |
michael@0 | 92 | |
michael@0 | 93 | mEditor: null |
michael@0 | 94 | }; |
michael@0 | 95 | |
michael@0 | 96 | var progress, progressListener; |
michael@0 | 97 | |
michael@0 | 98 | function runTest() { |
michael@0 | 99 | var newEditorElement = document.getElementById("editor"); |
michael@0 | 100 | newEditorElement.makeEditable("html", true); |
michael@0 | 101 | var docShell = newEditorElement.boxObject.QueryInterface(Components.interfaces.nsIEditorBoxObject).docShell; |
michael@0 | 102 | progress = docShell.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIWebProgress); |
michael@0 | 103 | progressListener = new EditorContentListener(newEditorElement); |
michael@0 | 104 | progress.addProgressListener(progressListener, Components.interfaces.nsIWebProgress.NOTIFY_ALL); |
michael@0 | 105 | newEditorElement.setAttribute("src", "data:text/html,"); |
michael@0 | 106 | } |
michael@0 | 107 | ]]> |
michael@0 | 108 | </script> |
michael@0 | 109 | </window> |