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 | <!-- |
michael@0 | 2 | Any copyright is dedicated to the Public Domain. |
michael@0 | 3 | http://creativecommons.org/publicdomain/zero/1.0/ |
michael@0 | 4 | --> |
michael@0 | 5 | <!DOCTYPE HTML> |
michael@0 | 6 | <html> |
michael@0 | 7 | <!-- |
michael@0 | 8 | https://bugzilla.mozilla.org/show_bug.cgi?id=717103 |
michael@0 | 9 | --> |
michael@0 | 10 | <head> |
michael@0 | 11 | <title>Test for basic sanity of the device storage API </title> |
michael@0 | 12 | <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 13 | <script type="text/javascript" src="devicestorage_common.js"></script> |
michael@0 | 14 | |
michael@0 | 15 | <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
michael@0 | 16 | </head> |
michael@0 | 17 | <body> |
michael@0 | 18 | <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=717103">Mozilla Bug 717103</a> |
michael@0 | 19 | <p id="display"></p> |
michael@0 | 20 | <div id="content" style="display: none"> |
michael@0 | 21 | |
michael@0 | 22 | </div> |
michael@0 | 23 | <pre id="test"> |
michael@0 | 24 | <script class="testbody" type="text/javascript"> |
michael@0 | 25 | |
michael@0 | 26 | var filename = "devicestorage/aaaa.png" |
michael@0 | 27 | |
michael@0 | 28 | devicestorage_setup(); |
michael@0 | 29 | |
michael@0 | 30 | |
michael@0 | 31 | function deleteSuccess(e) { |
michael@0 | 32 | devicestorage_cleanup(); |
michael@0 | 33 | } |
michael@0 | 34 | |
michael@0 | 35 | function deleteError(e) { |
michael@0 | 36 | ok(false, "deleteError was called : " + e.target.error.name); |
michael@0 | 37 | devicestorage_cleanup(); |
michael@0 | 38 | } |
michael@0 | 39 | |
michael@0 | 40 | function addOverwritingSuccess(e) { |
michael@0 | 41 | ok(false, "addOverwritingSuccess was called."); |
michael@0 | 42 | devicestorage_cleanup(); |
michael@0 | 43 | } |
michael@0 | 44 | |
michael@0 | 45 | function addOverwritingError(e) { |
michael@0 | 46 | ok(true, "Adding to the same location should fail"); |
michael@0 | 47 | ok(e.target.error.name == "NoModificationAllowedError", "Error must be NoModificationAllowedError"); |
michael@0 | 48 | |
michael@0 | 49 | var storage = navigator.getDeviceStorage("pictures"); |
michael@0 | 50 | request = storage.delete(filename) |
michael@0 | 51 | request.onsuccess = deleteSuccess; |
michael@0 | 52 | request.onerror = deleteError; |
michael@0 | 53 | } |
michael@0 | 54 | |
michael@0 | 55 | function addSuccess(e) { |
michael@0 | 56 | ok(true, "addSuccess was called"); |
michael@0 | 57 | |
michael@0 | 58 | var storage = navigator.getDeviceStorage("pictures"); |
michael@0 | 59 | ok(navigator.getDeviceStorage, "Should have getDeviceStorage"); |
michael@0 | 60 | |
michael@0 | 61 | request = storage.addNamed(createRandomBlob('image/png'), filename); |
michael@0 | 62 | ok(request, "Should have a non-null request"); |
michael@0 | 63 | |
michael@0 | 64 | request.onsuccess = addOverwritingSuccess; |
michael@0 | 65 | request.onerror = addOverwritingError; |
michael@0 | 66 | } |
michael@0 | 67 | |
michael@0 | 68 | function addError(e) { |
michael@0 | 69 | // test file is already exists. clean it up and try again.. |
michael@0 | 70 | var storage = navigator.getDeviceStorage("pictures"); |
michael@0 | 71 | request = storage.delete(filename) |
michael@0 | 72 | request.onsuccess = runtest; |
michael@0 | 73 | } |
michael@0 | 74 | |
michael@0 | 75 | function runtest() { |
michael@0 | 76 | var storage = navigator.getDeviceStorage("pictures"); |
michael@0 | 77 | ok(navigator.getDeviceStorage, "Should have getDeviceStorage"); |
michael@0 | 78 | |
michael@0 | 79 | request = storage.addNamed(createRandomBlob('image/png'), filename); |
michael@0 | 80 | ok(request, "Should have a non-null request"); |
michael@0 | 81 | |
michael@0 | 82 | request.onsuccess = addSuccess; |
michael@0 | 83 | request.onerror = addError; |
michael@0 | 84 | } |
michael@0 | 85 | |
michael@0 | 86 | runtest(); |
michael@0 | 87 | |
michael@0 | 88 | </script> |
michael@0 | 89 | </pre> |
michael@0 | 90 | </body> |
michael@0 | 91 | </html> |
michael@0 | 92 |