зеркало из https://github.com/mozilla/pjs.git
Bug 585152 - Reland Date.now() fractional changes, along with fixed tests. (r=jwalden,dolske,gavin, rs=jwalden)
For the tests, I put a Math.floor around anything which looked like it did string concatenation. In principal that was r+ by dolske and gavin, and jwalden r+ed the extension to the rest of the tests. Backout policy: the jsdate.cpp changes can be backed out trivially. The test changes should backout cleanly, but we're not hosed if they don't.
This commit is contained in:
Родитель
2ff83fa900
Коммит
1180222c78
|
@ -1265,7 +1265,7 @@
|
||||||
notificationbox.appendChild(stack);
|
notificationbox.appendChild(stack);
|
||||||
|
|
||||||
var position = this.tabs.length - 1;
|
var position = this.tabs.length - 1;
|
||||||
var uniqueId = "panel" + Date.now() + position;
|
var uniqueId = "panel" + Math.floor(Date.now()) + position;
|
||||||
notificationbox.id = uniqueId;
|
notificationbox.id = uniqueId;
|
||||||
t.linkedPanel = uniqueId;
|
t.linkedPanel = uniqueId;
|
||||||
t.linkedBrowser = b;
|
t.linkedBrowser = b;
|
||||||
|
@ -2408,7 +2408,7 @@
|
||||||
this.mCurrentTab = this.tabContainer.firstChild;
|
this.mCurrentTab = this.tabContainer.firstChild;
|
||||||
document.addEventListener("keypress", this, false);
|
document.addEventListener("keypress", this, false);
|
||||||
|
|
||||||
var uniqueId = "panel" + Date.now();
|
var uniqueId = "panel" + Math.floor(Date.now());
|
||||||
this.mPanelContainer.childNodes[0].id = uniqueId;
|
this.mPanelContainer.childNodes[0].id = uniqueId;
|
||||||
this.mCurrentTab.linkedPanel = uniqueId;
|
this.mCurrentTab.linkedPanel = uniqueId;
|
||||||
this.mCurrentTab._tPos = 0;
|
this.mCurrentTab._tPos = 0;
|
||||||
|
|
|
@ -65,25 +65,25 @@ function createDocument()
|
||||||
function nodeGenerator()
|
function nodeGenerator()
|
||||||
{
|
{
|
||||||
let body = doc.body;
|
let body = doc.body;
|
||||||
newProperty = "rand" + Date.now();
|
newProperty = "rand" + Math.floor(Date.now());
|
||||||
body[newProperty] = Math.round(Math.random() * 100);
|
body[newProperty] = Math.round(Math.random() * 100);
|
||||||
InspectorUI.inspectNode(body);
|
InspectorUI.inspectNode(body);
|
||||||
yield;
|
yield;
|
||||||
|
|
||||||
let h1 = doc.querySelector("h1");
|
let h1 = doc.querySelector("h1");
|
||||||
newProperty = "rand2" + Date.now();
|
newProperty = "rand2" + Math.floor(Date.now());
|
||||||
h1[newProperty] = "test" + Math.random();
|
h1[newProperty] = "test" + Math.random();
|
||||||
InspectorUI.inspectNode(h1);
|
InspectorUI.inspectNode(h1);
|
||||||
yield;
|
yield;
|
||||||
|
|
||||||
let first = doc.getElementById("first");
|
let first = doc.getElementById("first");
|
||||||
newProperty = "rand3" + Date.now();
|
newProperty = "rand3" + Math.floor(Date.now());
|
||||||
first[newProperty] = null;
|
first[newProperty] = null;
|
||||||
InspectorUI.inspectNode(first);
|
InspectorUI.inspectNode(first);
|
||||||
yield;
|
yield;
|
||||||
|
|
||||||
let closing = doc.getElementById("closing");
|
let closing = doc.getElementById("closing");
|
||||||
newProperty = "bazbaz" + Date.now();
|
newProperty = "bazbaz" + Math.floor(Date.now());
|
||||||
closing[newProperty] = false;
|
closing[newProperty] = false;
|
||||||
InspectorUI.inspectNode(closing);
|
InspectorUI.inspectNode(closing);
|
||||||
yield;
|
yield;
|
||||||
|
|
|
@ -100,6 +100,11 @@ bmsvc.addObserver(observer, false);
|
||||||
var bmStartIndex = 0;
|
var bmStartIndex = 0;
|
||||||
|
|
||||||
// main
|
// main
|
||||||
|
|
||||||
|
function time() {
|
||||||
|
return (new Date()).getTime();
|
||||||
|
}
|
||||||
|
|
||||||
function run_test() {
|
function run_test() {
|
||||||
// get bookmarks root index
|
// get bookmarks root index
|
||||||
var root = bmsvc.bookmarksMenuFolder;
|
var root = bmsvc.bookmarksMenuFolder;
|
||||||
|
@ -537,7 +542,7 @@ function run_test() {
|
||||||
expires: Ci.nsIAnnotationService.EXPIRE_NEVER };
|
expires: Ci.nsIAnnotationService.EXPIRE_NEVER };
|
||||||
var hs = Cc["@mozilla.org/browser/nav-history-service;1"].
|
var hs = Cc["@mozilla.org/browser/nav-history-service;1"].
|
||||||
getService(Ci.nsINavHistoryService);
|
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);
|
hs.TRANSITION_TYPED, false, 0);
|
||||||
var genPageAnnoTxn = ptSvc.setPageAnnotation(uri("http://www.mozilla.org/"), pageAnnoObj);
|
var genPageAnnoTxn = ptSvc.setPageAnnotation(uri("http://www.mozilla.org/"), pageAnnoObj);
|
||||||
genPageAnnoTxn.doTransaction();
|
genPageAnnoTxn.doTransaction();
|
||||||
|
@ -612,7 +617,7 @@ function run_test() {
|
||||||
|
|
||||||
// Test editing item date added
|
// Test editing item date added
|
||||||
var oldAdded = bmsvc.getItemDateAdded(bkmk1Id);
|
var oldAdded = bmsvc.getItemDateAdded(bkmk1Id);
|
||||||
var newAdded = Date.now();
|
var newAdded = time();
|
||||||
var eidaTxn = ptSvc.editItemDateAdded(bkmk1Id, newAdded);
|
var eidaTxn = ptSvc.editItemDateAdded(bkmk1Id, newAdded);
|
||||||
eidaTxn.doTransaction();
|
eidaTxn.doTransaction();
|
||||||
do_check_eq(newAdded, bmsvc.getItemDateAdded(bkmk1Id));
|
do_check_eq(newAdded, bmsvc.getItemDateAdded(bkmk1Id));
|
||||||
|
@ -621,7 +626,7 @@ function run_test() {
|
||||||
|
|
||||||
// Test editing item last modified
|
// Test editing item last modified
|
||||||
var oldModified = bmsvc.getItemLastModified(bkmk1Id);
|
var oldModified = bmsvc.getItemLastModified(bkmk1Id);
|
||||||
var newModified = Date.now();
|
var newModified = time();
|
||||||
var eilmTxn = ptSvc.editItemLastModified(bkmk1Id, newModified);
|
var eilmTxn = ptSvc.editItemLastModified(bkmk1Id, newModified);
|
||||||
eilmTxn.doTransaction();
|
eilmTxn.doTransaction();
|
||||||
do_check_eq(newModified, bmsvc.getItemLastModified(bkmk1Id));
|
do_check_eq(newModified, bmsvc.getItemLastModified(bkmk1Id));
|
||||||
|
@ -729,7 +734,7 @@ function run_test() {
|
||||||
|
|
||||||
// Test creating an item with child transactions.
|
// Test creating an item with child transactions.
|
||||||
var childTxns = [];
|
var childTxns = [];
|
||||||
var newDateAdded = Date.now() - 20000;
|
var newDateAdded = time() - 20000;
|
||||||
childTxns.push(ptSvc.editItemDateAdded(null, newDateAdded));
|
childTxns.push(ptSvc.editItemDateAdded(null, newDateAdded));
|
||||||
var itemChildAnnoObj = { name: "testAnno/testInt",
|
var itemChildAnnoObj = { name: "testAnno/testInt",
|
||||||
type: Ci.nsIAnnotationService.TYPE_INT32,
|
type: Ci.nsIAnnotationService.TYPE_INT32,
|
||||||
|
|
|
@ -713,7 +713,7 @@ SessionStoreService.prototype = {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// assign it a unique identifier (timestamp)
|
// assign it a unique identifier (timestamp)
|
||||||
aWindow.__SSi = "window" + Date.now();
|
aWindow.__SSi = "window" + Math.floor(Date.now());
|
||||||
|
|
||||||
// and create its data object
|
// and create its data object
|
||||||
this._windows[aWindow.__SSi] = { tabs: [], selected: 0, _closedTabs: [] };
|
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
|
// Assign a unique ID to correlate the window to be opened with the
|
||||||
// remaining data
|
// remaining data
|
||||||
window.__lastSessionWindowID = pinnedWindowState.__lastSessionWindowID
|
window.__lastSessionWindowID = pinnedWindowState.__lastSessionWindowID
|
||||||
= "" + Date.now() + Math.random();
|
= "" + Math.floor(Date.now()) + Math.random();
|
||||||
|
|
||||||
// Extract the cookies that belong with each pinned tab
|
// Extract the cookies that belong with each pinned tab
|
||||||
this._splitCookiesFromWindow(window, pinnedWindowState);
|
this._splitCookiesFromWindow(window, pinnedWindowState);
|
||||||
|
|
|
@ -51,7 +51,7 @@ function test() {
|
||||||
filePath = file.path;
|
filePath = file.path;
|
||||||
|
|
||||||
let fieldList = {
|
let fieldList = {
|
||||||
"//input[@name='input']": Date.now().toString(),
|
"//input[@name='input']": Math.floor(Date.now()).toString(),
|
||||||
"//input[@name='spaced 1']": Math.random().toString(),
|
"//input[@name='spaced 1']": Math.random().toString(),
|
||||||
"//input[3]": "three",
|
"//input[3]": "three",
|
||||||
"//input[@type='checkbox']": true,
|
"//input[@type='checkbox']": true,
|
||||||
|
|
|
@ -78,8 +78,8 @@ function test() {
|
||||||
"Invalid window for setWindowValue throws");
|
"Invalid window for setWindowValue throws");
|
||||||
ok(test(function() ss.deleteWindowValue({}, "")),
|
ok(test(function() ss.deleteWindowValue({}, "")),
|
||||||
"Invalid window for deleteWindowValue throws");
|
"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");
|
"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");
|
"Nonexistent value for deleteTabValue throws");
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ function test() {
|
||||||
filePath2 = file.path;
|
filePath2 = file.path;
|
||||||
|
|
||||||
let fieldList = {
|
let fieldList = {
|
||||||
"//input[@name='input']": Date.now().toString(),
|
"//input[@name='input']": Math.floor(Date.now()).toString(),
|
||||||
"//input[@name='spaced 1']": Math.random().toString(),
|
"//input[@name='spaced 1']": Math.random().toString(),
|
||||||
"//input[3]": "three",
|
"//input[3]": "three",
|
||||||
"//input[@type='checkbox']": true,
|
"//input[@type='checkbox']": true,
|
||||||
|
|
|
@ -24,7 +24,7 @@ function test() {
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
// setWindowValue, et al. //
|
// setWindowValue, et al. //
|
||||||
////////////////////////////
|
////////////////////////////
|
||||||
let key = "Unique name: " + Date.now();
|
let key = "Unique name: " + Math.floor(Date.now());
|
||||||
let value = "Unique value: " + Math.random();
|
let value = "Unique value: " + Math.random();
|
||||||
|
|
||||||
// test adding
|
// test adding
|
||||||
|
@ -43,7 +43,7 @@ function test() {
|
||||||
// setTabValue, et al. //
|
// setTabValue, et al. //
|
||||||
/////////////////////////
|
/////////////////////////
|
||||||
key = "Unique name: " + Math.random();
|
key = "Unique name: " + Math.random();
|
||||||
value = "Unique value: " + Date.now();
|
value = "Unique value: " + Math.floor(Date.now());
|
||||||
let tab = tabbrowser.addTab();
|
let tab = tabbrowser.addTab();
|
||||||
tab.linkedBrowser.stop();
|
tab.linkedBrowser.stop();
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ function test() {
|
||||||
/////////////////
|
/////////////////
|
||||||
// getTabState //
|
// getTabState //
|
||||||
/////////////////
|
/////////////////
|
||||||
let key = "Unique key: " + Date.now();
|
let key = "Unique key: " + Math.floor(Date.now());
|
||||||
let value = "Unique value: " + Math.random();
|
let value = "Unique value: " + Math.random();
|
||||||
let testURL = "about:config";
|
let testURL = "about:config";
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ function test() {
|
||||||
//////////////////////////////////
|
//////////////////////////////////
|
||||||
let key2 = "key2";
|
let key2 = "key2";
|
||||||
let value2 = "Value " + Math.random();
|
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 } };
|
let state = { entries: [{ url: testURL }], extData: { key2: value2 } };
|
||||||
|
|
||||||
// create a new tab
|
// create a new tab
|
||||||
|
|
|
@ -60,7 +60,7 @@ function test() {
|
||||||
|
|
||||||
let testURL = "about:config";
|
let testURL = "about:config";
|
||||||
let uniqueKey = "bug 394759";
|
let uniqueKey = "bug 394759";
|
||||||
let uniqueValue = "unik" + Date.now();
|
let uniqueValue = "unik" + Math.floor(Date.now());
|
||||||
let uniqueText = "pi != " + Math.random();
|
let uniqueText = "pi != " + Math.random();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ function continue_test() {
|
||||||
is(closedWindowCount, 0, "Correctly set window count");
|
is(closedWindowCount, 0, "Correctly set window count");
|
||||||
|
|
||||||
// Prevent VM timers issues, cache now and increment it manually.
|
// Prevent VM timers issues, cache now and increment it manually.
|
||||||
let now = Date.now();
|
let now = Math.floor(Date.now());
|
||||||
const TESTS = [
|
const TESTS = [
|
||||||
{ url: "about:config",
|
{ url: "about:config",
|
||||||
key: "bug 394759 Non-PB",
|
key: "bug 394759 Non-PB",
|
||||||
|
|
|
@ -42,7 +42,7 @@ function test() {
|
||||||
waitForExplicitFinish();
|
waitForExplicitFinish();
|
||||||
|
|
||||||
let uniqueName = "bug 448741";
|
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
|
// set a unique value on a new, blank tab
|
||||||
var tab = gBrowser.addTab();
|
var tab = gBrowser.addTab();
|
||||||
|
|
|
@ -41,7 +41,7 @@ function test() {
|
||||||
|
|
||||||
let testURL = "http://mochi.test:8888/browser/" +
|
let testURL = "http://mochi.test:8888/browser/" +
|
||||||
"browser/components/sessionstore/test/browser/browser_459906_sample.html";
|
"browser/components/sessionstore/test/browser/browser_459906_sample.html";
|
||||||
let uniqueValue = "<b>Unique:</b> " + Date.now();
|
let uniqueValue = "<b>Unique:</b> " + Math.floor(Date.now());
|
||||||
|
|
||||||
var frameCount = 0;
|
var frameCount = 0;
|
||||||
let tab = gBrowser.addTab(testURL);
|
let tab = gBrowser.addTab(testURL);
|
||||||
|
|
|
@ -41,7 +41,7 @@ function test() {
|
||||||
waitForExplicitFinish();
|
waitForExplicitFinish();
|
||||||
|
|
||||||
let uniqueName = "bug 465215";
|
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();
|
let uniqueValue2 = "as good as unique: " + Math.random();
|
||||||
|
|
||||||
// set a unique value on a new, blank tab
|
// set a unique value on a new, blank tab
|
||||||
|
|
|
@ -54,7 +54,7 @@ function test() {
|
||||||
|
|
||||||
let uniqueKey1 = "bug 465223.1";
|
let uniqueKey1 = "bug 465223.1";
|
||||||
let uniqueKey2 = "bug 465223.2";
|
let uniqueKey2 = "bug 465223.2";
|
||||||
let uniqueValue1 = "unik" + Date.now();
|
let uniqueValue1 = "unik" + Math.floor(Date.now());
|
||||||
let uniqueValue2 = "pi != " + Math.random();
|
let uniqueValue2 = "pi != " + Math.random();
|
||||||
|
|
||||||
// open a window and set a value on it
|
// open a window and set a value on it
|
||||||
|
|
|
@ -47,7 +47,7 @@ function test() {
|
||||||
let doc = tab.linkedBrowser.contentDocument;
|
let doc = tab.linkedBrowser.contentDocument;
|
||||||
|
|
||||||
doc.getElementById("modify1").value += Math.random();
|
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);
|
let tab2 = gBrowser.duplicateTab(tab);
|
||||||
tab2.linkedBrowser.addEventListener("load", function(aEvent) {
|
tab2.linkedBrowser.addEventListener("load", function(aEvent) {
|
||||||
|
|
|
@ -67,7 +67,7 @@ function test() {
|
||||||
}] };
|
}] };
|
||||||
|
|
||||||
let uniqueKey = "bug 477657";
|
let uniqueKey = "bug 477657";
|
||||||
let uniqueValue = "unik" + Date.now();
|
let uniqueValue = "unik" + Math.floor(Date.now());
|
||||||
|
|
||||||
ss.setWindowValue(newWin, uniqueKey, uniqueValue);
|
ss.setWindowValue(newWin, uniqueKey, uniqueValue);
|
||||||
is(ss.getWindowValue(newWin, uniqueKey), uniqueValue,
|
is(ss.getWindowValue(newWin, uniqueKey), uniqueValue,
|
||||||
|
|
|
@ -52,7 +52,7 @@ function test() {
|
||||||
let ss = Cc["@mozilla.org/browser/sessionstore;1"].
|
let ss = Cc["@mozilla.org/browser/sessionstore;1"].
|
||||||
getService(Ci.nsISessionStore);
|
getService(Ci.nsISessionStore);
|
||||||
let uniqKey = "bug524745";
|
let uniqKey = "bug524745";
|
||||||
let uniqVal = Date.now();
|
let uniqVal = Math.floor(Date.now());
|
||||||
|
|
||||||
waitForExplicitFinish();
|
waitForExplicitFinish();
|
||||||
|
|
||||||
|
|
|
@ -761,5 +761,5 @@ function countTabs() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function r() {
|
function r() {
|
||||||
return "" + Date.now() + Math.random();
|
return "" + Math.floor(Date.now()) + Math.random();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
/* ***** BEGIN LICENSE BLOCK *****
|
/* ***** BEGIN LICENSE BLOCK *****
|
||||||
|
*
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||||
*
|
*
|
||||||
* The contents of this file are subject to the Mozilla Public License Version
|
* 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
|
// Helper function to create a random value
|
||||||
function r() {
|
function r() {
|
||||||
return "" + Date.now() + Math.random();
|
return "" + Math.floor(Date.now()) + Math.random();
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,5 +150,5 @@ function test() {
|
||||||
|
|
||||||
// Helper function to create a random value
|
// Helper function to create a random value
|
||||||
function r() {
|
function r() {
|
||||||
return "" + Date.now() + Math.random();
|
return "" + Math.floor(Date.now()) + Math.random();
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,5 +100,5 @@ function waitForSaveState(aSaveStateCallback) {
|
||||||
};
|
};
|
||||||
|
|
||||||
function r() {
|
function r() {
|
||||||
return Date.now() + Math.random();
|
return Math.floor(Date.now()) + Math.random();
|
||||||
}
|
}
|
||||||
|
|
|
@ -423,7 +423,7 @@ function runTest() {
|
||||||
"file_CrossSiteXHR_cache_server.sjs?";
|
"file_CrossSiteXHR_cache_server.sjs?";
|
||||||
setStateURL = baseURL + "setState=";
|
setStateURL = baseURL + "setState=";
|
||||||
|
|
||||||
var unique = Date.now();
|
var unique = Math.floor(Date.now());
|
||||||
for each (test in tests) {
|
for each (test in tests) {
|
||||||
if (test.newTest) {
|
if (test.newTest) {
|
||||||
unique++;
|
unique++;
|
||||||
|
|
|
@ -113,7 +113,7 @@ function run() {
|
||||||
const unvisitedFill = "rgb(0, 0, 255)";
|
const unvisitedFill = "rgb(0, 0, 255)";
|
||||||
const visitedFill = "rgb(128, 0, 128)";
|
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.
|
// 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 **/
|
/** Test for Bug 481335 **/
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
var rand = Date.now() + "-" + Math.random();
|
var rand = Math.floor(Date.now()) + "-" + Math.random();
|
||||||
|
|
||||||
is($("t").href, "",
|
is($("t").href, "",
|
||||||
"Unexpected href before set");
|
"Unexpected href before set");
|
||||||
|
|
|
@ -2,6 +2,6 @@ function handleRequest(request, response) {
|
||||||
response.setHeader("Content-Type", "text/html");
|
response.setHeader("Content-Type", "text/html");
|
||||||
response.write("<body onload='window.parent.onloadCount++'>" +
|
response.write("<body onload='window.parent.onloadCount++'>" +
|
||||||
request.method + " " +
|
request.method + " " +
|
||||||
Date.now() +
|
Math.floor(Date.now()) +
|
||||||
"</body>");
|
"</body>");
|
||||||
}
|
}
|
||||||
|
|
|
@ -346,7 +346,7 @@ function runTest() {
|
||||||
statusMsg("Done loading file_bug500328_1.html for the second time.");
|
statusMsg("Done loading file_bug500328_1.html for the second time.");
|
||||||
|
|
||||||
var ifLink = iframeCw.document.getElementById("link-anchor1");
|
var ifLink = iframeCw.document.getElementById("link-anchor1");
|
||||||
var rand = Date.now() + "-" + Math.random();
|
var rand = Math.floor(Date.now()) + "-" + Math.random();
|
||||||
ifLink.href = rand;
|
ifLink.href = rand;
|
||||||
|
|
||||||
// Poll the document until the link has the correct color, or this test times
|
// 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 pm = Services.permissions;
|
||||||
let permURI = NetUtil.newURI("http://example.com");
|
let permURI = NetUtil.newURI("http://example.com");
|
||||||
let now = Number(Date.now());
|
let now = Math.floor(Date.now());
|
||||||
|
|
||||||
// add a permission with *now* expiration
|
// add a permission with *now* expiration
|
||||||
pm.add(permURI, "test/expiration-perm-exp", 1, pm.EXPIRE_TIME, now);
|
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 pm = Services.permissions;
|
||||||
let permURI = NetUtil.newURI("http://example.com");
|
let permURI = NetUtil.newURI("http://example.com");
|
||||||
let now = Number(Date.now());
|
let now = (new Date()).getTime();
|
||||||
let permType = "test/expiration-perm";
|
let permType = "test/expiration-perm";
|
||||||
|
|
||||||
let observer = new permission_observer(test_generator, now, permType);
|
let observer = new permission_observer(test_generator, now, permType);
|
||||||
|
|
|
@ -1189,10 +1189,16 @@ NowAsMillis()
|
||||||
return (jsdouble) (PRMJ_Now() / PRMJ_USEC_PER_MSEC);
|
return (jsdouble) (PRMJ_Now() / PRMJ_USEC_PER_MSEC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline jsdouble
|
||||||
|
NowAsFractionalsMillis()
|
||||||
|
{
|
||||||
|
return (jsdouble) (PRMJ_Now() / double(PRMJ_USEC_PER_MSEC));
|
||||||
|
}
|
||||||
|
|
||||||
static JSBool
|
static JSBool
|
||||||
date_now(JSContext *cx, uintN argc, Value *vp)
|
date_now(JSContext *cx, uintN argc, Value *vp)
|
||||||
{
|
{
|
||||||
vp->setDouble(NowAsMillis());
|
vp->setDouble(NowAsFractionalsMillis());
|
||||||
return JS_TRUE;
|
return JS_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1200,7 +1206,7 @@ date_now(JSContext *cx, uintN argc, Value *vp)
|
||||||
static jsdouble FASTCALL
|
static jsdouble FASTCALL
|
||||||
date_now_tn(JSContext*)
|
date_now_tn(JSContext*)
|
||||||
{
|
{
|
||||||
return NowAsMillis();
|
return NowAsFractionalsMillis();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -778,7 +778,7 @@ function ServeFiles(manifestURL, depth, aURL, files)
|
||||||
}
|
}
|
||||||
|
|
||||||
gCount++;
|
gCount++;
|
||||||
var path = "/" + Date.now() + "/" + gCount;
|
var path = "/" + Math.floor(Date.now()) + "/" + gCount;
|
||||||
gServer.registerDirectory(path + "/", directory);
|
gServer.registerDirectory(path + "/", directory);
|
||||||
|
|
||||||
var secMan = CC[NS_SCRIPTSECURITYMANAGER_CONTRACTID]
|
var secMan = CC[NS_SCRIPTSECURITYMANAGER_CONTRACTID]
|
||||||
|
|
|
@ -4963,7 +4963,7 @@ ConsoleUtils = {
|
||||||
*/
|
*/
|
||||||
timestamp: function ConsoleUtils_timestamp()
|
timestamp: function ConsoleUtils_timestamp()
|
||||||
{
|
{
|
||||||
return Date.now();
|
return Math.floor(Date.now());
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
// Tests that the page's resources are displayed in the console as they're
|
// Tests that the page's resources are displayed in the console as they're
|
||||||
// loaded
|
// 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() {
|
function test() {
|
||||||
addTab("data:text/html,Web Console basic network logging 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");
|
is(inputNode.getAttribute("focused"), "true", "inputNode is still focused");
|
||||||
isnot(this.value, "doc", "input autocompleted");
|
isnot(this.value, "doc", "input autocompleted");
|
||||||
|
|
||||||
HUD.jsterm.setInputValue("foobarbaz" + Date.now());
|
HUD.jsterm.setInputValue("foobarbaz" + Math.floor(Date.now()));
|
||||||
|
|
||||||
EventUtils.synthesizeKey("VK_TAB", {});
|
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+00E3 : LATIN SMALL LETTER A WITH TILDE
|
||||||
// U+041B : CYRILLIC CAPITAL LETTER EL
|
// U+041B : CYRILLIC CAPITAL LETTER EL
|
||||||
// U+3056 : HIRAGANA LETTER ZA
|
// 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.
|
// Milliseconds between polls.
|
||||||
const POLL_REGISTRY_TIMEOUT = 200;
|
const POLL_REGISTRY_TIMEOUT = 200;
|
||||||
|
|
|
@ -296,7 +296,7 @@
|
||||||
// Due to timers resolution Date.now() can be the same for
|
// Due to timers resolution Date.now() can be the same for
|
||||||
// elements created in small timeframes. So ids are
|
// elements created in small timeframes. So ids are
|
||||||
// differentiated through a unique count suffix.
|
// 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")
|
if (aId == "spring")
|
||||||
newItem.flex = 1;
|
newItem.flex = 1;
|
||||||
break;
|
break;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче