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" type="text/css"?> |
michael@0 | 3 | |
michael@0 | 4 | <window title="Browser Drop Tests" |
michael@0 | 5 | onload="loaded()" |
michael@0 | 6 | xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
michael@0 | 7 | |
michael@0 | 8 | <script type="application/javascript" |
michael@0 | 9 | src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> |
michael@0 | 10 | <script type="application/javascript" |
michael@0 | 11 | src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/> |
michael@0 | 12 | <script type="application/javascript" |
michael@0 | 13 | src="chrome://mochikit/content/tests/SimpleTest/ChromeUtils.js"/> |
michael@0 | 14 | |
michael@0 | 15 | <script> |
michael@0 | 16 | <![CDATA[ |
michael@0 | 17 | |
michael@0 | 18 | var link = null, name = null; |
michael@0 | 19 | function handleLink(event, uri, linkname) { link = uri; name = linkname; } |
michael@0 | 20 | |
michael@0 | 21 | function runTest() |
michael@0 | 22 | { |
michael@0 | 23 | function expectLink(element, expectedLink, expectedName, data, testid) |
michael@0 | 24 | { |
michael@0 | 25 | link = ""; |
michael@0 | 26 | name = ""; |
michael@0 | 27 | synthesizeDrop(element, element, data, "", element.ownerDocument.defaultView); |
michael@0 | 28 | |
michael@0 | 29 | is(link, expectedLink, testid + " link"); |
michael@0 | 30 | is(name, expectedName, testid + " name"); |
michael@0 | 31 | } |
michael@0 | 32 | |
michael@0 | 33 | ["chrome", "content"].forEach(function (type) { |
michael@0 | 34 | var child = document.getElementById(type + "child"); |
michael@0 | 35 | child.droppedLinkHandler = handleLink; |
michael@0 | 36 | |
michael@0 | 37 | expectLink(child, "http://www.mozilla.org", "http://www.mozilla.org", |
michael@0 | 38 | [ [ { type: "text/plain", data: "http://www.mozilla.org" } ] ], |
michael@0 | 39 | "text/plain drop on browser " + type); |
michael@0 | 40 | expectLink(child, "", "", |
michael@0 | 41 | [ [ { type: "text/link", data: "http://www.mozilla.org" } ] ], |
michael@0 | 42 | "text/link drop on browser " + type); |
michael@0 | 43 | expectLink(child, "http://www.example.com", "http://www.example.com", |
michael@0 | 44 | [ [ { type: "text/uri-list", data: "http://www.example.com\nhttp://www.mozilla.org" } ] ], |
michael@0 | 45 | "text/uri-list drop on browser " + type); |
michael@0 | 46 | expectLink(child, "http://www.example.com", "Example.com", |
michael@0 | 47 | [ [ { type: "text/x-moz-url", data: "http://www.example.com\nExample.com" } ] ], |
michael@0 | 48 | "text/x-moz-url drop on browser " + type); |
michael@0 | 49 | // dropping a chrome url should fail as we don't have a source node set, |
michael@0 | 50 | // defaulting to a source of file:/// |
michael@0 | 51 | expectLink(child, "", "", |
michael@0 | 52 | [ [ { type: "text/x-moz-url", data: "chrome://browser/content/browser.xul" } ] ], |
michael@0 | 53 | "text/x-moz-url chrome url drop on browser " + type); |
michael@0 | 54 | }); |
michael@0 | 55 | |
michael@0 | 56 | // stopPropagation should not prevent the browser link handling from occuring |
michael@0 | 57 | frames[1].wrappedJSObject.stopMode = true; |
michael@0 | 58 | var body = document.getElementById("contentchild").contentDocument.body; |
michael@0 | 59 | expectLink(body, "http://www.mozilla.org", "http://www.mozilla.org", |
michael@0 | 60 | [ [ { type: "text/uri-list", data: "http://www.mozilla.org" } ] ], |
michael@0 | 61 | "text/x-moz-url drop on browser with stopPropagation drop event"); |
michael@0 | 62 | |
michael@0 | 63 | // canceling the event, however, should prevent the link from being handled |
michael@0 | 64 | frames[1].wrappedJSObject.cancelMode = true; |
michael@0 | 65 | expectLink(body, "", "", |
michael@0 | 66 | [ [ { type: "text/uri-list", data: "http://www.example.org" } ] ], |
michael@0 | 67 | "text/x-moz-url drop on browser with cancelled drop event"); |
michael@0 | 68 | |
michael@0 | 69 | window.close(); |
michael@0 | 70 | window.opener.wrappedJSObject.SimpleTest.finish(); |
michael@0 | 71 | } |
michael@0 | 72 | |
michael@0 | 73 | function is(l, r, n) { window.opener.wrappedJSObject.SimpleTest.is(l,r,n); } |
michael@0 | 74 | function ok(v, n) { window.opener.wrappedJSObject.SimpleTest.ok(v,n); } |
michael@0 | 75 | |
michael@0 | 76 | function loaded() |
michael@0 | 77 | { |
michael@0 | 78 | SimpleTest.waitForFocus(runTest); |
michael@0 | 79 | } |
michael@0 | 80 | |
michael@0 | 81 | ]]> |
michael@0 | 82 | </script> |
michael@0 | 83 | |
michael@0 | 84 | <browser id="chromechild" src="about:blank"/> |
michael@0 | 85 | <browser id="contentchild" type="content" width="100" height="100" |
michael@0 | 86 | src="data:text/html,<html draggable='true'><body draggable='true' style='width: 100px; height: 100px;' ondragover='event.preventDefault()' ondrop='if (window.stopMode) event.stopPropagation(); if (window.cancelMode) event.preventDefault();'></body></html>"/> |
michael@0 | 87 | |
michael@0 | 88 | </window> |