Backed out changeset 80451fb8f11c (bug 585152) as per discussion in the bug.

This commit is contained in:
Jonathan Kew 2011-04-13 14:35:06 +01:00
parent 1beff55e64
commit cd179a175b
36 changed files with 49 additions and 61 deletions

View File

@ -1271,7 +1271,7 @@
notificationbox.appendChild(stack);
var position = this.tabs.length - 1;
var uniqueId = "panel" + Math.floor(Date.now()) + position;
var uniqueId = "panel" + Date.now() + position;
notificationbox.id = uniqueId;
t.linkedPanel = uniqueId;
t.linkedBrowser = b;

View File

@ -65,25 +65,25 @@ function createDocument()
function nodeGenerator()
{
let body = doc.body;
newProperty = "rand" + Math.floor(Date.now());
newProperty = "rand" + Date.now();
body[newProperty] = Math.round(Math.random() * 100);
InspectorUI.inspectNode(body);
yield;
let h1 = doc.querySelector("h1");
newProperty = "rand2" + Math.floor(Date.now());
newProperty = "rand2" + Date.now();
h1[newProperty] = "test" + Math.random();
InspectorUI.inspectNode(h1);
yield;
let first = doc.getElementById("first");
newProperty = "rand3" + Math.floor(Date.now());
newProperty = "rand3" + Date.now();
first[newProperty] = null;
InspectorUI.inspectNode(first);
yield;
let closing = doc.getElementById("closing");
newProperty = "bazbaz" + Math.floor(Date.now());
newProperty = "bazbaz" + Date.now();
closing[newProperty] = false;
InspectorUI.inspectNode(closing);
yield;

View File

@ -100,11 +100,6 @@ 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;
@ -542,7 +537,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/"), time() * 1000, null,
hs.addVisit(uri("http://www.mozilla.org/"), Date.now() * 1000, null,
hs.TRANSITION_TYPED, false, 0);
var genPageAnnoTxn = ptSvc.setPageAnnotation(uri("http://www.mozilla.org/"), pageAnnoObj);
genPageAnnoTxn.doTransaction();
@ -617,7 +612,7 @@ function run_test() {
// Test editing item date added
var oldAdded = bmsvc.getItemDateAdded(bkmk1Id);
var newAdded = time();
var newAdded = Date.now();
var eidaTxn = ptSvc.editItemDateAdded(bkmk1Id, newAdded);
eidaTxn.doTransaction();
do_check_eq(newAdded, bmsvc.getItemDateAdded(bkmk1Id));
@ -626,7 +621,7 @@ function run_test() {
// Test editing item last modified
var oldModified = bmsvc.getItemLastModified(bkmk1Id);
var newModified = time();
var newModified = Date.now();
var eilmTxn = ptSvc.editItemLastModified(bkmk1Id, newModified);
eilmTxn.doTransaction();
do_check_eq(newModified, bmsvc.getItemLastModified(bkmk1Id));
@ -734,7 +729,7 @@ function run_test() {
// Test creating an item with child transactions.
var childTxns = [];
var newDateAdded = time() - 20000;
var newDateAdded = Date.now() - 20000;
childTxns.push(ptSvc.editItemDateAdded(null, newDateAdded));
var itemChildAnnoObj = { name: "testAnno/testInt",
type: Ci.nsIAnnotationService.TYPE_INT32,

View File

@ -713,7 +713,7 @@ SessionStoreService.prototype = {
return;
// assign it a unique identifier (timestamp)
aWindow.__SSi = "window" + Math.floor(Date.now());
aWindow.__SSi = "window" + Date.now();
// and create its data object
this._windows[aWindow.__SSi] = { tabs: [], selected: 0, _closedTabs: [] };
@ -843,7 +843,7 @@ SessionStoreService.prototype = {
let isFullyLoaded = this._isWindowLoaded(aWindow);
if (!isFullyLoaded) {
if (!aWindow.__SSi)
aWindow.__SSi = "window" + Math.floor(Date.now());
aWindow.__SSi = "window" + Date.now();
this._windows[aWindow.__SSi] = this._statesToRestore[aWindow.__SS_restoreID];
delete this._statesToRestore[aWindow.__SS_restoreID];
delete aWindow.__SS_restoreID;
@ -2981,7 +2981,7 @@ SessionStoreService.prototype = {
// start might already be in use)
var id = aIdMap[aEntry.ID] || 0;
if (!id) {
for (id = Math.floor(Date.now()); id in aIdMap.used; id++);
for (id = Date.now(); id in aIdMap.used; id++);
aIdMap[aEntry.ID] = id;
aIdMap.used[id] = true;
}
@ -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
= "" + Math.floor(Date.now()) + Math.random();
= "" + Date.now() + Math.random();
// Extract the cookies that belong with each pinned tab
this._splitCookiesFromWindow(window, pinnedWindowState);

View File

@ -51,7 +51,7 @@ function test() {
filePath = file.path;
let fieldList = {
"//input[@name='input']": Math.floor(Date.now()).toString(),
"//input[@name='input']": Date.now().toString(),
"//input[@name='spaced 1']": Math.random().toString(),
"//input[3]": "three",
"//input[@type='checkbox']": true,

View File

@ -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, Math.floor(Date.now()).toString())),
ok(test(function() ss.deleteWindowValue(window, Date.now().toString())),
"Nonexistent value for deleteWindowValue throws");
ok(test(function() ss.deleteTabValue(gBrowser.selectedTab, Math.floor(Date.now()).toString())),
ok(test(function() ss.deleteTabValue(gBrowser.selectedTab, Date.now().toString())),
"Nonexistent value for deleteTabValue throws");
}

View File

@ -51,7 +51,7 @@ function test() {
filePath2 = file.path;
let fieldList = {
"//input[@name='input']": Math.floor(Date.now()).toString(),
"//input[@name='input']": Date.now().toString(),
"//input[@name='spaced 1']": Math.random().toString(),
"//input[3]": "three",
"//input[@type='checkbox']": true,

View File

@ -24,7 +24,7 @@ function test() {
////////////////////////////
// setWindowValue, et al. //
////////////////////////////
let key = "Unique name: " + Math.floor(Date.now());
let key = "Unique name: " + 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: " + Math.floor(Date.now());
value = "Unique value: " + Date.now();
let tab = tabbrowser.addTab();
tab.linkedBrowser.stop();

View File

@ -13,7 +13,7 @@ function test() {
/////////////////
// getTabState //
/////////////////
let key = "Unique key: " + Math.floor(Date.now());
let key = "Unique key: " + 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: " + Math.floor(Date.now());
let value3 = "Another value: " + Date.now();
let state = { entries: [{ url: testURL }], extData: { key2: value2 } };
// create a new tab

View File

@ -60,7 +60,7 @@ function test() {
let testURL = "about:config";
let uniqueKey = "bug 394759";
let uniqueValue = "unik" + Math.floor(Date.now());
let uniqueValue = "unik" + Date.now();
let uniqueText = "pi != " + Math.random();

View File

@ -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 = Math.floor(Date.now());
let now = Date.now();
const TESTS = [
{ url: "about:config",
key: "bug 394759 Non-PB",

View File

@ -42,7 +42,7 @@ function test() {
waitForExplicitFinish();
let uniqueName = "bug 448741";
let uniqueValue = "as good as unique: " + Math.floor(Date.now());
let uniqueValue = "as good as unique: " + Date.now();
// set a unique value on a new, blank tab
var tab = gBrowser.addTab();

View File

@ -41,7 +41,7 @@ function test() {
let testURL = "http://mochi.test:8888/browser/" +
"browser/components/sessionstore/test/browser/browser_459906_sample.html";
let uniqueValue = "<b>Unique:</b> " + Math.floor(Date.now());
let uniqueValue = "<b>Unique:</b> " + Date.now();
var frameCount = 0;
let tab = gBrowser.addTab(testURL);

View File

@ -41,7 +41,7 @@ function test() {
waitForExplicitFinish();
let uniqueName = "bug 465215";
let uniqueValue1 = "as good as unique: " + Math.floor(Date.now());
let uniqueValue1 = "as good as unique: " + Date.now();
let uniqueValue2 = "as good as unique: " + Math.random();
// set a unique value on a new, blank tab

View File

@ -54,7 +54,7 @@ function test() {
let uniqueKey1 = "bug 465223.1";
let uniqueKey2 = "bug 465223.2";
let uniqueValue1 = "unik" + Math.floor(Date.now());
let uniqueValue1 = "unik" + Date.now();
let uniqueValue2 = "pi != " + Math.random();
// open a window and set a value on it

View File

@ -47,7 +47,7 @@ function test() {
let doc = tab.linkedBrowser.contentDocument;
doc.getElementById("modify1").value += Math.random();
doc.getElementById("modify2").value += " " + Math.floor(Date.now());
doc.getElementById("modify2").value += " " + Date.now();
let tab2 = gBrowser.duplicateTab(tab);
tab2.linkedBrowser.addEventListener("load", function(aEvent) {

View File

@ -67,7 +67,7 @@ function test() {
}] };
let uniqueKey = "bug 477657";
let uniqueValue = "unik" + Math.floor(Date.now());
let uniqueValue = "unik" + Date.now();
ss.setWindowValue(newWin, uniqueKey, uniqueValue);
is(ss.getWindowValue(newWin, uniqueKey), uniqueValue,

View File

@ -52,7 +52,7 @@ function test() {
let ss = Cc["@mozilla.org/browser/sessionstore;1"].
getService(Ci.nsISessionStore);
let uniqKey = "bug524745";
let uniqVal = Math.floor(Date.now());
let uniqVal = Date.now();
waitForExplicitFinish();

View File

@ -761,5 +761,5 @@ function countTabs() {
}
function r() {
return "" + Math.floor(Date.now()) + Math.random();
return "" + Date.now() + Math.random();
}

View File

@ -1,5 +1,4 @@
/* ***** 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
@ -174,5 +173,5 @@ function test() {
// Helper function to create a random value
function r() {
return "" + Math.floor(Date.now()) + Math.random();
return "" + Date.now() + Math.random();
}

View File

@ -150,5 +150,5 @@ function test() {
// Helper function to create a random value
function r() {
return "" + Math.floor(Date.now()) + Math.random();
return "" + Date.now() + Math.random();
}

View File

@ -100,5 +100,5 @@ function waitForSaveState(aSaveStateCallback) {
};
function r() {
return Math.floor(Date.now()) + Math.random();
return Date.now() + Math.random();
}

View File

@ -423,7 +423,7 @@ function runTest() {
"file_CrossSiteXHR_cache_server.sjs?";
setStateURL = baseURL + "setState=";
var unique = Math.floor(Date.now());
var unique = Date.now();
for each (test in tests) {
if (test.newTest) {
unique++;

View File

@ -113,7 +113,7 @@ function run() {
const unvisitedFill = "rgb(0, 0, 255)";
const visitedFill = "rgb(128, 0, 128)";
const rand = Math.floor(Date.now()) + "-" + Math.random();
const rand = Date.now() + "-" + Math.random();
// Now we can start the tests in earnest.

View File

@ -26,7 +26,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=481335
/** Test for Bug 481335 **/
SimpleTest.waitForExplicitFinish();
var rand = Math.floor(Date.now()) + "-" + Math.random();
var rand = Date.now() + "-" + Math.random();
is($("t").href, "",
"Unexpected href before set");

View File

@ -2,6 +2,6 @@ function handleRequest(request, response) {
response.setHeader("Content-Type", "text/html");
response.write("<body onload='window.parent.onloadCount++'>" +
request.method + " " +
Math.floor(Date.now()) +
Date.now() +
"</body>");
}

View File

@ -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 = Math.floor(Date.now()) + "-" + Math.random();
var rand = Date.now() + "-" + Math.random();
ifLink.href = rand;
// Poll the document until the link has the correct color, or this test times

View File

@ -21,7 +21,7 @@ function do_run_test() {
let pm = Services.permissions;
let permURI = NetUtil.newURI("http://example.com");
let now = Math.floor(Date.now());
let now = Number(Date.now());
// add a permission with *now* expiration
pm.add(permURI, "test/expiration-perm-exp", 1, pm.EXPIRE_TIME, now);

View File

@ -22,7 +22,7 @@ function do_run_test() {
let pm = Services.permissions;
let permURI = NetUtil.newURI("http://example.com");
let now = (new Date()).getTime();
let now = Number(Date.now());
let permType = "test/expiration-perm";
let observer = new permission_observer(test_generator, now, permType);

View File

@ -1189,16 +1189,10 @@ 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(NowAsFractionalsMillis());
vp->setDouble(NowAsMillis());
return JS_TRUE;
}
@ -1206,7 +1200,7 @@ date_now(JSContext *cx, uintN argc, Value *vp)
static jsdouble FASTCALL
date_now_tn(JSContext*)
{
return NowAsFractionalsMillis();
return NowAsMillis();
}
#endif

View File

@ -778,7 +778,7 @@ function ServeFiles(manifestURL, depth, aURL, files)
}
gCount++;
var path = "/" + Math.floor(Date.now()) + "/" + gCount;
var path = "/" + Date.now() + "/" + gCount;
gServer.registerDirectory(path + "/", directory);
var secMan = CC[NS_SCRIPTSECURITYMANAGER_CONTRACTID]

View File

@ -4963,7 +4963,7 @@ ConsoleUtils = {
*/
timestamp: function ConsoleUtils_timestamp()
{
return Math.floor(Date.now());
return Date.now();
},
/**

View File

@ -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=" + Math.floor(Date.now());
const TEST_NETWORK_URI = "http://example.com/browser/toolkit/components/console/hudservice/tests/browser/test-network.html" + "?_date=" + Date.now();
function test() {
addTab("data:text/html,Web Console basic network logging test");

View File

@ -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" + Math.floor(Date.now()));
HUD.jsterm.setInputValue("foobarbaz" + Date.now());
EventUtils.synthesizeKey("VK_TAB", {});

View File

@ -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" + Math.floor(Date.now()) + ".doc";
const resultFileName = "test\u00e3\u041b\u3056" + Date.now() + ".doc";
// Milliseconds between polls.
const POLL_REGISTRY_TIMEOUT = 200;

View File

@ -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 + Math.floor(Date.now()) + (++this._newElementCount);
newItem.id = aId + Date.now() + (++this._newElementCount);
if (aId == "spring")
newItem.flex = 1;
break;