forked from mirrors/gecko-dev
Bug 1508984 - Enable ESLint for dom/tests/unit/ and dom/system (manual changes) r=Standard8,Ehsan
Differential Revision: https://phabricator.services.mozilla.com/D13624 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
7b8111e317
commit
a12b9e7b37
18 changed files with 182 additions and 235 deletions
|
|
@ -208,11 +208,9 @@ dom/security/test/sri/**
|
||||||
dom/serviceworkers/**
|
dom/serviceworkers/**
|
||||||
dom/smil/**
|
dom/smil/**
|
||||||
dom/svg/**
|
dom/svg/**
|
||||||
dom/system/**
|
|
||||||
dom/tests/browser/**
|
dom/tests/browser/**
|
||||||
dom/tests/html/**
|
dom/tests/html/**
|
||||||
dom/tests/mochitest/**
|
dom/tests/mochitest/**
|
||||||
dom/tests/unit/**
|
|
||||||
dom/u2f/**
|
dom/u2f/**
|
||||||
dom/url/**
|
dom/url/**
|
||||||
dom/vr/**
|
dom/vr/**
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ var gWifiScanningEnabled = true;
|
||||||
function LOG(aMsg) {
|
function LOG(aMsg) {
|
||||||
if (gLoggingEnabled) {
|
if (gLoggingEnabled) {
|
||||||
aMsg = "*** WIFI GEO: " + aMsg + "\n";
|
aMsg = "*** WIFI GEO: " + aMsg + "\n";
|
||||||
Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleService).logStringMessage(aMsg);
|
Services.console.logStringMessage(aMsg);
|
||||||
dump(aMsg);
|
dump(aMsg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -134,8 +134,7 @@ var gDebugCacheReasoning = ""; // for logging the caching logic
|
||||||
// If there is more source info than the cached request had, return false
|
// If there is more source info than the cached request had, return false
|
||||||
// In other cases, MLS is known to produce better/worse accuracy based on the
|
// In other cases, MLS is known to produce better/worse accuracy based on the
|
||||||
// inputs, so base the decision on that.
|
// inputs, so base the decision on that.
|
||||||
function isCachedRequestMoreAccurateThanServerRequest(newCell, newWifiList)
|
function isCachedRequestMoreAccurateThanServerRequest(newCell, newWifiList) {
|
||||||
{
|
|
||||||
gDebugCacheReasoning = "";
|
gDebugCacheReasoning = "";
|
||||||
let isNetworkRequestCacheEnabled = true;
|
let isNetworkRequestCacheEnabled = true;
|
||||||
try {
|
try {
|
||||||
|
|
@ -188,14 +187,13 @@ function isCachedRequestMoreAccurateThanServerRequest(newCell, newWifiList)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (gCachedRequest.isWifiOnly() && hasEqualWifis) {
|
} else if (gCachedRequest.isWifiOnly() && hasEqualWifis) {
|
||||||
gDebugCacheReasoning +=", Wifi only."
|
gDebugCacheReasoning += ", Wifi only.";
|
||||||
return true;
|
return true;
|
||||||
} else if (gCachedRequest.isCellAndWifi()) {
|
} else if (gCachedRequest.isCellAndWifi()) {
|
||||||
gDebugCacheReasoning += ", Cache has Cell+Wifi.";
|
gDebugCacheReasoning += ", Cache has Cell+Wifi.";
|
||||||
if ((hasEqualCells && hasEqualWifis) ||
|
if ((hasEqualCells && hasEqualWifis) ||
|
||||||
(!newWifiList && hasEqualCells) ||
|
(!newWifiList && hasEqualCells) ||
|
||||||
(!newCell && hasEqualWifis))
|
(!newCell && hasEqualWifis)) {
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -218,7 +216,7 @@ function WifiGeoCoordsObject(lat, lon, acc) {
|
||||||
}
|
}
|
||||||
|
|
||||||
WifiGeoCoordsObject.prototype = {
|
WifiGeoCoordsObject.prototype = {
|
||||||
QueryInterface: ChromeUtils.generateQI([Ci.nsIDOMGeoPositionCoords])
|
QueryInterface: ChromeUtils.generateQI([Ci.nsIDOMGeoPositionCoords]),
|
||||||
};
|
};
|
||||||
|
|
||||||
function WifiGeoPositionObject(lat, lng, acc) {
|
function WifiGeoPositionObject(lat, lng, acc) {
|
||||||
|
|
@ -228,21 +226,13 @@ function WifiGeoPositionObject(lat, lng, acc) {
|
||||||
}
|
}
|
||||||
|
|
||||||
WifiGeoPositionObject.prototype = {
|
WifiGeoPositionObject.prototype = {
|
||||||
QueryInterface: ChromeUtils.generateQI([Ci.nsIDOMGeoPosition])
|
QueryInterface: ChromeUtils.generateQI([Ci.nsIDOMGeoPosition]),
|
||||||
};
|
};
|
||||||
|
|
||||||
function WifiGeoPositionProvider() {
|
function WifiGeoPositionProvider() {
|
||||||
try {
|
gLoggingEnabled = Services.prefs.getBoolPref("geo.wifi.logging.enabled", false);
|
||||||
gLoggingEnabled = Services.prefs.getBoolPref("geo.wifi.logging.enabled");
|
gLocationRequestTimeout = Services.prefs.getIntPref("geo.wifi.timeToWaitBeforeSending", 5000);
|
||||||
} catch (e) {}
|
gWifiScanningEnabled = Services.prefs.getBoolPref("geo.wifi.scan", true);
|
||||||
|
|
||||||
try {
|
|
||||||
gLocationRequestTimeout = Services.prefs.getIntPref("geo.wifi.timeToWaitBeforeSending");
|
|
||||||
} catch (e) {}
|
|
||||||
|
|
||||||
try {
|
|
||||||
gWifiScanningEnabled = Services.prefs.getBoolPref("geo.wifi.scan");
|
|
||||||
} catch (e) {}
|
|
||||||
|
|
||||||
this.wifiService = null;
|
this.wifiService = null;
|
||||||
this.timer = null;
|
this.timer = null;
|
||||||
|
|
@ -257,7 +247,7 @@ WifiGeoPositionProvider.prototype = {
|
||||||
Ci.nsIObserver]),
|
Ci.nsIObserver]),
|
||||||
listener: null,
|
listener: null,
|
||||||
|
|
||||||
resetTimer: function() {
|
resetTimer() {
|
||||||
if (this.timer) {
|
if (this.timer) {
|
||||||
this.timer.cancel();
|
this.timer.cancel();
|
||||||
this.timer = null;
|
this.timer = null;
|
||||||
|
|
@ -269,12 +259,11 @@ WifiGeoPositionProvider.prototype = {
|
||||||
this.timer.TYPE_REPEATING_SLACK);
|
this.timer.TYPE_REPEATING_SLACK);
|
||||||
},
|
},
|
||||||
|
|
||||||
startup: function() {
|
startup() {
|
||||||
if (this.started)
|
if (this.started)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.started = true;
|
this.started = true;
|
||||||
let self = this;
|
|
||||||
|
|
||||||
if (gWifiScanningEnabled && Cc["@mozilla.org/wifi/monitor;1"]) {
|
if (gWifiScanningEnabled && Cc["@mozilla.org/wifi/monitor;1"]) {
|
||||||
if (this.wifiService) {
|
if (this.wifiService) {
|
||||||
|
|
@ -288,13 +277,13 @@ WifiGeoPositionProvider.prototype = {
|
||||||
LOG("startup called.");
|
LOG("startup called.");
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: function(c) {
|
watch(c) {
|
||||||
this.listener = c;
|
this.listener = c;
|
||||||
},
|
},
|
||||||
|
|
||||||
shutdown: function() {
|
shutdown() {
|
||||||
LOG("shutdown called");
|
LOG("shutdown called");
|
||||||
if (this.started == false) {
|
if (!this.started) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -316,31 +305,31 @@ WifiGeoPositionProvider.prototype = {
|
||||||
this.started = false;
|
this.started = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
setHighAccuracy: function(enable) {
|
setHighAccuracy(enable) {
|
||||||
},
|
},
|
||||||
|
|
||||||
onChange: function(accessPoints) {
|
onChange(accessPoints) {
|
||||||
|
|
||||||
// we got some wifi data, rearm the timer.
|
// we got some wifi data, rearm the timer.
|
||||||
this.resetTimer();
|
this.resetTimer();
|
||||||
|
|
||||||
function isPublic(ap) {
|
function isPublic(ap) {
|
||||||
let mask = "_nomap"
|
let mask = "_nomap";
|
||||||
let result = ap.ssid.indexOf(mask, ap.ssid.length - mask.length);
|
let result = ap.ssid.indexOf(mask, ap.ssid.length - mask.length);
|
||||||
if (result != -1) {
|
if (result != -1) {
|
||||||
LOG("Filtering out " + ap.ssid + " " + result);
|
LOG("Filtering out " + ap.ssid + " " + result);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
}
|
||||||
|
|
||||||
function sort(a, b) {
|
function sort(a, b) {
|
||||||
return b.signal - a.signal;
|
return b.signal - a.signal;
|
||||||
};
|
}
|
||||||
|
|
||||||
function encode(ap) {
|
function encode(ap) {
|
||||||
return { 'macAddress': ap.mac, 'signalStrength': ap.signal };
|
return { "macAddress": ap.mac, "signalStrength": ap.signal };
|
||||||
};
|
}
|
||||||
|
|
||||||
let wifiData = null;
|
let wifiData = null;
|
||||||
if (accessPoints) {
|
if (accessPoints) {
|
||||||
|
|
@ -349,16 +338,16 @@ WifiGeoPositionProvider.prototype = {
|
||||||
this.sendLocationRequest(wifiData);
|
this.sendLocationRequest(wifiData);
|
||||||
},
|
},
|
||||||
|
|
||||||
onError: function (code) {
|
onError(code) {
|
||||||
LOG("wifi error: " + code);
|
LOG("wifi error: " + code);
|
||||||
this.sendLocationRequest(null);
|
this.sendLocationRequest(null);
|
||||||
},
|
},
|
||||||
|
|
||||||
notify: function (timer) {
|
notify(timer) {
|
||||||
this.sendLocationRequest(null);
|
this.sendLocationRequest(null);
|
||||||
},
|
},
|
||||||
|
|
||||||
sendLocationRequest: function (wifiData) {
|
sendLocationRequest(wifiData) {
|
||||||
let data = { cellTowers: undefined, wifiAccessPoints: undefined };
|
let data = { cellTowers: undefined, wifiAccessPoints: undefined };
|
||||||
if (wifiData && wifiData.length >= 2) {
|
if (wifiData && wifiData.length >= 2) {
|
||||||
data.wifiAccessPoints = wifiData;
|
data.wifiAccessPoints = wifiData;
|
||||||
|
|
@ -394,7 +383,7 @@ WifiGeoPositionProvider.prototype = {
|
||||||
xhr.mozBackgroundRequest = true;
|
xhr.mozBackgroundRequest = true;
|
||||||
xhr.timeout = Services.prefs.getIntPref("geo.wifi.xhr.timeout");
|
xhr.timeout = Services.prefs.getIntPref("geo.wifi.xhr.timeout");
|
||||||
xhr.ontimeout = () => {
|
xhr.ontimeout = () => {
|
||||||
LOG("Location request XHR timed out.")
|
LOG("Location request XHR timed out.");
|
||||||
notifyPositionUnavailable(this.listener);
|
notifyPositionUnavailable(this.listener);
|
||||||
};
|
};
|
||||||
xhr.onerror = () => {
|
xhr.onerror = () => {
|
||||||
|
|
@ -427,7 +416,7 @@ WifiGeoPositionProvider.prototype = {
|
||||||
listener.notifyError(POSITION_UNAVAILABLE);
|
listener.notifyError(POSITION_UNAVAILABLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([WifiGeoPositionProvider]);
|
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([WifiGeoPositionProvider]);
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,6 @@ window.onmessage = function (event) {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -15,15 +15,15 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1197901
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
window.onload = function() {
|
window.onload = function() {
|
||||||
SimpleTest.waitForFocus(function() {
|
SimpleTest.waitForFocus(function() {
|
||||||
SpecialPowers.pushPrefEnv({"set": [['device.sensors.test.events', true]]},
|
SpecialPowers.pushPrefEnv({"set": [["device.sensors.test.events", true]]},
|
||||||
doTest);
|
doTest);
|
||||||
}, window);
|
}, window);
|
||||||
}
|
};
|
||||||
|
|
||||||
function doTest() {
|
function doTest() {
|
||||||
window.onmessage = function(event) {
|
window.onmessage = function(event) {
|
||||||
ok(event.data.result, event.data.message);
|
ok(event.data.result, event.data.message);
|
||||||
}
|
};
|
||||||
|
|
||||||
// Only same-origin iframe should get the events.
|
// Only same-origin iframe should get the events.
|
||||||
var xo = document.getElementById("cross-origin");
|
var xo = document.getElementById("cross-origin");
|
||||||
|
|
@ -75,9 +75,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1197901
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
}, 500);
|
}, 500);
|
||||||
}, win2);
|
}, win2);
|
||||||
}
|
};
|
||||||
}, win);
|
}, win);
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
/* eslint-env mozilla/chrome-worker */
|
||||||
|
|
||||||
function log(text) {
|
function log(text) {
|
||||||
dump("WORKER " + text + "\n");
|
dump("WORKER " + text + "\n");
|
||||||
|
|
@ -10,8 +11,8 @@ function send(message) {
|
||||||
}
|
}
|
||||||
|
|
||||||
self.onmessage = function(msg) {
|
self.onmessage = function(msg) {
|
||||||
self.onmessage = function(msg) {
|
self.onmessage = function(msgInner) {
|
||||||
log("ignored message "+JSON.stringify(msg.data));
|
log("ignored message " + JSON.stringify(msgInner.data));
|
||||||
};
|
};
|
||||||
let { isDebugBuild, umask } = msg.data;
|
let { isDebugBuild, umask } = msg.data;
|
||||||
try {
|
try {
|
||||||
|
|
@ -34,13 +35,13 @@ function finish() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function ok(condition, description) {
|
function ok(condition, description) {
|
||||||
send({kind: "ok", condition: condition, description:description});
|
send({kind: "ok", condition, description});
|
||||||
}
|
}
|
||||||
function is(a, b, description) {
|
function is(a, b, description) {
|
||||||
send({kind: "is", a: a, b:b, description:description});
|
send({kind: "is", a, b, description});
|
||||||
}
|
}
|
||||||
function isnot(a, b, description) {
|
function isnot(a, b, description) {
|
||||||
send({kind: "isnot", a: a, b:b, description:description});
|
send({kind: "isnot", a, b, description});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test that OS.Constants.Sys.Name is defined
|
// Test that OS.Constants.Sys.Name is defined
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
/* Any copyright is dedicated to the Public Domain.
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
Cu.importGlobalProperties(['fetch']);
|
Cu.importGlobalProperties(["fetch"]);
|
||||||
ChromeUtils.import("resource://testing-common/httpd.js");
|
ChromeUtils.import("resource://testing-common/httpd.js");
|
||||||
|
|
||||||
const BinaryInputStream = Components.Constructor("@mozilla.org/binaryinputstream;1",
|
const BinaryInputStream = Components.Constructor("@mozilla.org/binaryinputstream;1",
|
||||||
|
|
@ -16,7 +16,7 @@ function getBaseUrl () {
|
||||||
// a way to create some test defaults
|
// a way to create some test defaults
|
||||||
function createTestData(testPath) {
|
function createTestData(testPath) {
|
||||||
return {
|
return {
|
||||||
testPath: testPath,
|
testPath,
|
||||||
request: {
|
request: {
|
||||||
headers: {},
|
headers: {},
|
||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
|
|
@ -26,7 +26,7 @@ function createTestData(testPath) {
|
||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
body: "{\"Look\": \"Success!\"}",
|
body: "{\"Look\": \"Success!\"}",
|
||||||
status: 200,
|
status: 200,
|
||||||
statusText: "OK"
|
statusText: "OK",
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
@ -262,8 +262,8 @@ add_test(function test_PostJSONData() {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: testData.request.body,
|
body: testData.request.body,
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
"Content-Type": "application/json",
|
||||||
}
|
},
|
||||||
}).then(function(aResponse) {
|
}).then(function(aResponse) {
|
||||||
Assert.ok(aResponse.ok);
|
Assert.ok(aResponse.ok);
|
||||||
Assert.equal(aResponse.status, testData.response.status);
|
Assert.equal(aResponse.status, testData.response.status);
|
||||||
|
|
@ -308,8 +308,8 @@ add_test(function test_PostTextData() {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: testData.request.body,
|
body: testData.request.body,
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': testData.request.contentType
|
"Content-Type": testData.request.contentType,
|
||||||
}
|
},
|
||||||
}).then(function(aResponse) {
|
}).then(function(aResponse) {
|
||||||
Assert.ok(aResponse.ok);
|
Assert.ok(aResponse.ok);
|
||||||
Assert.equal(aResponse.status, testData.response.status);
|
Assert.equal(aResponse.status, testData.response.status);
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,17 @@
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
// Hack around Promise.jsm being stuck on my global
|
// Hack around Promise.jsm being stuck on my global
|
||||||
Assert.equal(false, PromiseDebugging === undefined);
|
Assert.equal(false, PromiseDebugging === undefined);
|
||||||
var res;
|
var res;
|
||||||
var p = new Promise(function(resolve, reject) { res = resolve });
|
var p = new Promise(function(resolve, reject) { res = resolve; });
|
||||||
var state = PromiseDebugging.getState(p);
|
var state = PromiseDebugging.getState(p);
|
||||||
Assert.equal(state.state, "pending");
|
Assert.equal(state.state, "pending");
|
||||||
|
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
|
|
||||||
p.then(function() {
|
p.then(function() {
|
||||||
var state = PromiseDebugging.getState(p);
|
var state2 = PromiseDebugging.getState(p);
|
||||||
Assert.equal(state.state, "fulfilled");
|
Assert.equal(state2.state, "fulfilled");
|
||||||
Assert.equal(state.value, 5);
|
Assert.equal(state2.value, 5);
|
||||||
do_test_finished();
|
do_test_finished();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,7 @@
|
||||||
|
|
||||||
Cu.importGlobalProperties(["DOMParser"]);
|
Cu.importGlobalProperties(["DOMParser"]);
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
var domParser = new DOMParser();
|
var domParser = new DOMParser();
|
||||||
var aDom = domParser.parseFromString("<root><feed><entry/><entry/></feed></root>",
|
var aDom = domParser.parseFromString("<root><feed><entry/><entry/></feed></root>",
|
||||||
"application/xml");
|
"application/xml");
|
||||||
|
|
|
||||||
|
|
@ -2,16 +2,14 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
*/
|
*/
|
||||||
|
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
const ios = Cc["@mozilla.org/network/io-service;1"]
|
|
||||||
.getService(Ci.nsIIOService);
|
|
||||||
const str = "javascript:10";
|
const str = "javascript:10";
|
||||||
var uri = ios.newURI(str);
|
var uri = Services.io.newURI(str);
|
||||||
var uri2 = ios.newURI(str);
|
var uri2 = Services.io.newURI(str);
|
||||||
const str2 = "http://example.org";
|
const str2 = "http://example.org";
|
||||||
var uri3 = ios.newURI(str2);
|
var uri3 = Services.io.newURI(str2);
|
||||||
Assert.ok(uri.equals(uri));
|
Assert.ok(uri.equals(uri));
|
||||||
Assert.ok(uri.equals(uri2));
|
Assert.ok(uri.equals(uri2));
|
||||||
Assert.ok(uri2.equals(uri));
|
Assert.ok(uri2.equals(uri));
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
function successCallback() {
|
function successCallback() {
|
||||||
Assert.ok(false);
|
Assert.ok(false);
|
||||||
do_test_finished();
|
do_test_finished();
|
||||||
|
|
@ -10,23 +12,20 @@ function errorCallback(err) {
|
||||||
do_test_finished();
|
do_test_finished();
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
|
|
||||||
if (Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime)
|
if (Services.appinfo.processType == Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT) {
|
||||||
.processType == Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT) {
|
|
||||||
// XPCShell does not get a profile by default. The geolocation service
|
// XPCShell does not get a profile by default. The geolocation service
|
||||||
// depends on the settings service which uses IndexedDB and IndexedDB
|
// depends on the settings service which uses IndexedDB and IndexedDB
|
||||||
// needs a place where it can store databases.
|
// needs a place where it can store databases.
|
||||||
do_get_profile();
|
do_get_profile();
|
||||||
|
|
||||||
var prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
|
Services.prefs.setBoolPref("geo.wifi.scan", false);
|
||||||
prefs.setBoolPref("geo.wifi.scan", false);
|
Services.prefs.setCharPref("geo.wifi.uri", "UrlNotUsedHere:");
|
||||||
prefs.setCharPref("geo.wifi.uri", "UrlNotUsedHere:");
|
Services.prefs.setBoolPref("dom.testing.ignore_ipc_principal", true);
|
||||||
prefs.setBoolPref("dom.testing.ignore_ipc_principal", true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
geolocation = Cc["@mozilla.org/geolocation;1"].getService(Ci.nsISupports);
|
var geolocation = Cc["@mozilla.org/geolocation;1"].getService(Ci.nsISupports);
|
||||||
geolocation.getCurrentPosition(successCallback, errorCallback);
|
geolocation.getCurrentPosition(successCallback, errorCallback);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,9 @@
|
||||||
function run_test() {
|
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
var prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
|
|
||||||
prefs.setBoolPref("geo.wifi.scan", false);
|
|
||||||
|
|
||||||
prefs.setCharPref("geo.wifi.uri", "UrlNotUsedHere");
|
function run_test() {
|
||||||
prefs.setBoolPref("dom.testing.ignore_ipc_principal", true);
|
Services.prefs.setBoolPref("geo.wifi.scan", false);
|
||||||
|
|
||||||
|
Services.prefs.setCharPref("geo.wifi.uri", "UrlNotUsedHere");
|
||||||
|
Services.prefs.setBoolPref("dom.testing.ignore_ipc_principal", true);
|
||||||
run_test_in_child("./test_geolocation_position_unavailable.js");
|
run_test_in_child("./test_geolocation_position_unavailable.js");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,10 @@
|
||||||
ChromeUtils.import("resource://testing-common/httpd.js");
|
ChromeUtils.import("resource://testing-common/httpd.js");
|
||||||
|
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
var httpserver = null;
|
var httpserver = null;
|
||||||
var geolocation = null;
|
var geolocation = null;
|
||||||
var success = false;
|
var success = false;
|
||||||
var watchId = -1;
|
var watchID = -1;
|
||||||
|
|
||||||
function terminate(succ) {
|
function terminate(succ) {
|
||||||
success = succ;
|
success = succ;
|
||||||
|
|
@ -14,14 +15,9 @@ function successCallback(pos){ terminate(true); }
|
||||||
function errorCallback(pos) { terminate(false); }
|
function errorCallback(pos) { terminate(false); }
|
||||||
|
|
||||||
var observer = {
|
var observer = {
|
||||||
QueryInterface: function(iid) {
|
QueryInterface: ChromeUtils.generateQI(["nsIObserver"]),
|
||||||
if (iid.equals(Ci.nsISupports) ||
|
|
||||||
iid.equals(Ci.nsIObserver))
|
|
||||||
return this;
|
|
||||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
|
||||||
},
|
|
||||||
|
|
||||||
observe: function(subject, topic, data) {
|
observe(subject, topic, data) {
|
||||||
if (data == "shutdown") {
|
if (data == "shutdown") {
|
||||||
Assert.ok(1);
|
Assert.ok(1);
|
||||||
this._numProviders--;
|
this._numProviders--;
|
||||||
|
|
@ -31,8 +27,7 @@ var observer = {
|
||||||
do_test_finished();
|
do_test_finished();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
} else if (data == "starting") {
|
||||||
else if (data == "starting") {
|
|
||||||
Assert.ok(1);
|
Assert.ok(1);
|
||||||
this._numProviders++;
|
this._numProviders++;
|
||||||
}
|
}
|
||||||
|
|
@ -41,8 +36,7 @@ var observer = {
|
||||||
_numProviders: 0,
|
_numProviders: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
function geoHandler(metadata, response)
|
function geoHandler(metadata, response) {
|
||||||
{
|
|
||||||
var georesponse = {
|
var georesponse = {
|
||||||
status: "OK",
|
status: "OK",
|
||||||
location: {
|
location: {
|
||||||
|
|
@ -58,8 +52,7 @@ function geoHandler(metadata, response)
|
||||||
response.write(position);
|
response.write(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
// XPCShell does not get a profile by default. The geolocation service
|
// XPCShell does not get a profile by default. The geolocation service
|
||||||
// depends on the settings service which uses IndexedDB and IndexedDB
|
// depends on the settings service which uses IndexedDB and IndexedDB
|
||||||
// needs a place where it can store databases.
|
// needs a place where it can store databases.
|
||||||
|
|
@ -72,11 +65,10 @@ function run_test()
|
||||||
httpserver.registerPathHandler("/geo", geoHandler);
|
httpserver.registerPathHandler("/geo", geoHandler);
|
||||||
httpserver.start(-1);
|
httpserver.start(-1);
|
||||||
|
|
||||||
var prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
|
Services.prefs.setCharPref("geo.wifi.uri", "http://localhost:" +
|
||||||
prefs.setCharPref("geo.wifi.uri", "http://localhost:" +
|
|
||||||
httpserver.identity.primaryPort + "/geo");
|
httpserver.identity.primaryPort + "/geo");
|
||||||
prefs.setBoolPref("dom.testing.ignore_ipc_principal", true);
|
Services.prefs.setBoolPref("dom.testing.ignore_ipc_principal", true);
|
||||||
prefs.setBoolPref("geo.wifi.scan", false);
|
Services.prefs.setBoolPref("geo.wifi.scan", false);
|
||||||
|
|
||||||
var obs = Cc["@mozilla.org/observer-service;1"].getService();
|
var obs = Cc["@mozilla.org/observer-service;1"].getService();
|
||||||
obs = obs.QueryInterface(Ci.nsIObserverService);
|
obs = obs.QueryInterface(Ci.nsIObserverService);
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
ChromeUtils.import("resource://testing-common/httpd.js");
|
ChromeUtils.import("resource://testing-common/httpd.js");
|
||||||
|
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
|
|
||||||
var httpserver = null;
|
var httpserver = null;
|
||||||
var geolocation = null;
|
var geolocation = null;
|
||||||
|
|
||||||
function geoHandler(metadata, response)
|
function geoHandler(metadata, response) {
|
||||||
{
|
|
||||||
response.processAsync();
|
response.processAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -19,8 +20,7 @@ function errorCallback() {
|
||||||
do_test_finished();
|
do_test_finished();
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
|
|
||||||
// XPCShell does not get a profile by default. The geolocation service
|
// XPCShell does not get a profile by default. The geolocation service
|
||||||
|
|
@ -31,14 +31,13 @@ function run_test()
|
||||||
httpserver = new HttpServer();
|
httpserver = new HttpServer();
|
||||||
httpserver.registerPathHandler("/geo", geoHandler);
|
httpserver.registerPathHandler("/geo", geoHandler);
|
||||||
httpserver.start(-1);
|
httpserver.start(-1);
|
||||||
var prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
|
Services.prefs.setCharPref("geo.wifi.uri", "http://localhost:" +
|
||||||
prefs.setCharPref("geo.wifi.uri", "http://localhost:" +
|
|
||||||
httpserver.identity.primaryPort + "/geo");
|
httpserver.identity.primaryPort + "/geo");
|
||||||
prefs.setBoolPref("dom.testing.ignore_ipc_principal", true);
|
Services.prefs.setBoolPref("dom.testing.ignore_ipc_principal", true);
|
||||||
prefs.setBoolPref("geo.wifi.scan", false);
|
Services.prefs.setBoolPref("geo.wifi.scan", false);
|
||||||
|
|
||||||
// Setting timeout to a very low value to ensure time out will happen.
|
// Setting timeout to a very low value to ensure time out will happen.
|
||||||
prefs.setIntPref("geo.wifi.xhr.timeout", 5);
|
Services.prefs.setIntPref("geo.wifi.xhr.timeout", 5);
|
||||||
|
|
||||||
geolocation = Cc["@mozilla.org/geolocation;1"].getService(Ci.nsISupports);
|
geolocation = Cc["@mozilla.org/geolocation;1"].getService(Ci.nsISupports);
|
||||||
geolocation.getCurrentPosition(successCallback, errorCallback);
|
geolocation.getCurrentPosition(successCallback, errorCallback);
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,12 @@
|
||||||
|
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
const providerCID = Components.ID("{14aa4b81-e266-45cb-88f8-89595dece114}");
|
const providerCID = Components.ID("{14aa4b81-e266-45cb-88f8-89595dece114}");
|
||||||
const providerContract = "@mozilla.org/geolocation/provider;1";
|
const providerContract = "@mozilla.org/geolocation/provider;1";
|
||||||
|
|
||||||
const categoryName = "geolocation-provider";
|
const categoryName = "geolocation-provider";
|
||||||
|
|
||||||
var provider = {
|
var provider = {
|
||||||
QueryInterface: function eventsink_qi(iid) {
|
QueryInterface: ChromeUtils.generateQI(["nsIFactory", "nsIGeolocationProvider"]),
|
||||||
if (iid.equals(Ci.nsISupports) ||
|
|
||||||
iid.equals(Ci.nsIFactory) ||
|
|
||||||
iid.equals(Ci.nsIGeolocationProvider))
|
|
||||||
return this;
|
|
||||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
|
||||||
},
|
|
||||||
createInstance: function eventsink_ci(outer, iid) {
|
createInstance: function eventsink_ci(outer, iid) {
|
||||||
if (outer)
|
if (outer)
|
||||||
throw Cr.NS_ERROR_NO_AGGREGATION;
|
throw Cr.NS_ERROR_NO_AGGREGATION;
|
||||||
|
|
@ -19,13 +15,13 @@ var provider = {
|
||||||
lockFactory: function eventsink_lockf(lock) {
|
lockFactory: function eventsink_lockf(lock) {
|
||||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||||
},
|
},
|
||||||
startup: function() {
|
startup() {
|
||||||
},
|
},
|
||||||
watch: function() {
|
watch() {
|
||||||
},
|
},
|
||||||
shutdown: function() {
|
shutdown() {
|
||||||
},
|
},
|
||||||
setHighAccuracy: function(enable) {
|
setHighAccuracy(enable) {
|
||||||
this._isHigh = enable;
|
this._isHigh = enable;
|
||||||
if (enable) {
|
if (enable) {
|
||||||
this._seenHigh = true;
|
this._seenHigh = true;
|
||||||
|
|
@ -33,25 +29,15 @@ var provider = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_isHigh: false,
|
_isHigh: false,
|
||||||
_seenHigh: false
|
_seenHigh: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
var runningInParent = true;
|
function successCallback() {
|
||||||
try {
|
|
||||||
runningInParent = Cc["@mozilla.org/xre/runtime;1"].
|
|
||||||
getService(Ci.nsIXULRuntime).processType
|
|
||||||
== Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
|
|
||||||
}
|
|
||||||
catch (e) { }
|
|
||||||
|
|
||||||
function successCallback()
|
|
||||||
{
|
|
||||||
Assert.ok(false);
|
Assert.ok(false);
|
||||||
do_test_finished();
|
do_test_finished();
|
||||||
}
|
}
|
||||||
|
|
||||||
function errorCallback()
|
function errorCallback() {
|
||||||
{
|
|
||||||
Assert.ok(false);
|
Assert.ok(false);
|
||||||
do_test_finished();
|
do_test_finished();
|
||||||
}
|
}
|
||||||
|
|
@ -59,8 +45,7 @@ function errorCallback()
|
||||||
var geolocation;
|
var geolocation;
|
||||||
var watchID2;
|
var watchID2;
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
if (runningInParent) {
|
if (runningInParent) {
|
||||||
// XPCShell does not get a profile by default. The geolocation service
|
// XPCShell does not get a profile by default. The geolocation service
|
||||||
// depends on the settings service which uses IndexedDB and IndexedDB
|
// depends on the settings service which uses IndexedDB and IndexedDB
|
||||||
|
|
@ -69,25 +54,23 @@ function run_test()
|
||||||
|
|
||||||
Components.manager.nsIComponentRegistrar.registerFactory(providerCID,
|
Components.manager.nsIComponentRegistrar.registerFactory(providerCID,
|
||||||
"Unit test geo provider", providerContract, provider);
|
"Unit test geo provider", providerContract, provider);
|
||||||
var catMan = Cc["@mozilla.org/categorymanager;1"]
|
|
||||||
.getService(Ci.nsICategoryManager);
|
Services.catMan.nsICategoryManager.addCategoryEntry(categoryName, "unit test",
|
||||||
catMan.nsICategoryManager.addCategoryEntry(categoryName, "unit test",
|
|
||||||
providerContract, false, true);
|
providerContract, false, true);
|
||||||
|
|
||||||
var prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
|
Services.prefs.setBoolPref("dom.testing.ignore_ipc_principal", true);
|
||||||
prefs.setBoolPref("dom.testing.ignore_ipc_principal", true);
|
Services.prefs.setBoolPref("geo.wifi.scan", false);
|
||||||
prefs.setBoolPref("geo.wifi.scan", false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
|
|
||||||
geolocation = Cc["@mozilla.org/geolocation;1"].createInstance(Ci.nsISupports);
|
geolocation = Cc["@mozilla.org/geolocation;1"].createInstance(Ci.nsISupports);
|
||||||
let watchID1 = geolocation.watchPosition(successCallback, errorCallback);
|
geolocation.watchPosition(successCallback, errorCallback);
|
||||||
watchID2 = geolocation.watchPosition(successCallback, errorCallback,
|
watchID2 = geolocation.watchPosition(successCallback, errorCallback,
|
||||||
{enableHighAccuracy: true});
|
{enableHighAccuracy: true});
|
||||||
|
|
||||||
if (!runningInParent) {
|
if (!runningInParent) {
|
||||||
do_await_remote_message('high_acc_enabled', stop_high_accuracy_watch);
|
do_await_remote_message("high_acc_enabled", stop_high_accuracy_watch);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -97,8 +80,7 @@ function stop_high_accuracy_watch() {
|
||||||
do_test_finished();
|
do_test_finished();
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_results()
|
function check_results() {
|
||||||
{
|
|
||||||
if (runningInParent) {
|
if (runningInParent) {
|
||||||
// check the provider was set to high accuracy during the test
|
// check the provider was set to high accuracy during the test
|
||||||
Assert.ok(provider._seenHigh);
|
Assert.ok(provider._seenHigh);
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,12 @@
|
||||||
|
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
const providerCID = Components.ID("{14aa4b81-e266-45cb-88f8-89595dece114}");
|
const providerCID = Components.ID("{14aa4b81-e266-45cb-88f8-89595dece114}");
|
||||||
const providerContract = "@mozilla.org/geolocation/provider;1";
|
const providerContract = "@mozilla.org/geolocation/provider;1";
|
||||||
|
|
||||||
const categoryName = "geolocation-provider";
|
const categoryName = "geolocation-provider";
|
||||||
|
|
||||||
var provider = {
|
var provider = {
|
||||||
QueryInterface: function eventsink_qi(iid) {
|
QueryInterface: ChromeUtils.generateQI(["nsIFactory", "nsIGeolocationProvider"]),
|
||||||
if (iid.equals(Ci.nsISupports) ||
|
|
||||||
iid.equals(Ci.nsIFactory) ||
|
|
||||||
iid.equals(Ci.nsIGeolocationProvider))
|
|
||||||
return this;
|
|
||||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
|
||||||
},
|
|
||||||
createInstance: function eventsink_ci(outer, iid) {
|
createInstance: function eventsink_ci(outer, iid) {
|
||||||
if (outer)
|
if (outer)
|
||||||
throw Cr.NS_ERROR_NO_AGGREGATION;
|
throw Cr.NS_ERROR_NO_AGGREGATION;
|
||||||
|
|
@ -19,25 +15,24 @@ var provider = {
|
||||||
lockFactory: function eventsink_lockf(lock) {
|
lockFactory: function eventsink_lockf(lock) {
|
||||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||||
},
|
},
|
||||||
startup: function() {
|
startup() {
|
||||||
},
|
},
|
||||||
watch: function() {
|
watch() {
|
||||||
},
|
},
|
||||||
shutdown: function() {
|
shutdown() {
|
||||||
},
|
},
|
||||||
setHighAccuracy: function(enable) {
|
setHighAccuracy(enable) {
|
||||||
this._isHigh = enable;
|
this._isHigh = enable;
|
||||||
if (enable) {
|
if (enable) {
|
||||||
this._seenHigh = true;
|
this._seenHigh = true;
|
||||||
do_send_remote_message('high_acc_enabled');
|
do_send_remote_message("high_acc_enabled");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_isHigh: false,
|
_isHigh: false,
|
||||||
_seenHigh: false
|
_seenHigh: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
// XPCShell does not get a profile by default. The geolocation service
|
// XPCShell does not get a profile by default. The geolocation service
|
||||||
// depends on the settings service which uses IndexedDB and IndexedDB
|
// depends on the settings service which uses IndexedDB and IndexedDB
|
||||||
// needs a place where it can store databases.
|
// needs a place where it can store databases.
|
||||||
|
|
@ -45,20 +40,17 @@ function run_test()
|
||||||
|
|
||||||
Components.manager.nsIComponentRegistrar.registerFactory(providerCID,
|
Components.manager.nsIComponentRegistrar.registerFactory(providerCID,
|
||||||
"Unit test geo provider", providerContract, provider);
|
"Unit test geo provider", providerContract, provider);
|
||||||
var catMan = Cc["@mozilla.org/categorymanager;1"]
|
|
||||||
.getService(Ci.nsICategoryManager);
|
Services.catMan.nsICategoryManager.addCategoryEntry(categoryName, "unit test",
|
||||||
catMan.nsICategoryManager.addCategoryEntry(categoryName, "unit test",
|
|
||||||
providerContract, false, true);
|
providerContract, false, true);
|
||||||
|
|
||||||
var prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
|
Services.prefs.setBoolPref("dom.testing.ignore_ipc_principal", true);
|
||||||
prefs.setBoolPref("dom.testing.ignore_ipc_principal", true);
|
Services.prefs.setBoolPref("geo.wifi.scan", false);
|
||||||
prefs.setBoolPref("geo.wifi.scan", false);
|
|
||||||
|
|
||||||
run_test_in_child("test_geolocation_reset_accuracy.js", check_results);
|
run_test_in_child("test_geolocation_reset_accuracy.js", check_results);
|
||||||
}
|
}
|
||||||
|
|
||||||
function check_results()
|
function check_results() {
|
||||||
{
|
|
||||||
// check the provider was set to high accuracy during the test
|
// check the provider was set to high accuracy during the test
|
||||||
Assert.ok(provider._seenHigh);
|
Assert.ok(provider._seenHigh);
|
||||||
// check the provider is not currently set to high accuracy
|
// check the provider is not currently set to high accuracy
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,13 @@
|
||||||
ChromeUtils.import("resource://testing-common/httpd.js");
|
ChromeUtils.import("resource://testing-common/httpd.js");
|
||||||
|
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
|
|
||||||
var httpserver = null;
|
var httpserver = null;
|
||||||
var geolocation = null;
|
var geolocation = null;
|
||||||
var success = false;
|
var success = false;
|
||||||
var watchId = -1;
|
var watchId = -1;
|
||||||
|
|
||||||
function geoHandler(metadata, response)
|
function geoHandler(metadata, response) {
|
||||||
{
|
|
||||||
var georesponse = {
|
var georesponse = {
|
||||||
status: "OK",
|
status: "OK",
|
||||||
location: {
|
location: {
|
||||||
|
|
@ -36,12 +37,10 @@ function errorCallback() {
|
||||||
do_test_finished();
|
do_test_finished();
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
do_test_pending();
|
do_test_pending();
|
||||||
|
|
||||||
if (Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime)
|
if (Services.appinfo.processType == Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT) {
|
||||||
.processType == Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT) {
|
|
||||||
// XPCShell does not get a profile by default. The geolocation service
|
// XPCShell does not get a profile by default. The geolocation service
|
||||||
// depends on the settings service which uses IndexedDB and IndexedDB
|
// depends on the settings service which uses IndexedDB and IndexedDB
|
||||||
// needs a place where it can store databases.
|
// needs a place where it can store databases.
|
||||||
|
|
@ -50,11 +49,10 @@ function run_test()
|
||||||
httpserver = new HttpServer();
|
httpserver = new HttpServer();
|
||||||
httpserver.registerPathHandler("/geo", geoHandler);
|
httpserver.registerPathHandler("/geo", geoHandler);
|
||||||
httpserver.start(-1);
|
httpserver.start(-1);
|
||||||
var prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
|
Services.prefs.setBoolPref("geo.wifi.scan", false);
|
||||||
prefs.setBoolPref("geo.wifi.scan", false);
|
Services.prefs.setCharPref("geo.wifi.uri", "http://localhost:" +
|
||||||
prefs.setCharPref("geo.wifi.uri", "http://localhost:" +
|
|
||||||
httpserver.identity.primaryPort + "/geo");
|
httpserver.identity.primaryPort + "/geo");
|
||||||
prefs.setBoolPref("dom.testing.ignore_ipc_principal", true);
|
Services.prefs.setBoolPref("dom.testing.ignore_ipc_principal", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
geolocation = Cc["@mozilla.org/geolocation;1"].getService(Ci.nsISupports);
|
geolocation = Cc["@mozilla.org/geolocation;1"].getService(Ci.nsISupports);
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,16 @@
|
||||||
ChromeUtils.import("resource://testing-common/httpd.js");
|
ChromeUtils.import("resource://testing-common/httpd.js");
|
||||||
|
ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||||
|
|
||||||
|
|
||||||
var httpserver = null;
|
var httpserver = null;
|
||||||
|
|
||||||
function run_test() {
|
function run_test() {
|
||||||
var prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
|
Services.prefs.setBoolPref("geo.wifi.scan", false);
|
||||||
prefs.setBoolPref("geo.wifi.scan", false);
|
|
||||||
|
|
||||||
httpserver = new HttpServer();
|
httpserver = new HttpServer();
|
||||||
httpserver.start(-1);
|
httpserver.start(-1);
|
||||||
prefs.setCharPref("geo.wifi.uri", "http://localhost:" +
|
Services.prefs.setCharPref("geo.wifi.uri", "http://localhost:" +
|
||||||
httpserver.identity.primaryPort + "/geo");
|
httpserver.identity.primaryPort + "/geo");
|
||||||
prefs.setBoolPref("dom.testing.ignore_ipc_principal", true);
|
Services.prefs.setBoolPref("dom.testing.ignore_ipc_principal", true);
|
||||||
run_test_in_child("./test_geolocation_timeout.js");
|
run_test_in_child("./test_geolocation_timeout.js");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
function run_test()
|
function run_test() {
|
||||||
{
|
|
||||||
Cu.importGlobalProperties(["XMLHttpRequest"]);
|
Cu.importGlobalProperties(["XMLHttpRequest"]);
|
||||||
|
|
||||||
var x = new XMLHttpRequest({mozAnon: true, mozSystem: false});
|
var x = new XMLHttpRequest({mozAnon: true, mozSystem: false});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue