diff --git a/browser/base/content/tabbrowser.xml b/browser/base/content/tabbrowser.xml index 9398214966b..56a2a9b096c 100644 --- a/browser/base/content/tabbrowser.xml +++ b/browser/base/content/tabbrowser.xml @@ -1265,7 +1265,7 @@ notificationbox.appendChild(stack); var position = this.tabs.length - 1; - var uniqueId = "panel" + Date.now() + position; + var uniqueId = "panel" + Math.floor(Date.now()) + position; notificationbox.id = uniqueId; t.linkedPanel = uniqueId; t.linkedBrowser = b; @@ -2408,7 +2408,7 @@ this.mCurrentTab = this.tabContainer.firstChild; document.addEventListener("keypress", this, false); - var uniqueId = "panel" + Date.now(); + var uniqueId = "panel" + Math.floor(Date.now()); this.mPanelContainer.childNodes[0].id = uniqueId; this.mCurrentTab.linkedPanel = uniqueId; this.mCurrentTab._tPos = 0; diff --git a/browser/base/content/test/browser_inspector_domPanel.js b/browser/base/content/test/browser_inspector_domPanel.js index 4d3f80fcd7c..aed83263c43 100644 --- a/browser/base/content/test/browser_inspector_domPanel.js +++ b/browser/base/content/test/browser_inspector_domPanel.js @@ -65,25 +65,25 @@ function createDocument() function nodeGenerator() { let body = doc.body; - newProperty = "rand" + Date.now(); + newProperty = "rand" + Math.floor(Date.now()); body[newProperty] = Math.round(Math.random() * 100); InspectorUI.inspectNode(body); yield; let h1 = doc.querySelector("h1"); - newProperty = "rand2" + Date.now(); + newProperty = "rand2" + Math.floor(Date.now()); h1[newProperty] = "test" + Math.random(); InspectorUI.inspectNode(h1); yield; let first = doc.getElementById("first"); - newProperty = "rand3" + Date.now(); + newProperty = "rand3" + Math.floor(Date.now()); first[newProperty] = null; InspectorUI.inspectNode(first); yield; let closing = doc.getElementById("closing"); - newProperty = "bazbaz" + Date.now(); + newProperty = "bazbaz" + Math.floor(Date.now()); closing[newProperty] = false; InspectorUI.inspectNode(closing); yield; diff --git a/browser/components/places/tests/unit/test_placesTxn.js b/browser/components/places/tests/unit/test_placesTxn.js index df6c16d3769..9519bfb0739 100644 --- a/browser/components/places/tests/unit/test_placesTxn.js +++ b/browser/components/places/tests/unit/test_placesTxn.js @@ -100,6 +100,11 @@ bmsvc.addObserver(observer, false); var bmStartIndex = 0; // main + +function time() { + return (new Date()).getTime(); +} + function run_test() { // get bookmarks root index var root = bmsvc.bookmarksMenuFolder; @@ -537,7 +542,7 @@ function run_test() { expires: Ci.nsIAnnotationService.EXPIRE_NEVER }; var hs = Cc["@mozilla.org/browser/nav-history-service;1"]. getService(Ci.nsINavHistoryService); - hs.addVisit(uri("http://www.mozilla.org/"), Date.now() * 1000, null, + hs.addVisit(uri("http://www.mozilla.org/"), time() * 1000, null, hs.TRANSITION_TYPED, false, 0); var genPageAnnoTxn = ptSvc.setPageAnnotation(uri("http://www.mozilla.org/"), pageAnnoObj); genPageAnnoTxn.doTransaction(); @@ -612,7 +617,7 @@ function run_test() { // Test editing item date added var oldAdded = bmsvc.getItemDateAdded(bkmk1Id); - var newAdded = Date.now(); + var newAdded = time(); var eidaTxn = ptSvc.editItemDateAdded(bkmk1Id, newAdded); eidaTxn.doTransaction(); do_check_eq(newAdded, bmsvc.getItemDateAdded(bkmk1Id)); @@ -621,7 +626,7 @@ function run_test() { // Test editing item last modified var oldModified = bmsvc.getItemLastModified(bkmk1Id); - var newModified = Date.now(); + var newModified = time(); var eilmTxn = ptSvc.editItemLastModified(bkmk1Id, newModified); eilmTxn.doTransaction(); do_check_eq(newModified, bmsvc.getItemLastModified(bkmk1Id)); @@ -729,7 +734,7 @@ function run_test() { // Test creating an item with child transactions. var childTxns = []; - var newDateAdded = Date.now() - 20000; + var newDateAdded = time() - 20000; childTxns.push(ptSvc.editItemDateAdded(null, newDateAdded)); var itemChildAnnoObj = { name: "testAnno/testInt", type: Ci.nsIAnnotationService.TYPE_INT32, diff --git a/browser/components/sessionstore/src/nsSessionStore.js b/browser/components/sessionstore/src/nsSessionStore.js index 9ac5e47a8f7..abc3aa1f360 100644 --- a/browser/components/sessionstore/src/nsSessionStore.js +++ b/browser/components/sessionstore/src/nsSessionStore.js @@ -713,7 +713,7 @@ SessionStoreService.prototype = { return; // assign it a unique identifier (timestamp) - aWindow.__SSi = "window" + Date.now(); + aWindow.__SSi = "window" + Math.floor(Date.now()); // and create its data object this._windows[aWindow.__SSi] = { tabs: [], selected: 0, _closedTabs: [] }; @@ -3751,7 +3751,7 @@ SessionStoreService.prototype = { // Assign a unique ID to correlate the window to be opened with the // remaining data window.__lastSessionWindowID = pinnedWindowState.__lastSessionWindowID - = "" + Date.now() + Math.random(); + = "" + Math.floor(Date.now()) + Math.random(); // Extract the cookies that belong with each pinned tab this._splitCookiesFromWindow(window, pinnedWindowState); diff --git a/browser/components/sessionstore/test/browser/browser_248970_b.js b/browser/components/sessionstore/test/browser/browser_248970_b.js index a05c98ad3ce..99df81792f3 100644 --- a/browser/components/sessionstore/test/browser/browser_248970_b.js +++ b/browser/components/sessionstore/test/browser/browser_248970_b.js @@ -51,7 +51,7 @@ function test() { filePath = file.path; let fieldList = { - "//input[@name='input']": Date.now().toString(), + "//input[@name='input']": Math.floor(Date.now()).toString(), "//input[@name='spaced 1']": Math.random().toString(), "//input[3]": "three", "//input[@type='checkbox']": true, diff --git a/browser/components/sessionstore/test/browser/browser_345898.js b/browser/components/sessionstore/test/browser/browser_345898.js index 9b4a6534dc4..1d1bde0f629 100644 --- a/browser/components/sessionstore/test/browser/browser_345898.js +++ b/browser/components/sessionstore/test/browser/browser_345898.js @@ -78,8 +78,8 @@ function test() { "Invalid window for setWindowValue throws"); ok(test(function() ss.deleteWindowValue({}, "")), "Invalid window for deleteWindowValue throws"); - ok(test(function() ss.deleteWindowValue(window, Date.now().toString())), + ok(test(function() ss.deleteWindowValue(window, Math.floor(Date.now()).toString())), "Nonexistent value for deleteWindowValue throws"); - ok(test(function() ss.deleteTabValue(gBrowser.selectedTab, Date.now().toString())), + ok(test(function() ss.deleteTabValue(gBrowser.selectedTab, Math.floor(Date.now()).toString())), "Nonexistent value for deleteTabValue throws"); } diff --git a/browser/components/sessionstore/test/browser/browser_346337.js b/browser/components/sessionstore/test/browser/browser_346337.js index e1e36806d73..ae4d9f1509d 100644 --- a/browser/components/sessionstore/test/browser/browser_346337.js +++ b/browser/components/sessionstore/test/browser/browser_346337.js @@ -51,7 +51,7 @@ function test() { filePath2 = file.path; let fieldList = { - "//input[@name='input']": Date.now().toString(), + "//input[@name='input']": Math.floor(Date.now()).toString(), "//input[@name='spaced 1']": Math.random().toString(), "//input[3]": "three", "//input[@type='checkbox']": true, diff --git a/browser/components/sessionstore/test/browser/browser_350525.js b/browser/components/sessionstore/test/browser/browser_350525.js index 05100c58c3b..399c1f75457 100644 --- a/browser/components/sessionstore/test/browser/browser_350525.js +++ b/browser/components/sessionstore/test/browser/browser_350525.js @@ -24,7 +24,7 @@ function test() { //////////////////////////// // setWindowValue, et al. // //////////////////////////// - let key = "Unique name: " + Date.now(); + let key = "Unique name: " + Math.floor(Date.now()); let value = "Unique value: " + Math.random(); // test adding @@ -43,7 +43,7 @@ function test() { // setTabValue, et al. // ///////////////////////// key = "Unique name: " + Math.random(); - value = "Unique value: " + Date.now(); + value = "Unique value: " + Math.floor(Date.now()); let tab = tabbrowser.addTab(); tab.linkedBrowser.stop(); diff --git a/browser/components/sessionstore/test/browser/browser_393716.js b/browser/components/sessionstore/test/browser/browser_393716.js index 83bc8ff3f59..e30002def32 100644 --- a/browser/components/sessionstore/test/browser/browser_393716.js +++ b/browser/components/sessionstore/test/browser/browser_393716.js @@ -13,7 +13,7 @@ function test() { ///////////////// // getTabState // ///////////////// - let key = "Unique key: " + Date.now(); + let key = "Unique key: " + Math.floor(Date.now()); let value = "Unique value: " + Math.random(); let testURL = "about:config"; @@ -44,7 +44,7 @@ function test() { ////////////////////////////////// let key2 = "key2"; let value2 = "Value " + Math.random(); - let value3 = "Another value: " + Date.now(); + let value3 = "Another value: " + Math.floor(Date.now()); let state = { entries: [{ url: testURL }], extData: { key2: value2 } }; // create a new tab diff --git a/browser/components/sessionstore/test/browser/browser_394759.js b/browser/components/sessionstore/test/browser/browser_394759.js index abd73b93664..00d91e67aa3 100644 --- a/browser/components/sessionstore/test/browser/browser_394759.js +++ b/browser/components/sessionstore/test/browser/browser_394759.js @@ -60,7 +60,7 @@ function test() { let testURL = "about:config"; let uniqueKey = "bug 394759"; - let uniqueValue = "unik" + Date.now(); + let uniqueValue = "unik" + Math.floor(Date.now()); let uniqueText = "pi != " + Math.random(); diff --git a/browser/components/sessionstore/test/browser/browser_394759_privatebrowsing.js b/browser/components/sessionstore/test/browser/browser_394759_privatebrowsing.js index 6ea99ed00b6..d71dab5033f 100644 --- a/browser/components/sessionstore/test/browser/browser_394759_privatebrowsing.js +++ b/browser/components/sessionstore/test/browser/browser_394759_privatebrowsing.js @@ -105,7 +105,7 @@ function continue_test() { is(closedWindowCount, 0, "Correctly set window count"); // Prevent VM timers issues, cache now and increment it manually. - let now = Date.now(); + let now = Math.floor(Date.now()); const TESTS = [ { url: "about:config", key: "bug 394759 Non-PB", diff --git a/browser/components/sessionstore/test/browser/browser_448741.js b/browser/components/sessionstore/test/browser/browser_448741.js index b6c098e8f50..605daa46e60 100644 --- a/browser/components/sessionstore/test/browser/browser_448741.js +++ b/browser/components/sessionstore/test/browser/browser_448741.js @@ -42,7 +42,7 @@ function test() { waitForExplicitFinish(); let uniqueName = "bug 448741"; - let uniqueValue = "as good as unique: " + Date.now(); + let uniqueValue = "as good as unique: " + Math.floor(Date.now()); // set a unique value on a new, blank tab var tab = gBrowser.addTab(); diff --git a/browser/components/sessionstore/test/browser/browser_459906.js b/browser/components/sessionstore/test/browser/browser_459906.js index 2886385a80a..8290bca200a 100644 --- a/browser/components/sessionstore/test/browser/browser_459906.js +++ b/browser/components/sessionstore/test/browser/browser_459906.js @@ -41,7 +41,7 @@ function test() { let testURL = "http://mochi.test:8888/browser/" + "browser/components/sessionstore/test/browser/browser_459906_sample.html"; - let uniqueValue = "Unique: " + Date.now(); + let uniqueValue = "Unique: " + Math.floor(Date.now()); var frameCount = 0; let tab = gBrowser.addTab(testURL); diff --git a/browser/components/sessionstore/test/browser/browser_465215.js b/browser/components/sessionstore/test/browser/browser_465215.js index 81a2403a439..634e8b38277 100644 --- a/browser/components/sessionstore/test/browser/browser_465215.js +++ b/browser/components/sessionstore/test/browser/browser_465215.js @@ -41,7 +41,7 @@ function test() { waitForExplicitFinish(); let uniqueName = "bug 465215"; - let uniqueValue1 = "as good as unique: " + Date.now(); + let uniqueValue1 = "as good as unique: " + Math.floor(Date.now()); let uniqueValue2 = "as good as unique: " + Math.random(); // set a unique value on a new, blank tab diff --git a/browser/components/sessionstore/test/browser/browser_465223.js b/browser/components/sessionstore/test/browser/browser_465223.js index 6e39b20debc..65ce11c1717 100644 --- a/browser/components/sessionstore/test/browser/browser_465223.js +++ b/browser/components/sessionstore/test/browser/browser_465223.js @@ -54,7 +54,7 @@ function test() { let uniqueKey1 = "bug 465223.1"; let uniqueKey2 = "bug 465223.2"; - let uniqueValue1 = "unik" + Date.now(); + let uniqueValue1 = "unik" + Math.floor(Date.now()); let uniqueValue2 = "pi != " + Math.random(); // open a window and set a value on it diff --git a/browser/components/sessionstore/test/browser/browser_476161.js b/browser/components/sessionstore/test/browser/browser_476161.js index a92c9737fdc..e8d37aa6560 100644 --- a/browser/components/sessionstore/test/browser/browser_476161.js +++ b/browser/components/sessionstore/test/browser/browser_476161.js @@ -47,7 +47,7 @@ function test() { let doc = tab.linkedBrowser.contentDocument; doc.getElementById("modify1").value += Math.random(); - doc.getElementById("modify2").value += " " + Date.now(); + doc.getElementById("modify2").value += " " + Math.floor(Date.now()); let tab2 = gBrowser.duplicateTab(tab); tab2.linkedBrowser.addEventListener("load", function(aEvent) { diff --git a/browser/components/sessionstore/test/browser/browser_477657.js b/browser/components/sessionstore/test/browser/browser_477657.js index 68b4f3e1fe0..1f449e4540f 100644 --- a/browser/components/sessionstore/test/browser/browser_477657.js +++ b/browser/components/sessionstore/test/browser/browser_477657.js @@ -67,7 +67,7 @@ function test() { }] }; let uniqueKey = "bug 477657"; - let uniqueValue = "unik" + Date.now(); + let uniqueValue = "unik" + Math.floor(Date.now()); ss.setWindowValue(newWin, uniqueKey, uniqueValue); is(ss.getWindowValue(newWin, uniqueKey), uniqueValue, diff --git a/browser/components/sessionstore/test/browser/browser_524745.js b/browser/components/sessionstore/test/browser/browser_524745.js index 0d10c7998ac..c9ac386d8d6 100644 --- a/browser/components/sessionstore/test/browser/browser_524745.js +++ b/browser/components/sessionstore/test/browser/browser_524745.js @@ -52,7 +52,7 @@ function test() { let ss = Cc["@mozilla.org/browser/sessionstore;1"]. getService(Ci.nsISessionStore); let uniqKey = "bug524745"; - let uniqVal = Date.now(); + let uniqVal = Math.floor(Date.now()); waitForExplicitFinish(); diff --git a/browser/components/sessionstore/test/browser/browser_586068-cascaded_restore.js b/browser/components/sessionstore/test/browser/browser_586068-cascaded_restore.js index ef6122bd1c2..0c823e39039 100644 --- a/browser/components/sessionstore/test/browser/browser_586068-cascaded_restore.js +++ b/browser/components/sessionstore/test/browser/browser_586068-cascaded_restore.js @@ -761,5 +761,5 @@ function countTabs() { } function r() { - return "" + Date.now() + Math.random(); + return "" + Math.floor(Date.now()) + Math.random(); } diff --git a/browser/components/sessionstore/test/browser/browser_590268.js b/browser/components/sessionstore/test/browser/browser_590268.js index a44666c49a9..bdcca3a435f 100644 --- a/browser/components/sessionstore/test/browser/browser_590268.js +++ b/browser/components/sessionstore/test/browser/browser_590268.js @@ -1,4 +1,5 @@ /* ***** BEGIN LICENSE BLOCK ***** + * * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version @@ -173,5 +174,5 @@ function test() { // Helper function to create a random value function r() { - return "" + Date.now() + Math.random(); + return "" + Math.floor(Date.now()) + Math.random(); } diff --git a/browser/components/sessionstore/test/browser/browser_607016.js b/browser/components/sessionstore/test/browser/browser_607016.js index 7b2e93c0288..d70a6337b8b 100644 --- a/browser/components/sessionstore/test/browser/browser_607016.js +++ b/browser/components/sessionstore/test/browser/browser_607016.js @@ -150,5 +150,5 @@ function test() { // Helper function to create a random value function r() { - return "" + Date.now() + Math.random(); + return "" + Math.floor(Date.now()) + Math.random(); } diff --git a/browser/components/sessionstore/test/browser/head.js b/browser/components/sessionstore/test/browser/head.js index 6aca5141445..283943b1890 100644 --- a/browser/components/sessionstore/test/browser/head.js +++ b/browser/components/sessionstore/test/browser/head.js @@ -100,5 +100,5 @@ function waitForSaveState(aSaveStateCallback) { }; function r() { - return Date.now() + Math.random(); + return Math.floor(Date.now()) + Math.random(); } diff --git a/content/base/test/test_CrossSiteXHR_cache.html b/content/base/test/test_CrossSiteXHR_cache.html index 9e3f1fe42a4..d51e9130196 100644 --- a/content/base/test/test_CrossSiteXHR_cache.html +++ b/content/base/test/test_CrossSiteXHR_cache.html @@ -423,7 +423,7 @@ function runTest() { "file_CrossSiteXHR_cache_server.sjs?"; setStateURL = baseURL + "setState="; - var unique = Date.now(); + var unique = Math.floor(Date.now()); for each (test in tests) { if (test.newTest) { unique++; diff --git a/content/html/content/test/test_bug209275.xhtml b/content/html/content/test/test_bug209275.xhtml index ef53e897bf6..56e7c326e42 100644 --- a/content/html/content/test/test_bug209275.xhtml +++ b/content/html/content/test/test_bug209275.xhtml @@ -113,7 +113,7 @@ function run() { const unvisitedFill = "rgb(0, 0, 255)"; const visitedFill = "rgb(128, 0, 128)"; - const rand = Date.now() + "-" + Math.random(); + const rand = Math.floor(Date.now()) + "-" + Math.random(); // Now we can start the tests in earnest. diff --git a/content/html/content/test/test_bug481335.xhtml b/content/html/content/test/test_bug481335.xhtml index 525ff0e11e5..35cfa021bea 100644 --- a/content/html/content/test/test_bug481335.xhtml +++ b/content/html/content/test/test_bug481335.xhtml @@ -26,7 +26,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=481335 /** Test for Bug 481335 **/ SimpleTest.waitForExplicitFinish(); -var rand = Date.now() + "-" + Math.random(); +var rand = Math.floor(Date.now()) + "-" + Math.random(); is($("t").href, "", "Unexpected href before set"); diff --git a/docshell/test/bug413310-post.sjs b/docshell/test/bug413310-post.sjs index b8d85dd3cf2..70234a7ae99 100644 --- a/docshell/test/bug413310-post.sjs +++ b/docshell/test/bug413310-post.sjs @@ -2,6 +2,6 @@ function handleRequest(request, response) { response.setHeader("Content-Type", "text/html"); response.write("" + request.method + " " + - Date.now() + + Math.floor(Date.now()) + ""); } diff --git a/dom/tests/mochitest/whatwg/test_bug500328.html b/dom/tests/mochitest/whatwg/test_bug500328.html index 962a360e93c..299eda2af33 100644 --- a/dom/tests/mochitest/whatwg/test_bug500328.html +++ b/dom/tests/mochitest/whatwg/test_bug500328.html @@ -346,7 +346,7 @@ function runTest() { statusMsg("Done loading file_bug500328_1.html for the second time."); var ifLink = iframeCw.document.getElementById("link-anchor1"); - var rand = Date.now() + "-" + Math.random(); + var rand = Math.floor(Date.now()) + "-" + Math.random(); ifLink.href = rand; // Poll the document until the link has the correct color, or this test times diff --git a/extensions/cookie/test/unit/test_permmanager_expiration.js b/extensions/cookie/test/unit/test_permmanager_expiration.js index 6a97b6e1b42..c0ffe5c2605 100644 --- a/extensions/cookie/test/unit/test_permmanager_expiration.js +++ b/extensions/cookie/test/unit/test_permmanager_expiration.js @@ -21,7 +21,7 @@ function do_run_test() { let pm = Services.permissions; let permURI = NetUtil.newURI("http://example.com"); - let now = Number(Date.now()); + let now = Math.floor(Date.now()); // add a permission with *now* expiration pm.add(permURI, "test/expiration-perm-exp", 1, pm.EXPIRE_TIME, now); diff --git a/extensions/cookie/test/unit/test_permmanager_notifications.js b/extensions/cookie/test/unit/test_permmanager_notifications.js index 7e9f25313de..66ad16d18a3 100644 --- a/extensions/cookie/test/unit/test_permmanager_notifications.js +++ b/extensions/cookie/test/unit/test_permmanager_notifications.js @@ -22,7 +22,7 @@ function do_run_test() { let pm = Services.permissions; let permURI = NetUtil.newURI("http://example.com"); - let now = Number(Date.now()); + let now = (new Date()).getTime(); let permType = "test/expiration-perm"; let observer = new permission_observer(test_generator, now, permType); diff --git a/js/src/jsdate.cpp b/js/src/jsdate.cpp index e7fd47eb461..ef65e527fdf 100644 --- a/js/src/jsdate.cpp +++ b/js/src/jsdate.cpp @@ -1189,10 +1189,16 @@ NowAsMillis() return (jsdouble) (PRMJ_Now() / PRMJ_USEC_PER_MSEC); } +static inline jsdouble +NowAsFractionalsMillis() +{ + return (jsdouble) (PRMJ_Now() / double(PRMJ_USEC_PER_MSEC)); +} + static JSBool date_now(JSContext *cx, uintN argc, Value *vp) { - vp->setDouble(NowAsMillis()); + vp->setDouble(NowAsFractionalsMillis()); return JS_TRUE; } @@ -1200,7 +1206,7 @@ date_now(JSContext *cx, uintN argc, Value *vp) static jsdouble FASTCALL date_now_tn(JSContext*) { - return NowAsMillis(); + return NowAsFractionalsMillis(); } #endif diff --git a/layout/tools/reftest/reftest.js b/layout/tools/reftest/reftest.js index 0344ea832e6..8ab3c7498ab 100644 --- a/layout/tools/reftest/reftest.js +++ b/layout/tools/reftest/reftest.js @@ -778,7 +778,7 @@ function ServeFiles(manifestURL, depth, aURL, files) } gCount++; - var path = "/" + Date.now() + "/" + gCount; + var path = "/" + Math.floor(Date.now()) + "/" + gCount; gServer.registerDirectory(path + "/", directory); var secMan = CC[NS_SCRIPTSECURITYMANAGER_CONTRACTID] diff --git a/toolkit/components/console/hudservice/HUDService.jsm b/toolkit/components/console/hudservice/HUDService.jsm index 20d87ca6a18..6537de01233 100644 --- a/toolkit/components/console/hudservice/HUDService.jsm +++ b/toolkit/components/console/hudservice/HUDService.jsm @@ -4963,7 +4963,7 @@ ConsoleUtils = { */ timestamp: function ConsoleUtils_timestamp() { - return Date.now(); + return Math.floor(Date.now()); }, /** diff --git a/toolkit/components/console/hudservice/tests/browser/browser_webconsole_basic_net_logging.js b/toolkit/components/console/hudservice/tests/browser/browser_webconsole_basic_net_logging.js index 36313aa45bf..fc76153a997 100644 --- a/toolkit/components/console/hudservice/tests/browser/browser_webconsole_basic_net_logging.js +++ b/toolkit/components/console/hudservice/tests/browser/browser_webconsole_basic_net_logging.js @@ -41,7 +41,7 @@ // Tests that the page's resources are displayed in the console as they're // loaded -const TEST_NETWORK_URI = "http://example.com/browser/toolkit/components/console/hudservice/tests/browser/test-network.html" + "?_date=" + Date.now(); +const TEST_NETWORK_URI = "http://example.com/browser/toolkit/components/console/hudservice/tests/browser/test-network.html" + "?_date=" + Math.floor(Date.now()); function test() { addTab("data:text/html,Web Console basic network logging test"); diff --git a/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_583816_tab_focus.js b/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_583816_tab_focus.js index abacfd0b3c9..b2f0138aa43 100644 --- a/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_583816_tab_focus.js +++ b/toolkit/components/console/hudservice/tests/browser/browser_webconsole_bug_583816_tab_focus.js @@ -40,7 +40,7 @@ function firstTab(aEvent) { is(inputNode.getAttribute("focused"), "true", "inputNode is still focused"); isnot(this.value, "doc", "input autocompleted"); - HUD.jsterm.setInputValue("foobarbaz" + Date.now()); + HUD.jsterm.setInputValue("foobarbaz" + Math.floor(Date.now())); EventUtils.synthesizeKey("VK_TAB", {}); diff --git a/toolkit/components/downloads/test/unit/test_bug_401430.js b/toolkit/components/downloads/test/unit/test_bug_401430.js index 2029dad0ea1..91f9f182bbc 100644 --- a/toolkit/components/downloads/test/unit/test_bug_401430.js +++ b/toolkit/components/downloads/test/unit/test_bug_401430.js @@ -44,7 +44,7 @@ const dm = Cc["@mozilla.org/download-manager;1"].getService(nsIDownloadManager); // U+00E3 : LATIN SMALL LETTER A WITH TILDE // U+041B : CYRILLIC CAPITAL LETTER EL // U+3056 : HIRAGANA LETTER ZA -const resultFileName = "test\u00e3\u041b\u3056" + Date.now() + ".doc"; +const resultFileName = "test\u00e3\u041b\u3056" + Math.floor(Date.now()) + ".doc"; // Milliseconds between polls. const POLL_REGISTRY_TIMEOUT = 200; diff --git a/toolkit/content/widgets/toolbar.xml b/toolkit/content/widgets/toolbar.xml index 8c720390a58..e8d7c25ddc6 100644 --- a/toolkit/content/widgets/toolbar.xml +++ b/toolkit/content/widgets/toolbar.xml @@ -296,7 +296,7 @@ // Due to timers resolution Date.now() can be the same for // elements created in small timeframes. So ids are // differentiated through a unique count suffix. - newItem.id = aId + Date.now() + (++this._newElementCount); + newItem.id = aId + Math.floor(Date.now()) + (++this._newElementCount); if (aId == "spring") newItem.flex = 1; break;