зеркало из https://github.com/mozilla/pjs.git
merge backout of bug 585152
This commit is contained in:
Коммит
32958345f7
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -761,5 +761,5 @@ function countTabs() {
|
|||
}
|
||||
|
||||
function r() {
|
||||
return "" + Math.floor(Date.now()) + Math.random();
|
||||
return "" + Date.now() + Math.random();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -100,5 +100,5 @@ function waitForSaveState(aSaveStateCallback) {
|
|||
};
|
||||
|
||||
function r() {
|
||||
return Math.floor(Date.now()) + Math.random();
|
||||
return Date.now() + Math.random();
|
||||
}
|
||||
|
|
|
@ -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++;
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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>");
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -4963,7 +4963,7 @@ ConsoleUtils = {
|
|||
*/
|
||||
timestamp: function ConsoleUtils_timestamp()
|
||||
{
|
||||
return Math.floor(Date.now());
|
||||
return Date.now();
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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", {});
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче