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 object actor</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 object actor</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 | |
michael@0 | 19 | function startTest() |
michael@0 | 20 | { |
michael@0 | 21 | removeEventListener("load", startTest); |
michael@0 | 22 | |
michael@0 | 23 | attachConsole(["ConsoleAPI"], onAttach, true); |
michael@0 | 24 | } |
michael@0 | 25 | |
michael@0 | 26 | function onAttach(aState, aResponse) |
michael@0 | 27 | { |
michael@0 | 28 | onConsoleCall = onConsoleCall.bind(null, aState); |
michael@0 | 29 | aState.dbgClient.addListener("consoleAPICall", onConsoleCall); |
michael@0 | 30 | |
michael@0 | 31 | let longString = (new Array(DebuggerServer.LONG_STRING_LENGTH + 3)).join("\u0629"); |
michael@0 | 32 | |
michael@0 | 33 | // Here we put the objects in the correct window, to avoid having them all |
michael@0 | 34 | // wrapped by proxies for cross-compartment access. |
michael@0 | 35 | |
michael@0 | 36 | let foobarObject = top.Object.create(null); |
michael@0 | 37 | foobarObject.tamarbuta = longString; |
michael@0 | 38 | foobarObject.foo = 1; |
michael@0 | 39 | foobarObject.foobar = "hello"; |
michael@0 | 40 | foobarObject.omg = null; |
michael@0 | 41 | foobarObject.testfoo = false; |
michael@0 | 42 | foobarObject.notInspectable = top.Object.create(null); |
michael@0 | 43 | foobarObject.omgfn = new top.Function("return 'myResult'"); |
michael@0 | 44 | foobarObject.abArray = new top.Array("a", "b"); |
michael@0 | 45 | foobarObject.foobaz = top.document; |
michael@0 | 46 | |
michael@0 | 47 | top.Object.defineProperty(foobarObject, "getterAndSetter", { |
michael@0 | 48 | enumerable: true, |
michael@0 | 49 | get: new top.Function("return 'foo';"), |
michael@0 | 50 | set: new top.Function("1+2"), |
michael@0 | 51 | }); |
michael@0 | 52 | |
michael@0 | 53 | foobarObject.longStringObj = top.Object.create(null); |
michael@0 | 54 | foobarObject.longStringObj.toSource = new top.Function("'" + longString + "'"); |
michael@0 | 55 | foobarObject.longStringObj.toString = new top.Function("'" + longString + "'"); |
michael@0 | 56 | foobarObject.longStringObj.boom = "explode"; |
michael@0 | 57 | |
michael@0 | 58 | top.wrappedJSObject.foobarObject = foobarObject; |
michael@0 | 59 | top.console.log("hello", top.wrappedJSObject.foobarObject); |
michael@0 | 60 | |
michael@0 | 61 | expectedProps = { |
michael@0 | 62 | "abArray": { |
michael@0 | 63 | value: { |
michael@0 | 64 | type: "object", |
michael@0 | 65 | class: "Array", |
michael@0 | 66 | actor: /[a-z]/, |
michael@0 | 67 | }, |
michael@0 | 68 | }, |
michael@0 | 69 | "foo": { |
michael@0 | 70 | configurable: true, |
michael@0 | 71 | enumerable: true, |
michael@0 | 72 | writable: true, |
michael@0 | 73 | value: 1, |
michael@0 | 74 | }, |
michael@0 | 75 | "foobar": { |
michael@0 | 76 | value: "hello", |
michael@0 | 77 | }, |
michael@0 | 78 | "foobaz": { |
michael@0 | 79 | value: { |
michael@0 | 80 | type: "object", |
michael@0 | 81 | class: "XULDocument", |
michael@0 | 82 | actor: /[a-z]/, |
michael@0 | 83 | }, |
michael@0 | 84 | }, |
michael@0 | 85 | "getterAndSetter": { |
michael@0 | 86 | get: { |
michael@0 | 87 | type: "object", |
michael@0 | 88 | class: "Function", |
michael@0 | 89 | actor: /[a-z]/, |
michael@0 | 90 | }, |
michael@0 | 91 | set: { |
michael@0 | 92 | type: "object", |
michael@0 | 93 | class: "Function", |
michael@0 | 94 | actor: /[a-z]/, |
michael@0 | 95 | }, |
michael@0 | 96 | }, |
michael@0 | 97 | "longStringObj": { |
michael@0 | 98 | value: { |
michael@0 | 99 | type: "object", |
michael@0 | 100 | class: "Object", |
michael@0 | 101 | actor: /[a-z]/, |
michael@0 | 102 | }, |
michael@0 | 103 | }, |
michael@0 | 104 | "notInspectable": { |
michael@0 | 105 | value: { |
michael@0 | 106 | type: "object", |
michael@0 | 107 | class: "Object", |
michael@0 | 108 | actor: /[a-z]/, |
michael@0 | 109 | }, |
michael@0 | 110 | }, |
michael@0 | 111 | "omg": { |
michael@0 | 112 | value: { type: "null" }, |
michael@0 | 113 | }, |
michael@0 | 114 | "omgfn": { |
michael@0 | 115 | value: { |
michael@0 | 116 | type: "object", |
michael@0 | 117 | class: "Function", |
michael@0 | 118 | actor: /[a-z]/, |
michael@0 | 119 | }, |
michael@0 | 120 | }, |
michael@0 | 121 | "tamarbuta": { |
michael@0 | 122 | value: { |
michael@0 | 123 | type: "longString", |
michael@0 | 124 | initial: longString.substring(0, |
michael@0 | 125 | DebuggerServer.LONG_STRING_INITIAL_LENGTH), |
michael@0 | 126 | length: longString.length, |
michael@0 | 127 | }, |
michael@0 | 128 | }, |
michael@0 | 129 | "testfoo": { |
michael@0 | 130 | value: false, |
michael@0 | 131 | }, |
michael@0 | 132 | }; |
michael@0 | 133 | } |
michael@0 | 134 | |
michael@0 | 135 | function onConsoleCall(aState, aType, aPacket) |
michael@0 | 136 | { |
michael@0 | 137 | is(aPacket.from, aState.actor, "console API call actor"); |
michael@0 | 138 | |
michael@0 | 139 | info("checking the console API call packet"); |
michael@0 | 140 | |
michael@0 | 141 | checkConsoleAPICall(aPacket.message, { |
michael@0 | 142 | level: "log", |
michael@0 | 143 | filename: /test_object_actor/, |
michael@0 | 144 | functionName: "onAttach", |
michael@0 | 145 | arguments: ["hello", { |
michael@0 | 146 | type: "object", |
michael@0 | 147 | actor: /[a-z]/, |
michael@0 | 148 | }], |
michael@0 | 149 | }); |
michael@0 | 150 | |
michael@0 | 151 | aState.dbgClient.removeListener("consoleAPICall", onConsoleCall); |
michael@0 | 152 | |
michael@0 | 153 | info("inspecting object properties"); |
michael@0 | 154 | let args = aPacket.message.arguments; |
michael@0 | 155 | onProperties = onProperties.bind(null, aState); |
michael@0 | 156 | |
michael@0 | 157 | let client = new ObjectClient(aState.dbgClient, args[1]); |
michael@0 | 158 | client.getPrototypeAndProperties(onProperties); |
michael@0 | 159 | } |
michael@0 | 160 | |
michael@0 | 161 | function onProperties(aState, aResponse) |
michael@0 | 162 | { |
michael@0 | 163 | let props = aResponse.ownProperties; |
michael@0 | 164 | is(Object.keys(props).length, Object.keys(expectedProps).length, |
michael@0 | 165 | "number of enumerable properties"); |
michael@0 | 166 | checkObject(props, expectedProps); |
michael@0 | 167 | |
michael@0 | 168 | expectedProps = []; |
michael@0 | 169 | |
michael@0 | 170 | closeDebugger(aState, function() { |
michael@0 | 171 | SimpleTest.finish(); |
michael@0 | 172 | }); |
michael@0 | 173 | } |
michael@0 | 174 | |
michael@0 | 175 | addEventListener("load", startTest); |
michael@0 | 176 | </script> |
michael@0 | 177 | </body> |
michael@0 | 178 | </html> |