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 | // |reftest| skip-if(!xulRuntime.shell||Android) slow -- bug 504632 |
michael@0 | 2 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 3 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | //----------------------------------------------------------------------------- |
michael@0 | 8 | var BUGNUMBER = 456826; |
michael@0 | 9 | var summary = 'Do not assert with JIT during OOM'; |
michael@0 | 10 | var actual = 'No Crash'; |
michael@0 | 11 | var expect = 'No Crash'; |
michael@0 | 12 | |
michael@0 | 13 | |
michael@0 | 14 | //----------------------------------------------------------------------------- |
michael@0 | 15 | test(); |
michael@0 | 16 | //----------------------------------------------------------------------------- |
michael@0 | 17 | |
michael@0 | 18 | function test() |
michael@0 | 19 | { |
michael@0 | 20 | enterFunc ('test'); |
michael@0 | 21 | printBugNumber(BUGNUMBER); |
michael@0 | 22 | printStatus (summary); |
michael@0 | 23 | |
michael@0 | 24 | jit(true); |
michael@0 | 25 | |
michael@0 | 26 | if (typeof gcparam != 'undefined') |
michael@0 | 27 | { |
michael@0 | 28 | gc(); |
michael@0 | 29 | gc(); |
michael@0 | 30 | gcparam("maxBytes", gcparam("gcBytes") + 4*1024); |
michael@0 | 31 | expectExitCode(5); |
michael@0 | 32 | } |
michael@0 | 33 | |
michael@0 | 34 | const numRows = 600; |
michael@0 | 35 | const numCols = 600; |
michael@0 | 36 | var scratch = {}; |
michael@0 | 37 | var scratchZ = {}; |
michael@0 | 38 | |
michael@0 | 39 | function complexMult(a, b) { |
michael@0 | 40 | var newr = a.r * b.r - a.i * b.i; |
michael@0 | 41 | var newi = a.r * b.i + a.i * b.r; |
michael@0 | 42 | scratch.r = newr; |
michael@0 | 43 | scratch.i = newi; |
michael@0 | 44 | return scratch; |
michael@0 | 45 | } |
michael@0 | 46 | |
michael@0 | 47 | function complexAdd(a, b) { |
michael@0 | 48 | scratch.r = a.r + b.r; |
michael@0 | 49 | scratch.i = a.i + b.i; |
michael@0 | 50 | return scratch; |
michael@0 | 51 | } |
michael@0 | 52 | |
michael@0 | 53 | function abs(a) { |
michael@0 | 54 | return Math.sqrt(a.r * a.r + a.i * a.i); |
michael@0 | 55 | } |
michael@0 | 56 | |
michael@0 | 57 | function computeEscapeSpeed(c) { |
michael@0 | 58 | scratchZ.r = scratchZ.i = 0; |
michael@0 | 59 | const scaler = 5; |
michael@0 | 60 | const threshold = (colors.length - 1) * scaler + 1; |
michael@0 | 61 | for (var i = 1; i < threshold; ++i) { |
michael@0 | 62 | scratchZ = complexAdd(c, complexMult(scratchZ, scratchZ)); |
michael@0 | 63 | if (scratchZ.r * scratchZ.r + scratchZ.i * scratchZ.i > 4) { |
michael@0 | 64 | return Math.floor((i - 1) / scaler) + 1; |
michael@0 | 65 | } |
michael@0 | 66 | } |
michael@0 | 67 | return 0; |
michael@0 | 68 | } |
michael@0 | 69 | |
michael@0 | 70 | const colorStrings = [ |
michael@0 | 71 | "black", |
michael@0 | 72 | "green", |
michael@0 | 73 | "blue", |
michael@0 | 74 | "red", |
michael@0 | 75 | "purple", |
michael@0 | 76 | "orange", |
michael@0 | 77 | "cyan", |
michael@0 | 78 | "yellow", |
michael@0 | 79 | "magenta", |
michael@0 | 80 | "brown", |
michael@0 | 81 | "pink", |
michael@0 | 82 | "chartreuse", |
michael@0 | 83 | "darkorange", |
michael@0 | 84 | "crimson", |
michael@0 | 85 | "gray", |
michael@0 | 86 | "deeppink", |
michael@0 | 87 | "firebrick", |
michael@0 | 88 | "lavender", |
michael@0 | 89 | "lawngreen", |
michael@0 | 90 | "lightsalmon", |
michael@0 | 91 | "lime", |
michael@0 | 92 | "goldenrod" |
michael@0 | 93 | ]; |
michael@0 | 94 | |
michael@0 | 95 | var colors = []; |
michael@0 | 96 | |
michael@0 | 97 | function createMandelSet(realRange, imagRange) { |
michael@0 | 98 | var start = new Date(); |
michael@0 | 99 | |
michael@0 | 100 | // Set up our colors |
michael@0 | 101 | for each (var color in colorStrings) { |
michael@0 | 102 | var [r, g, b] = [0, 0, 0]; |
michael@0 | 103 | colors.push([r, g, b, 0xff]); |
michael@0 | 104 | } |
michael@0 | 105 | |
michael@0 | 106 | var realStep = (realRange.max - realRange.min)/numCols; |
michael@0 | 107 | var imagStep = (imagRange.min - imagRange.max)/numRows; |
michael@0 | 108 | for (var i = 0, curReal = realRange.min; |
michael@0 | 109 | i < numCols; |
michael@0 | 110 | ++i, curReal += realStep) { |
michael@0 | 111 | for (var j = 0, curImag = imagRange.max; |
michael@0 | 112 | j < numRows; |
michael@0 | 113 | ++j, curImag += imagStep) { |
michael@0 | 114 | var c = { r: curReal, i: curImag } |
michael@0 | 115 | var n = computeEscapeSpeed(c); |
michael@0 | 116 | } |
michael@0 | 117 | } |
michael@0 | 118 | print(Date.now() - start); |
michael@0 | 119 | } |
michael@0 | 120 | |
michael@0 | 121 | var realRange = { min: -2.1, max: 2 }; |
michael@0 | 122 | var imagRange = { min: -2, max: 2 }; |
michael@0 | 123 | createMandelSet(realRange, imagRange); |
michael@0 | 124 | |
michael@0 | 125 | jit(false); |
michael@0 | 126 | |
michael@0 | 127 | reportCompare(expect, actual, summary); |
michael@0 | 128 | |
michael@0 | 129 | exitFunc ('test'); |
michael@0 | 130 | } |