# HG changeset patch # User Tom Ritter # Date 1518457181 21600 # Node ID 312fea6ab87f732916136072f302cd53e2313da3 # Parent 415dd38a8bbeb840d894d7ac35b160e72a58e8ee Bug 1435296 Address test failures caused by bumping timer precision to 2 ms r=baku There are a few different reasons why tests needed updating (not an exhaustive list): - Tests assume that successive operations take place at different times. - Tests assume that an operation took a minimum amount of time. - Tests hardcodes a specific delay. In most cases we hardcode the preference off. In some cases this is the best approach, in others, we would like to improve. The bug for tracking those improvements is Bug 1429648 An improvement that is present in some tests is to hardcode a specific precision reduction that is acceptable based on the confides of the test. (Obviously this needs to be a fix for the test framework and not a requirement on the feature being tested.) In a few places, the test itself can be fixed, for example to no longer require the end time of an operation to be strictly greater than the start time, and allows it to be equal to it. MozReview-Commit-ID: J59c7xQtZZJ diff --git a/browser/base/content/test/general/browser_lastAccessedTab.js b/browser/base/content/test/general/browser_lastAccessedTab.js --- a/browser/base/content/test/general/browser_lastAccessedTab.js +++ b/browser/base/content/test/general/browser_lastAccessedTab.js @@ -15,19 +15,24 @@ function nextStep(fn) { setTimeout(fn, CURRENT_TIME_TOLERANCE_MS + 10); } var originalTab; var newTab; function test() { waitForExplicitFinish(); - - originalTab = gBrowser.selectedTab; - nextStep(step2); + // This test assumes that time passes between operations. But if the precision + // is low enough, and the test fast enough, an operation, and a successive call + // to Date.now() will have the same time value. + SpecialPowers.pushPrefEnv({"set": [["privacy.reduceTimerPrecision", false]]}, + function() { + originalTab = gBrowser.selectedTab; + nextStep(step2); + }); } function step2() { isCurrent(originalTab, "selected tab has the current timestamp"); newTab = BrowserTestUtils.addTab(gBrowser, "about:blank", {skipAnimation: true}); nextStep(step3); } diff --git a/browser/base/content/test/general/browser_storagePressure_notification.js b/browser/base/content/test/general/browser_storagePressure_notification.js --- a/browser/base/content/test/general/browser_storagePressure_notification.js +++ b/browser/base/content/test/general/browser_storagePressure_notification.js @@ -47,16 +47,18 @@ async function testOverUsageThresholdNot await BrowserTestUtils.removeTab(tab); } // Test only displaying notification once within the given interval add_task(async function() { const TEST_NOTIFICATION_INTERVAL_MS = 2000; await SpecialPowers.pushPrefEnv({set: [["browser.storageManager.enabled", true]]}); await SpecialPowers.pushPrefEnv({set: [["browser.storageManager.pressureNotification.minIntervalMS", TEST_NOTIFICATION_INTERVAL_MS]]}); + // Commenting this to see if we really need it + // await SpecialPowers.pushPrefEnv({set: [["privacy.reduceTimerPrecision", false]]}); await notifyStoragePressure(); let notificationbox = document.getElementById("high-priority-global-notificationbox"); let notification = notificationbox.getNotificationWithValue("storage-pressure-notification"); ok(notification instanceof XULElement, "Should display storage pressure notification"); notification.close(); await notifyStoragePressure(); diff --git a/browser/base/content/test/urlbar/browser_autocomplete_enter_race.js b/browser/base/content/test/urlbar/browser_autocomplete_enter_race.js --- a/browser/base/content/test/urlbar/browser_autocomplete_enter_race.js +++ b/browser/base/content/test/urlbar/browser_autocomplete_enter_race.js @@ -11,16 +11,24 @@ add_task(async function setup() { }); await PlacesUtils.keywords.insert({ keyword: "keyword", url: "http://example.com/?q=%s" }); // Needs at least one success. ok(true, "Setup complete"); }); add_task(async function test_keyword() { + // This is set because we see (undiagnosed) test timeouts without it + let timerPrecision = Preferences.get("privacy.reduceTimerPrecision"); + Preferences.set("privacy.reduceTimerPrecision", false); + + registerCleanupFunction(function() { + Preferences.set("privacy.reduceTimerPrecision", timerPrecision); + }); + await promiseAutocompleteResultPopup("keyword bear"); gURLBar.focus(); EventUtils.synthesizeKey("d", {}); EventUtils.synthesizeKey("VK_RETURN", {}); info("wait for the page to load"); await BrowserTestUtils.browserLoaded(gBrowser.selectedTab.linkedBrowser, false, "http://example.com/?q=beard"); }); @@ -93,19 +101,27 @@ add_task(async function test_disabled_ac await cleanup(); }); add_task(async function test_delay() { const TIMEOUT = 10000; // Set a large delay. let delay = Preferences.get("browser.urlbar.delay"); Preferences.set("browser.urlbar.delay", TIMEOUT); + // This may be a real test regression on Bug 1283329, if we can get it to + // fail at a realistic 2ms. + let timerPrecision = Preferences.get("privacy.reduceTimerPrecision"); + Preferences.set("privacy.reduceTimerPrecision", true); + let timerPrecisionUSec = Preferences.get("privacy.resistFingerprinting.reduceTimerPrecision.microseconds"); + Preferences.set("privacy.resistFingerprinting.reduceTimerPrecision.microseconds", 2000); registerCleanupFunction(function() { Preferences.set("browser.urlbar.delay", delay); + Preferences.set("privacy.reduceTimerPrecision", timerPrecision); + Preferences.set("privacy.resistFingerprinting.reduceTimerPrecision.microseconds", timerPrecisionUSec); }); // This is needed to clear the current value, otherwise autocomplete may think // the user removed text from the end. let start = Date.now(); await promiseAutocompleteResultPopup(""); Assert.ok((Date.now() - start) < TIMEOUT); diff --git a/browser/components/extensions/test/browser/browser_ext_sessions_getRecentlyClosed_tabs.js b/browser/components/extensions/test/browser/browser_ext_sessions_getRecentlyClosed_tabs.js --- a/browser/components/extensions/test/browser/browser_ext_sessions_getRecentlyClosed_tabs.js +++ b/browser/components/extensions/test/browser/browser_ext_sessions_getRecentlyClosed_tabs.js @@ -16,16 +16,20 @@ function expectedTabInfo(tab, window) { function checkTabInfo(expected, actual) { for (let prop in expected) { is(actual[prop], expected[prop], `Expected value found for ${prop} of tab object.`); } } add_task(async function test_sessions_get_recently_closed_tabs() { + // Below, the test makes assumptions about the last accessed time of tabs that are + // not true is we execute fast and reduce the timer precision enough + await SpecialPowers.pushPrefEnv({set: [["privacy.reduceTimerPrecision", false]]}); + async function background() { browser.test.onMessage.addListener(async msg => { if (msg == "check-sessions") { let recentlyClosed = await browser.sessions.getRecentlyClosed(); browser.test.sendMessage("recentlyClosed", recentlyClosed); } }); } diff --git a/browser/extensions/formautofill/test/browser/browser_manageCreditCardsDialog.js b/browser/extensions/formautofill/test/browser/browser_manageCreditCardsDialog.js --- a/browser/extensions/formautofill/test/browser/browser_manageCreditCardsDialog.js +++ b/browser/extensions/formautofill/test/browser/browser_manageCreditCardsDialog.js @@ -33,16 +33,17 @@ add_task(async function test_cancelManag await waitForFocusAndFormReady(win); let unloadPromise = BrowserTestUtils.waitForEvent(win, "unload"); EventUtils.synthesizeKey("VK_ESCAPE", {}, win); await unloadPromise; ok(true, "Manage credit cards dialog is closed with ESC key"); }); add_task(async function test_removingSingleAndMultipleCreditCards() { + await SpecialPowers.pushPrefEnv({"set": [["privacy.reduceTimerPrecision", false]]}); await saveCreditCard(TEST_CREDIT_CARD_1); await saveCreditCard(TEST_CREDIT_CARD_2); await saveCreditCard(TEST_CREDIT_CARD_3); let win = window.openDialog(MANAGE_CREDIT_CARDS_DIALOG_URL, null, DIALOG_SIZE); await waitForFocusAndFormReady(win); let selRecords = win.document.querySelector(TEST_SELECTORS.selRecords); @@ -85,16 +86,17 @@ add_task(async function test_creditCards await removeCreditCards([selRecords.options[0].value]); await BrowserTestUtils.waitForEvent(selRecords, "RecordsLoaded"); is(selRecords.length, 0, "Credit card is removed"); win.close(); }); add_task(async function test_showCreditCards() { + await SpecialPowers.pushPrefEnv({"set": [["privacy.reduceTimerPrecision", false]]}); await saveCreditCard(TEST_CREDIT_CARD_1); await saveCreditCard(TEST_CREDIT_CARD_2); await saveCreditCard(TEST_CREDIT_CARD_3); let win = window.openDialog(MANAGE_CREDIT_CARDS_DIALOG_URL, null, DIALOG_SIZE); await waitForFocusAndFormReady(win); let selRecords = win.document.querySelector(TEST_SELECTORS.selRecords); diff --git a/browser/extensions/formautofill/test/mochitest/test_on_address_submission.html b/browser/extensions/formautofill/test/mochitest/test_on_address_submission.html --- a/browser/extensions/formautofill/test/mochitest/test_on_address_submission.html +++ b/browser/extensions/formautofill/test/mochitest/test_on_address_submission.html @@ -30,17 +30,17 @@ let TEST_ADDRESSES = [{ }]; initPopupListener(); // Submit first address for saving. add_task(async function check_storage_after_form_submitted() { // We already verified the first time use case in browser test await SpecialPowers.pushPrefEnv({ - set: [["extensions.formautofill.firstTimeUse", false]], + "set": [["extensions.formautofill.firstTimeUse", false]], }); for (let key in TEST_ADDRESSES[0]) { await setInput("#" + key, TEST_ADDRESSES[0][key]); } clickOnElement("input[type=submit]"); @@ -50,16 +50,18 @@ add_task(async function check_storage_af expectedAddresses[0].timesUsed = 1; let matching = await checkAddresses(expectedAddresses); ok(matching, "Address saved as expected"); delete expectedAddresses[0].timesUsed; }); // Submit another new address. add_task(async function check_storage_after_another_address_submitted() { + await SpecialPowers.pushPrefEnv({"set": [["privacy.reduceTimerPrecision", false]]}); + document.querySelector("form").reset(); for (let key in TEST_ADDRESSES[1]) { await setInput("#" + key, TEST_ADDRESSES[1][key]); } clickOnElement("input[type=submit]"); // The 2nd test address should be on the top since it's the last used one. diff --git a/devtools/client/animationinspector/test/browser_animation_timeline_pause_button_02.js b/devtools/client/animationinspector/test/browser_animation_timeline_pause_button_02.js --- a/devtools/client/animationinspector/test/browser_animation_timeline_pause_button_02.js +++ b/devtools/client/animationinspector/test/browser_animation_timeline_pause_button_02.js @@ -1,21 +1,31 @@ /* vim: set ts=2 et sw=2 tw=80: */ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ /* eslint-disable mozilla/no-arbitrary-setTimeout */ "use strict"; requestLongerTimeout(2); +ChromeUtils.defineModuleGetter(this, "Preferences", + "resource://gre/modules/Preferences.jsm"); // Checks that the play/pause button goes to the right state when the scrubber has reached // the end of the timeline but there are infinite animations playing. add_task(function* () { + // TODO see if this is needed? + // let timerPrecision = Preferences.get("privacy.reduceTimerPrecision"); + // Preferences.set("privacy.reduceTimerPrecision", false); + + // registerCleanupFunction(function () { + // Preferences.set("privacy.reduceTimerPrecision", timerPrecision); + // }); + yield addTab(URL_ROOT + "doc_simple_animation.html"); let {panel, inspector} = yield openAnimationInspector(); let timeline = panel.animationsTimelineComponent; let btn = panel.playTimelineButtonEl; info("Select an infinite animation and wait for the scrubber to reach the end"); yield selectNodeAndWaitForAnimations(".multi", inspector); diff --git a/devtools/client/canvasdebugger/test/browser_profiling-canvas.js b/devtools/client/canvasdebugger/test/browser_profiling-canvas.js --- a/devtools/client/canvasdebugger/test/browser_profiling-canvas.js +++ b/devtools/client/canvasdebugger/test/browser_profiling-canvas.js @@ -32,14 +32,14 @@ function* ifTestingSupported() { is(functionCalls.length, 8, "The number of function call actors is correct."); info("Check the timestamps of function calls"); for (let i = 0; i < functionCalls.length - 1; i += 2) { ok(functionCalls[i].timestamp > 0, "The timestamp of the called function is larger than 0."); ok(functionCalls[i].timestamp < currentTime, "The timestamp has been minus the frame start time."); - ok(functionCalls[i + 1].timestamp > functionCalls[i].timestamp, "The timestamp of the called function is correct."); + ok(functionCalls[i + 1].timestamp >= functionCalls[i].timestamp, "The timestamp of the called function is correct."); } yield removeTab(target.tab); finish(); } diff --git a/devtools/client/canvasdebugger/test/browser_profiling-webgl.js b/devtools/client/canvasdebugger/test/browser_profiling-webgl.js --- a/devtools/client/canvasdebugger/test/browser_profiling-webgl.js +++ b/devtools/client/canvasdebugger/test/browser_profiling-webgl.js @@ -77,11 +77,11 @@ function* ifTestingSupported() { } function testFunctionCallTimestamp(functionCalls, currentTime) { info("Check the timestamps of function calls"); for ( let i = 0; i < functionCalls.length-1; i += 2 ) { ok( functionCalls[i].timestamp > 0, "The timestamp of the called function is larger than 0." ); ok( functionCalls[i].timestamp < currentTime, "The timestamp has been minus the frame start time." ); - ok( functionCalls[i+1].timestamp > functionCalls[i].timestamp, "The timestamp of the called function is correct." ); + ok( functionCalls[i+1].timestamp >= functionCalls[i].timestamp, "The timestamp of the called function is correct." ); } } diff --git a/devtools/client/inspector/markup/test/browser_markup_mutation_02.js b/devtools/client/inspector/markup/test/browser_markup_mutation_02.js --- a/devtools/client/inspector/markup/test/browser_markup_mutation_02.js +++ b/devtools/client/inspector/markup/test/browser_markup_mutation_02.js @@ -4,16 +4,18 @@ "use strict"; // Test that markup-containers in the markup-view do flash when their // corresponding DOM nodes mutate // Have to use the same timer functions used by the inspector. const {clearTimeout} = ChromeUtils.import("resource://gre/modules/Timer.jsm", {}); +ChromeUtils.defineModuleGetter(this, "Preferences", + "resource://gre/modules/Preferences.jsm"); const TEST_URL = URL_ROOT + "doc_markup_flashing.html"; // The test data contains a list of mutations to test. // Each item is an object: // - desc: a description of the test step, for better logging // - mutate: a generator function that should make changes to the content DOM // - attribute: if set, the test will expect the corresponding attribute to @@ -87,16 +89,23 @@ const TEST_DATA = [{ yield testActor.eval(` let root = document.querySelector(".list"); root.removeAttribute("class"); `); } }]; add_task(function* () { + let timerPrecision = Preferences.get("privacy.reduceTimerPrecision"); + Preferences.set("privacy.reduceTimerPrecision", false); + + registerCleanupFunction(function () { + Preferences.set("privacy.reduceTimerPrecision", timerPrecision); + }); + let {inspector, testActor} = yield openInspectorForURL(TEST_URL); // Make sure mutated nodes flash for a very long time so we can more easily // assert they do inspector.markup.CONTAINER_FLASHING_DURATION = 1000 * 60 * 60; info("Getting the root node to test mutations on"); let rootNodeFront = yield getNodeFront(".list", inspector); diff --git a/devtools/client/netmonitor/src/har/test/browser_net_har_copy_all_as_har.js b/devtools/client/netmonitor/src/har/test/browser_net_har_copy_all_as_har.js --- a/devtools/client/netmonitor/src/har/test/browser_net_har_copy_all_as_har.js +++ b/devtools/client/netmonitor/src/har/test/browser_net_har_copy_all_as_har.js @@ -38,18 +38,18 @@ add_task(function* () { // Check out HAR log isnot(har.log, null, "The HAR log must exist"); is(har.log.creator.name, "Firefox", "The creator field must be set"); is(har.log.browser.name, "Firefox", "The browser field must be set"); is(har.log.pages.length, 1, "There must be one page"); is(har.log.entries.length, 1, "There must be one request"); let page = har.log.pages[0]; - ok(page.pageTimings.onContentLoad > 0, "There must be onContentLoad time"); - ok(page.pageTimings.onLoad > 0, "There must be onLoad time"); + ok("onContentLoad" in page.pageTimings, "There must be onContentLoad time"); + ok("onLoad" in page.pageTimings, "There must be onLoad time"); let entry = har.log.entries[0]; is(entry.request.method, "GET", "Check the method"); is(entry.request.url, SIMPLE_URL, "Check the URL"); is(entry.request.headers.length, 9, "Check number of request headers"); is(entry.response.status, 200, "Check response status"); is(entry.response.statusText, "OK", "Check response status text"); is(entry.response.headers.length, 6, "Check number of response headers"); diff --git a/devtools/client/netmonitor/test/browser_net_status-bar.js b/devtools/client/netmonitor/test/browser_net_status-bar.js --- a/devtools/client/netmonitor/test/browser_net_status-bar.js +++ b/devtools/client/netmonitor/test/browser_net_status-bar.js @@ -10,16 +10,18 @@ add_task(async () => { let { tab, monitor } = await initNetMonitor(SIMPLE_URL); info("Starting test... "); let { document, store, windowRequire } = monitor.panelWin; let Actions = windowRequire("devtools/client/netmonitor/src/actions/index"); store.dispatch(Actions.batchEnable(false)); + await SpecialPowers.pushPrefEnv({ "set": [["privacy.reduceTimerPrecision", false]]}); + async function reloadAndWait() { let wait = waitForNetworkEvents(monitor, 1); tab.linkedBrowser.reload(); return wait; } await reloadAndWait(); diff --git a/devtools/client/sourceeditor/test/browser_codemirror.js b/devtools/client/sourceeditor/test/browser_codemirror.js --- a/devtools/client/sourceeditor/test/browser_codemirror.js +++ b/devtools/client/sourceeditor/test/browser_codemirror.js @@ -7,12 +7,29 @@ const URI = "chrome://mochitests/content/browser/devtools/client/" + "sourceeditor/test/codemirror/codemirror.html"; loadHelperScript("helper_codemirror_runner.js"); function test() { requestLongerTimeout(3); waitForExplicitFinish(); - addTab(URI).then(function (tab) { - runCodeMirrorTest(tab.linkedBrowser); - }); + /* + * In devtools/client/sourceeditor/test/codemirror/search_test.js there is a test + * multilineInsensitiveSlow which assumes an operation takes less than 100ms. + * With a precision of 100ms, if we get unlikely and begin execution towards the + * end of one spot (e.g. at 95 ms) we will clamp down, take (e.g.) 10ms to execute + * and it will appear to take 100ms. + * + * To avoid this, we hardcode to 2ms of precision. + * + * In theory we don't need to set the pref for all of CodeMirror, in practice + * it seems very difficult to set a pref for just one of the tests. + */ + SpecialPowers.pushPrefEnv( + { set: [["privacy.reduceTimerPrecision", true], + ["privacy.resistFingerprinting.reduceTimerPrecision.microseconds", 2000]]}, + function () { + addTab(URI).then(function (tab) { + runCodeMirrorTest(tab.linkedBrowser); + }); + }); } diff --git a/devtools/server/tests/browser/browser_perf-samples-01.js b/devtools/server/tests/browser/browser_perf-samples-01.js --- a/devtools/server/tests/browser/browser_perf-samples-01.js +++ b/devtools/server/tests/browser/browser_perf-samples-01.js @@ -9,16 +9,17 @@ "use strict"; // time in ms const WAIT_TIME = 1000; const { PerformanceFront } = require("devtools/shared/fronts/performance"); add_task(function* () { + yield SpecialPowers.pushPrefEnv({"set": [["privacy.reduceTimerPrecision", false]]}); yield addTab(MAIN_DOMAIN + "doc_perf.html"); initDebuggerServer(); let client = new DebuggerClient(DebuggerServer.connectPipe()); let form = yield connectDebuggerClient(client); let front = PerformanceFront(client, form); yield front.connect(); diff --git a/devtools/server/tests/mochitest/memory-helpers.js b/devtools/server/tests/mochitest/memory-helpers.js --- a/devtools/server/tests/mochitest/memory-helpers.js +++ b/devtools/server/tests/mochitest/memory-helpers.js @@ -7,18 +7,21 @@ const Services = require("Services"); const { Task } = require("devtools/shared/task"); const { DebuggerClient } = require("devtools/shared/client/debugger-client"); const { DebuggerServer } = require("devtools/server/main"); const { MemoryFront } = require("devtools/shared/fronts/memory"); // Always log packets when running tests. Services.prefs.setBoolPref("devtools.debugger.log", true); +var gReduceTimePrecision = Services.prefs.getBoolPref("privacy.reduceTimerPrecision"); +Services.prefs.setBoolPref("privacy.reduceTimerPrecision", false); SimpleTest.registerCleanupFunction(function () { Services.prefs.clearUserPref("devtools.debugger.log"); + Services.prefs.setBoolPref("privacy.reduceTimerPrecision", gReduceTimePrecision); }); function startServerAndGetSelectedTabMemory() { DebuggerServer.init(); DebuggerServer.registerAllActors(); let client = new DebuggerClient(DebuggerServer.connectPipe()); return client.connect() diff --git a/docshell/test/chrome/test_bug453650.xul b/docshell/test/chrome/test_bug453650.xul --- a/docshell/test/chrome/test_bug453650.xul +++ b/docshell/test/chrome/test_bug453650.xul @@ -55,29 +55,29 @@ https://bugzilla.mozilla.org/show_bug.cg reflow: function (start, end) { if (interruptible) { ok(false, "expected interruptible reflow"); } else { ok(true, "observed uninterruptible reflow"); } info("times: " + start + ", " + end); - ok(start < end, "reflow start time lower than end time"); + ok(start <= end, "reflow start time lower than end time"); done(); }, reflowInterruptible: function (start, end) { if (!interruptible) { ok(false, "expected uninterruptible reflow"); } else { ok(true, "observed interruptible reflow"); } info("times: " + start + ", " + end); - ok(start < end, "reflow start time lower than end time"); + ok(start <= end, "reflow start time lower than end time"); done(); }, QueryInterface: function (iid) { if (Ci.nsIReflowObserver.equals(iid) || Ci.nsISupportsWeakReference.equals(iid) || Ci.nsISupports.equals(iid)) return this; diff --git a/dom/animation/test/css-animations/test_event-dispatch.html b/dom/animation/test/css-animations/test_event-dispatch.html --- a/dom/animation/test/css-animations/test_event-dispatch.html +++ b/dom/animation/test/css-animations/test_event-dispatch.html @@ -2,14 +2,16 @@
diff --git a/dom/animation/test/css-transitions/test_animation-starttime.html b/dom/animation/test/css-transitions/test_animation-starttime.html --- a/dom/animation/test/css-transitions/test_animation-starttime.html +++ b/dom/animation/test/css-transitions/test_animation-starttime.html @@ -2,15 +2,13 @@
diff --git a/dom/animation/test/document-timeline/test_document-timeline.html b/dom/animation/test/document-timeline/test_document-timeline.html --- a/dom/animation/test/document-timeline/test_document-timeline.html +++ b/dom/animation/test/document-timeline/test_document-timeline.html @@ -2,15 +2,13 @@
diff --git a/dom/animation/test/mozilla/test_transition_finish_on_compositor.html b/dom/animation/test/mozilla/test_transition_finish_on_compositor.html --- a/dom/animation/test/mozilla/test_transition_finish_on_compositor.html +++ b/dom/animation/test/mozilla/test_transition_finish_on_compositor.html @@ -1,14 +1,19 @@
diff --git a/dom/base/test/test_bug403852.html b/dom/base/test/test_bug403852.html --- a/dom/base/test/test_bug403852.html +++ b/dom/base/test/test_bug403852.html @@ -16,20 +16,25 @@ https://bugzilla.mozilla.org/show_bug.cg

 
 
