browser_codemirror.js (1139B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 const URI = 7 "chrome://mochitests/content/browser/devtools/client/shared/sourceeditor/" + 8 "test/codemirror/codemirror.html"; 9 10 add_task(async function test() { 11 requestLongerTimeout(3); 12 13 /* 14 * In devtools/client/shared/sourceeditor/test/codemirror/search_test.js there is a test 15 * multilineInsensitiveSlow which assumes an operation takes less than 100ms. 16 * With a precision of 100ms, if we get unlikely and begin execution towards the 17 * end of one spot (e.g. at 95 ms) we will clamp down, take (e.g.) 10ms to execute 18 * and it will appear to take 100ms. 19 * 20 * To avoid this, we hardcode to 2ms of precision. 21 * 22 * In theory we don't need to set the pref for all of CodeMirror, in practice 23 * it seems very difficult to set a pref for just one of the tests. 24 */ 25 await SpecialPowers.pushPrefEnv({ 26 set: [ 27 ["privacy.reduceTimerPrecision", true], 28 ["privacy.resistFingerprinting.reduceTimerPrecision.microseconds", 2000], 29 ], 30 }); 31 32 await runCodeMirrorTest(URI); 33 });