mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
b6d6258762
- Bug 1182537 - Use channel->ascynOpen2 in dom/security/nsCORSListenerProxy (r=sicking) (5c4b779a12) - Bug 1155758 - Make about:serviceworkers work in B2G. r=fabrice (195eca3894) - Bug 1162920 - JavaScript error at aboutServiceWorkers.js when updating the service worker. r=fabrice (2d3a831a8c) - Bug 1155153 - [e10s] about:serviceworkers should work in e10s mode. Update B2G implementation. r=baku (0d1c2999c1) - Bug 1171915 - about:serviceworkers in b2g should use originAttributes when calling ServiceWorkerManager. r=baku,fabrice (faa3725da9) - Bug 1179161 - originAttributes does not have such isInBrowser member (follow-up bug 1171915). r=ferjm (a217140ae5) - Bug 1171917 - Improve about:serviceworkers tests on b2g. r=ferjm (5fd9d2f478) - Bug 1179557 - Add userContextId to originAttributes with tests. r=bholley, r=tanvi (8ddf96d921) - Bug 1179557 - Add getters for userContextId. r=bholley, r=tanvi (ebec5f7c7e) - Bug 1174110 - The service worker still remains registered when uninstalling the service-worker-enabled application. r=fabrice (c1c93b1250) - Bug 1144689 - Allow setting manually a fetch time and modified time for cache entries. r=fabrice (8e9dd47425) - Bug 1150199 - Langpacks should not have to be privileged r=ferjm (d41af25648) - Bug 1111961 - Developer mode support r=ferjm,pauljt (9b523402ac) - Bug 1168300 - notify clear-cookiejar-data. r=sicking (7d88bff29d) - Bug 1136434 - RequestSync API should delete all the timers when a task is unregistered, r=ehsan (5f92977920) - Bug 1151082 - RequestSyncAPI - avoid infinite loop when processing pending messages, r=ehsan (b5afcd55e8) - Bug 1165787 - Use origin in RequestSyncService.jsm. r=ehsan (b6fad2bd68) - Bug 1182347 - Migrate existing code away from .cookieJar. r=sicking,r=allstars.chh (304cbfd660) - Bug 1118946 - API to provide localized properties r=ferjm,sicking (a28aecaf19) - Bug 1077168 - Cancel in-flight Webapp install jobs from windows that change location. r=myk. (d55dc8ff6d) - Bug 1150660 - Fix sendAsyncMessage() uses to not trigger warnings in dom/apps r=fabrice (b087adcc23) - Bug 1169344 - Allow server apps to restrict access to their IAC ports. r=ferjm (82c8570555) - Bug 1068400 - Fix devtools when morphing non-e10s tab into e10s one. r=jryans (55be5ccdf5) - Bug 1145049 - Prevent caching tab actors in child processes. r=jryans (1a3ee9f278) - Bug 1145049 - Stop leaking tab actors and root actor on disconnect. r=jryans (26f259b441) - Bug 1181930 - Refactoring: move the message broadcaster out of Webapps.jsm r=ferjm (b1f8bb8b6d) - Bu 1115619 - Use a preference to guarantee app permission loading to permissions.sqlite. r=fabrice (5689c459d7) - Bug 1191579 - Remove useless getAll() implementation in Webapps.jsm (74f0d6874a)
143 lines
3.9 KiB
JavaScript
143 lines
3.9 KiB
JavaScript
/* Any copyright is dedicated to the Public Domain.
|
|
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
"use strict";
|
|
|
|
const {utils: Cu} = Components;
|
|
|
|
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
|
Cu.import("resource://gre/modules/Services.jsm");
|
|
|
|
XPCOMUtils.defineLazyModuleGetter(this, "AboutServiceWorkers",
|
|
"resource://gre/modules/AboutServiceWorkers.jsm");
|
|
|
|
XPCOMUtils.defineLazyServiceGetter(this, "gServiceWorkerManager",
|
|
"@mozilla.org/serviceworkers/manager;1",
|
|
"nsIServiceWorkerManager");
|
|
|
|
const CHROME_MSG = "mozAboutServiceWorkersChromeEvent";
|
|
|
|
const ORIGINAL_SENDRESULT = AboutServiceWorkers.sendResult;
|
|
const ORIGINAL_SENDERROR = AboutServiceWorkers.sendError;
|
|
|
|
do_get_profile();
|
|
|
|
let mockSendResult = (aId, aResult) => {
|
|
let msg = {
|
|
id: aId,
|
|
result: aResult
|
|
};
|
|
Services.obs.notifyObservers({wrappedJSObject: msg}, CHROME_MSG, null);
|
|
};
|
|
|
|
let mockSendError = (aId, aError) => {
|
|
let msg = {
|
|
id: aId,
|
|
result: aError
|
|
};
|
|
Services.obs.notifyObservers({wrappedJSObject: msg}, CHROME_MSG, null);
|
|
};
|
|
|
|
function attachMocks() {
|
|
AboutServiceWorkers.sendResult = mockSendResult;
|
|
AboutServiceWorkers.sendError = mockSendError;
|
|
}
|
|
|
|
function restoreMocks() {
|
|
AboutServiceWorkers.sendResult = ORIGINAL_SENDRESULT;
|
|
AboutServiceWorkers.sendError = ORIGINAL_SENDERROR;
|
|
}
|
|
|
|
do_register_cleanup(restoreMocks);
|
|
|
|
function run_test() {
|
|
run_next_test();
|
|
}
|
|
|
|
/**
|
|
* "init" tests
|
|
*/
|
|
[
|
|
// Pref disabled, no registrations
|
|
{
|
|
prefEnabled: false,
|
|
expectedMessage: {
|
|
id: Date.now(),
|
|
result: {
|
|
enabled: false,
|
|
registrations: []
|
|
}
|
|
}
|
|
},
|
|
// Pref enabled, no registrations
|
|
{
|
|
prefEnabled: true,
|
|
expectedMessage: {
|
|
id: Date.now(),
|
|
result: {
|
|
enabled: true,
|
|
registrations: []
|
|
}
|
|
}
|
|
}].forEach(test => {
|
|
add_test(function() {
|
|
Services.prefs.setBoolPref("dom.serviceWorkers.enabled", test.prefEnabled);
|
|
|
|
let id = test.expectedMessage.id;
|
|
|
|
function onMessage(subject, topic, data) {
|
|
let message = subject.wrappedJSObject;
|
|
let expected = test.expectedMessage;
|
|
|
|
do_check_true(message.id, "Message should have id");
|
|
do_check_eq(message.id, test.expectedMessage.id,
|
|
"Id should be the expected one");
|
|
do_check_eq(message.result.enabled, expected.result.enabled,
|
|
"Pref should be disabled");
|
|
do_check_true(message.result.registrations, "Registrations should exist");
|
|
do_check_eq(message.result.registrations.length,
|
|
expected.result.registrations.length,
|
|
"Registrations length should be the expected one");
|
|
|
|
Services.obs.removeObserver(onMessage, CHROME_MSG);
|
|
|
|
run_next_test();
|
|
}
|
|
|
|
Services.obs.addObserver(onMessage, CHROME_MSG, false);
|
|
|
|
attachMocks();
|
|
|
|
AboutServiceWorkers.handleEvent({ detail: {
|
|
id: id,
|
|
name: "init"
|
|
}});
|
|
});
|
|
});
|
|
|
|
/**
|
|
* ServiceWorkerManager tests.
|
|
*/
|
|
|
|
// We cannot register a sw via ServiceWorkerManager cause chrome
|
|
// registrations are not allowed.
|
|
// All we can do for now is to test the interface of the swm.
|
|
add_test(function test_swm() {
|
|
do_check_true(gServiceWorkerManager, "SWM exists");
|
|
do_check_true(gServiceWorkerManager.getAllRegistrations,
|
|
"SWM.getAllRegistrations exists");
|
|
do_check_true(typeof gServiceWorkerManager.getAllRegistrations == "function",
|
|
"SWM.getAllRegistrations is a function");
|
|
do_check_true(gServiceWorkerManager.propagateSoftUpdate,
|
|
"SWM.propagateSoftUpdate exists");
|
|
do_check_true(typeof gServiceWorkerManager.propagateSoftUpdate == "function",
|
|
|
|
"SWM.propagateSoftUpdate is a function");
|
|
do_check_true(gServiceWorkerManager.propagateUnregister,
|
|
"SWM.propagateUnregister exists");
|
|
do_check_true(typeof gServiceWorkerManager.propagateUnregister == "function",
|
|
"SWM.propagateUnregister exists");
|
|
|
|
run_next_test();
|
|
});
|