diff --git a/dom/media/test/test_background_video_suspend.html b/dom/media/test/test_background_video_suspend.html --- a/dom/media/test/test_background_video_suspend.html +++ b/dom/media/test/test_background_video_suspend.html @@ -18,19 +18,20 @@ function testDelay(v, start, min) { ok(delay > min, `${v.token} suspended with a delay of ${delay} ms`); } startTest({ desc: 'Test Background Video Suspends', prefs: [ [ "media.test.video-suspend", true ], [ "media.suspend-bkgnd-video.enabled", true ], - // User a short delay to ensure video decode suspend happens before end + // Use a short delay to ensure video decode suspend happens before end // of video. - [ "media.suspend-bkgnd-video.delay-ms", MIN_DELAY ] + [ "media.suspend-bkgnd-video.delay-ms", MIN_DELAY ], + [ "privacy.reduceTimerPrecision", false ] ], tests: gDecodeSuspendTests, runTest: (test, token) => { let v = appendVideoToDoc(test.name, token); manager.started(token); let start; waitUntilPlaying(v) diff --git a/dom/media/tests/mochitest/test_peerConnection_audioContributingSources.html b/dom/media/tests/mochitest/test_peerConnection_audioContributingSources.html --- a/dom/media/tests/mochitest/test_peerConnection_audioContributingSources.html +++ b/dom/media/tests/mochitest/test_peerConnection_audioContributingSources.html @@ -115,14 +115,17 @@ var test; runNetworkTest(function(options) { test = new PeerConnectionTest(options); test.chain.insertAfter("PC_REMOTE_WAIT_FOR_MEDIA_FLOW", [testGetContributingSources]); test.setMediaConstraints([{audio: true}], [{audio: true}]); test.pcLocal.audioElementsOnly = true; - test.run(); + SpecialPowers.pushPrefEnv( + { "set": [["privacy.reduceTimerPrecision", false]]}, function() { + test.run(); + }); }); diff --git a/dom/performance/tests/test_performance_user_timing.html b/dom/performance/tests/test_performance_user_timing.html --- a/dom/performance/tests/test_performance_user_timing.html +++ b/dom/performance/tests/test_performance_user_timing.html @@ -29,17 +29,21 @@ is(performance.getEntriesByType("mark").length, 0, "clearing performance mark entries"); is(performance.getEntriesByType("measure").length, 0, "clearing performance measure entries"); steps[i](); } catch(ex) { ok(false, "Caught exception", ex); } } + SpecialPowers.setBoolPref("privacy.reduceTimerPrecision", reduceTimePrecisionPrevPrefValue); SimpleTest.finish(); } + var reduceTimePrecisionPrevPrefValue = SpecialPowers.getBoolPref("privacy.reduceTimerPrecision"); + SpecialPowers.setBoolPref("privacy.reduceTimerPrecision", false); + SimpleTest.waitForExplicitFinish(); addLoadEvent(next); diff --git a/dom/performance/tests/test_sharedWorker_performance_user_timing.html b/dom/performance/tests/test_sharedWorker_performance_user_timing.html --- a/dom/performance/tests/test_sharedWorker_performance_user_timing.html +++ b/dom/performance/tests/test_sharedWorker_performance_user_timing.html @@ -10,18 +10,21 @@ diff --git a/dom/performance/tests/test_timeOrigin.html b/dom/performance/tests/test_timeOrigin.html --- a/dom/performance/tests/test_timeOrigin.html +++ b/dom/performance/tests/test_timeOrigin.html @@ -47,22 +47,31 @@ function testSharedWorker() { ok (e.data.now + e.data.timeOrigin > now + performance.timeOrigin, "Comparing worker.now and window.now"); next(); } } var tests = [ testBasic, testWorker, testSharedWorker ]; function next() { if (!tests.length) { + SpecialPowers.setBoolPref("privacy.reduceTimerPrecision", reduceTimePrecisionPrevPrefValue); SimpleTest.finish(); return; } var test = tests.shift(); test(); } SimpleTest.waitForExplicitFinish(); + +// It is a known issue that comparing time between a worker and a window +// when timer clamping is in effect may cause time to go backwards. +// Do not run this test with this preference set. For large values of +// clamping you will see failures. For small values, it is intermitant. +var reduceTimePrecisionPrevPrefValue = SpecialPowers.getBoolPref("privacy.reduceTimerPrecision"); +SpecialPowers.setBoolPref("privacy.reduceTimerPrecision", false); + addLoadEvent(next); diff --git a/dom/performance/tests/test_worker_performance_entries.html.1435296-3.later b/dom/performance/tests/test_worker_performance_entries.html.1435296-3.later new file mode 100644 --- /dev/null +++ b/dom/performance/tests/test_worker_performance_entries.html.1435296-3.later @@ -0,0 +1,35 @@ +--- test_worker_performance_entries.html ++++ test_worker_performance_entries.html +@@ -6,24 +6,32 @@ + PerformanceResouceTiming in workers + + + + + diff --git a/dom/performance/tests/test_worker_performance_now.html b/dom/performance/tests/test_worker_performance_now.html --- a/dom/performance/tests/test_worker_performance_now.html +++ b/dom/performance/tests/test_worker_performance_now.html @@ -6,19 +6,24 @@ Validate Interfaces Exposed to Workers diff --git a/dom/smil/test/test_smilTimeEvents.xhtml b/dom/smil/test/test_smilTimeEvents.xhtml --- a/dom/smil/test/test_smilTimeEvents.xhtml +++ b/dom/smil/test/test_smilTimeEvents.xhtml @@ -232,18 +232,23 @@ function handleOnEnd(evt) function sanityCheckEvent(evt) { is(evt.target, gAnim, "Unexpected event target"); is(evt.currentTarget, gAnim, "Unexpected event current target"); is(evt.eventPhase, evt.AT_TARGET); is(evt.bubbles, false, "Event should not bubble"); is(evt.cancelable, false, "Event should not be cancelable"); if (SpecialPowers.getBoolPref("dom.event.highrestimestamp.enabled")) { + var lessThanOrEqualsAllowed = SpecialPowers.getBoolPref("privacy.reduceTimerPrecision"); var now = window.performance.now(); - ok(evt.timeStamp > 0 && evt.timeStamp < now, + ok(evt.timeStamp > 0 && + ( + (evt.timeStamp < now && !lessThanOrEqualsAllowed) || + (evt.timeStamp <= now && lessThanOrEqualsAllowed) + ), "Event timeStamp (" + evt.timeStamp + ") should be > 0 but " + "before the current time (" + now + ")"); } else { is(evt.timeStamp, 0, "Event timeStamp should be 0"); } ok(evt.view !== null, "Event view not set"); } diff --git a/dom/tests/mochitest/ajax/jquery/test_jQuery.html b/dom/tests/mochitest/ajax/jquery/test_jQuery.html --- a/dom/tests/mochitest/ajax/jquery/test_jQuery.html +++ b/dom/tests/mochitest/ajax/jquery/test_jQuery.html @@ -1,15 +1,24 @@ Test for jQuery + diff --git a/dom/tests/mochitest/general/test_performance_now.html b/dom/tests/mochitest/general/test_performance_now.html --- a/dom/tests/mochitest/general/test_performance_now.html +++ b/dom/tests/mochitest/general/test_performance_now.html @@ -9,16 +9,18 @@ diff --git a/dom/tests/mochitest/general/test_resource_timing.html b/dom/tests/mochitest/general/test_resource_timing.html --- a/dom/tests/mochitest/general/test_resource_timing.html +++ b/dom/tests/mochitest/general/test_resource_timing.html @@ -15,17 +15,19 @@ https://bugzilla.mozilla.org/show_bug.cg