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 | <!DOCTYPE HTML> |
michael@0 | 2 | <html lang="en"> |
michael@0 | 3 | <head> |
michael@0 | 4 | <meta charset="utf8"> |
michael@0 | 5 | <title>Test for the native getters in object actors</title> |
michael@0 | 6 | <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
michael@0 | 7 | <script type="text/javascript;version=1.8" src="common.js"></script> |
michael@0 | 8 | <!-- Any copyright is dedicated to the Public Domain. |
michael@0 | 9 | - http://creativecommons.org/publicdomain/zero/1.0/ --> |
michael@0 | 10 | </head> |
michael@0 | 11 | <body> |
michael@0 | 12 | <p>Test for the native getters in object actors</p> |
michael@0 | 13 | |
michael@0 | 14 | <script class="testbody" type="text/javascript;version=1.8"> |
michael@0 | 15 | SimpleTest.waitForExplicitFinish(); |
michael@0 | 16 | |
michael@0 | 17 | let expectedProps = []; |
michael@0 | 18 | let expectedSafeGetters = []; |
michael@0 | 19 | |
michael@0 | 20 | function startTest() |
michael@0 | 21 | { |
michael@0 | 22 | removeEventListener("load", startTest); |
michael@0 | 23 | |
michael@0 | 24 | attachConsole(["ConsoleAPI"], onAttach, true); |
michael@0 | 25 | } |
michael@0 | 26 | |
michael@0 | 27 | function onAttach(aState, aResponse) |
michael@0 | 28 | { |
michael@0 | 29 | onConsoleCall = onConsoleCall.bind(null, aState); |
michael@0 | 30 | aState.dbgClient.addListener("consoleAPICall", onConsoleCall); |
michael@0 | 31 | |
michael@0 | 32 | top.console.log("hello", document); |
michael@0 | 33 | |
michael@0 | 34 | expectedProps = { |
michael@0 | 35 | "location": { |
michael@0 | 36 | get: { |
michael@0 | 37 | type: "object", |
michael@0 | 38 | class: "Function", |
michael@0 | 39 | actor: /[a-z]/, |
michael@0 | 40 | }, |
michael@0 | 41 | }, |
michael@0 | 42 | }; |
michael@0 | 43 | |
michael@0 | 44 | expectedSafeGetters = { |
michael@0 | 45 | "title": { |
michael@0 | 46 | getterValue: /native getters in object actors/, |
michael@0 | 47 | getterPrototypeLevel: 2, |
michael@0 | 48 | }, |
michael@0 | 49 | "styleSheets": { |
michael@0 | 50 | getterValue: "[object Object]", |
michael@0 | 51 | getterPrototypeLevel: 2, |
michael@0 | 52 | }, |
michael@0 | 53 | }; |
michael@0 | 54 | } |
michael@0 | 55 | |
michael@0 | 56 | function onConsoleCall(aState, aType, aPacket) |
michael@0 | 57 | { |
michael@0 | 58 | is(aPacket.from, aState.actor, "console API call actor"); |
michael@0 | 59 | |
michael@0 | 60 | info("checking the console API call packet"); |
michael@0 | 61 | |
michael@0 | 62 | checkConsoleAPICall(aPacket.message, { |
michael@0 | 63 | level: "log", |
michael@0 | 64 | filename: /test_object_actor/, |
michael@0 | 65 | functionName: "onAttach", |
michael@0 | 66 | arguments: ["hello", { |
michael@0 | 67 | type: "object", |
michael@0 | 68 | actor: /[a-z]/, |
michael@0 | 69 | }], |
michael@0 | 70 | }); |
michael@0 | 71 | |
michael@0 | 72 | aState.dbgClient.removeListener("consoleAPICall", onConsoleCall); |
michael@0 | 73 | |
michael@0 | 74 | info("inspecting object properties"); |
michael@0 | 75 | let args = aPacket.message.arguments; |
michael@0 | 76 | onProperties = onProperties.bind(null, aState); |
michael@0 | 77 | |
michael@0 | 78 | let client = new ObjectClient(aState.dbgClient, args[1]); |
michael@0 | 79 | client.getPrototypeAndProperties(onProperties); |
michael@0 | 80 | } |
michael@0 | 81 | |
michael@0 | 82 | function onProperties(aState, aResponse) |
michael@0 | 83 | { |
michael@0 | 84 | let props = aResponse.ownProperties; |
michael@0 | 85 | let keys = Object.keys(props); |
michael@0 | 86 | info(keys.length + " ownProperties: " + keys); |
michael@0 | 87 | |
michael@0 | 88 | ok(keys.length >= Object.keys(expectedProps).length, "number of properties"); |
michael@0 | 89 | |
michael@0 | 90 | info("check ownProperties"); |
michael@0 | 91 | checkObject(props, expectedProps); |
michael@0 | 92 | info("check safeGetterValues"); |
michael@0 | 93 | checkObject(aResponse.safeGetterValues, expectedSafeGetters); |
michael@0 | 94 | |
michael@0 | 95 | expectedProps = []; |
michael@0 | 96 | expectedSafeGetters = []; |
michael@0 | 97 | |
michael@0 | 98 | closeDebugger(aState, function() { |
michael@0 | 99 | SimpleTest.finish(); |
michael@0 | 100 | }); |
michael@0 | 101 | } |
michael@0 | 102 | |
michael@0 | 103 | addEventListener("load", startTest); |
michael@0 | 104 | </script> |
michael@0 | 105 | </body> |
michael@0 | 106 | </html> |