mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-01 05:48:26 +00:00
Bug 1133282 - Remove nonstandard expression closures from netwerk. r=mcmanus
This commit is contained in:
parent
c5a2a88f83
commit
fca55838eb
@ -30,7 +30,7 @@ var gUpdatedOverrides;
|
||||
var gOverrideForHostCache = new Map;
|
||||
var gInitialized = false;
|
||||
var gOverrideFunctions = [
|
||||
function (aHttpChannel) UserAgentOverrides.getOverrideForURI(aHttpChannel.URI)
|
||||
function (aHttpChannel) { return UserAgentOverrides.getOverrideForURI(aHttpChannel.URI); }
|
||||
];
|
||||
var gBuiltUAs = new Map;
|
||||
|
||||
@ -57,7 +57,7 @@ this.UserAgentOverrides = {
|
||||
for (let domain in overrides) {
|
||||
overrides[domain] = getUserAgentFromOverride(overrides[domain]);
|
||||
}
|
||||
overrides.get = function(key) this[key];
|
||||
overrides.get = function(key) { return this[key]; };
|
||||
}
|
||||
gUpdatedOverrides = overrides;
|
||||
});
|
||||
|
@ -26,16 +26,17 @@ XPCOMUtils.defineLazyServiceGetter(
|
||||
this, "gUpdateTimer", "@mozilla.org/updates/timer-manager;1", "nsIUpdateTimerManager");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "gApp",
|
||||
function() Cc["@mozilla.org/xre/app-info;1"]
|
||||
.getService(Ci.nsIXULAppInfo).QueryInterface(Ci.nsIXULRuntime)
|
||||
);
|
||||
function() {
|
||||
return Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULAppInfo)
|
||||
.QueryInterface(Ci.nsIXULRuntime);
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "gDecoder",
|
||||
function() new TextDecoder()
|
||||
function() { return new TextDecoder(); }
|
||||
);
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "gEncoder",
|
||||
function() new TextEncoder()
|
||||
function() { return new TextEncoder(); }
|
||||
);
|
||||
|
||||
const TIMER_ID = "user-agent-updates-timer";
|
||||
@ -143,17 +144,19 @@ this.UserAgentUpdates = {
|
||||
}
|
||||
},
|
||||
|
||||
_getParameters: function() ({
|
||||
"%DATE%": function() Date.now().toString(),
|
||||
"%PRODUCT%": function() gApp.name,
|
||||
"%APP_ID%": function() gApp.ID,
|
||||
"%APP_VERSION%": function() gApp.version,
|
||||
"%BUILD_ID%": function() gApp.appBuildID,
|
||||
"%OS%": function() gApp.OS,
|
||||
"%CHANNEL%": function() UpdateChannel.get(),
|
||||
"%DISTRIBUTION%": function() this._getPref(PREF_APP_DISTRIBUTION, ""),
|
||||
"%DISTRIBUTION_VERSION%": function() this._getPref(PREF_APP_DISTRIBUTION_VERSION, ""),
|
||||
}),
|
||||
_getParameters() {
|
||||
return {
|
||||
"%DATE%": function() { return Date.now().toString(); },
|
||||
"%PRODUCT%": function() { return gApp.name; },
|
||||
"%APP_ID%": function() { return gApp.ID; },
|
||||
"%APP_VERSION%": function() { return gApp.version; },
|
||||
"%BUILD_ID%": function() { return gApp.appBuildID; },
|
||||
"%OS%": function() { return gApp.OS; },
|
||||
"%CHANNEL%": function() { return UpdateChannel.get(); },
|
||||
"%DISTRIBUTION%": function() { return this._getPref(PREF_APP_DISTRIBUTION, ""); },
|
||||
"%DISTRIBUTION_VERSION%": function() { return this._getPref(PREF_APP_DISTRIBUTION_VERSION, ""); },
|
||||
};
|
||||
},
|
||||
|
||||
_getUpdateURL: function() {
|
||||
let url = this._getPref(PREF_UPDATES_URL, "");
|
||||
|
@ -34,7 +34,7 @@ function run_test()
|
||||
function succeeded(ch, cx, status, data)
|
||||
{
|
||||
do_check_true(Components.isSuccessCode(status));
|
||||
do_check_eq(data.map(function(v) String.fromCharCode(v)).join(""), "1234");
|
||||
do_check_eq(data.map(v => String.fromCharCode(v)).join(""), "1234");
|
||||
}
|
||||
|
||||
function check_1234(ch, cx)
|
||||
|
@ -231,7 +231,7 @@ function testOverrides(callback) {
|
||||
SpecialPowers.pushPrefEnv({
|
||||
set: [[PREF_OVERRIDES_ENABLED, true]]
|
||||
}, function nextTest() {
|
||||
testUA(tests.shift(), function () tests.length ? nextTest() : callback());
|
||||
testUA(tests.shift(), function() { tests.length ? nextTest() : callback() });
|
||||
});
|
||||
}
|
||||
|
||||
@ -243,11 +243,11 @@ SimpleTest.requestCompleteLog();
|
||||
|
||||
info(SpecialPowers.Cc["@mozilla.org/dom/site-specific-user-agent;1"].number);
|
||||
|
||||
testOverrides(function ()
|
||||
testInactive(function ()
|
||||
testOverrides(function() {
|
||||
testInactive(function() {
|
||||
testPriority(SimpleTest.finish)
|
||||
)
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
|
@ -120,7 +120,7 @@ function testDownload(callback) {
|
||||
[PREF_UPDATES_TIMEOUT, 10000],
|
||||
[PREF_UPDATES_INTERVAL, 1] // 1 second interval
|
||||
]
|
||||
}, function waitForUpdate() setTimeout(function () {
|
||||
}, function waitForUpdate() { setTimeout(function () {
|
||||
var ifr = document.createElement('IFRAME');
|
||||
ifr.src = "about:blank";
|
||||
|
||||
@ -146,7 +146,7 @@ function testDownload(callback) {
|
||||
}, false);
|
||||
|
||||
document.getElementById('content').appendChild(ifr);
|
||||
}, 100));
|
||||
}, 100); });
|
||||
}
|
||||
|
||||
function testBadUpdate(callback) {
|
||||
@ -157,7 +157,7 @@ function testBadUpdate(callback) {
|
||||
[PREF_UPDATES_URL, url],
|
||||
[PREF_UPDATES_INTERVAL, 1] // 1 second interval
|
||||
]
|
||||
}, function () setTimeout(function () {
|
||||
}, function () { setTimeout(function () {
|
||||
var ifr = document.createElement('IFRAME');
|
||||
ifr.src = "about:blank";
|
||||
|
||||
@ -171,7 +171,7 @@ function testBadUpdate(callback) {
|
||||
callback();
|
||||
}, false);
|
||||
document.getElementById('content').appendChild(ifr);
|
||||
}, 5000));
|
||||
}, 5000); });
|
||||
}
|
||||
|
||||
function testProfileLoad(callback) {
|
||||
@ -281,13 +281,13 @@ SpecialPowers.pushPrefEnv({
|
||||
// testProfileLoad, testDownload, and testProfileSave must run in this order
|
||||
// because testDownload depends on testProfileLoad to call UAO.init()
|
||||
// and testProfileSave depends on testDownload to save overrides to the profile
|
||||
testProfileLoad(function()
|
||||
testDownload(function()
|
||||
testBadUpdate(function()
|
||||
testProfileLoad(function() {
|
||||
testDownload(function() {
|
||||
testBadUpdate(function() {
|
||||
testProfileSave(SimpleTest.finish)
|
||||
)
|
||||
)
|
||||
);
|
||||
})
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
@ -31,8 +31,8 @@ var listener = {
|
||||
// works correctly
|
||||
request.suspend();
|
||||
request.suspend();
|
||||
do_timeout(RESUME_DELAY, function() request.resume());
|
||||
do_timeout(RESUME_DELAY + 1000, function() request.resume());
|
||||
do_timeout(RESUME_DELAY, function() { request.resume(); });
|
||||
do_timeout(RESUME_DELAY + 1000, function() { request.resume(); });
|
||||
},
|
||||
|
||||
onDataAvailable: function(request, context, stream, offset, count) {
|
||||
|
@ -42,11 +42,11 @@ var listener = {
|
||||
case 1:
|
||||
request.suspend();
|
||||
syncXHR();
|
||||
do_execute_soon(function() request.resume());
|
||||
do_execute_soon(function() { request.resume(); });
|
||||
break;
|
||||
case 2:
|
||||
do_execute_soon(function() request.suspend());
|
||||
do_execute_soon(function() request.resume());
|
||||
do_execute_soon(function() { request.suspend(); });
|
||||
do_execute_soon(function() { request.resume(); });
|
||||
syncXHR();
|
||||
break;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user