зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 2 changesets (bug 1598629) for causing a high devtools failure rate in browser_application_panel_debug-service-worker.js
Backed out changeset 472f8d632630 (bug 1598629) Backed out changeset 70bde5ea35f6 (bug 1598629) --HG-- rename : devtools/client/application/src/modules/application-services.js => devtools/client/application/src/modules/services.js extra : rebase_source : 86e1193b04ea009195075d59c723a48443f23857
This commit is contained in:
Родитель
cdbba16564
Коммит
a6ddb4b9b8
|
@ -28,7 +28,7 @@ const actions = require("./src/actions/index");
|
|||
|
||||
const { WorkersListener } = require("devtools/client/shared/workers-listener");
|
||||
|
||||
const { services } = require("./src/modules/application-services");
|
||||
const { services } = require("./src/modules/services");
|
||||
|
||||
const App = createFactory(require("./src/components/App"));
|
||||
|
||||
|
@ -49,6 +49,7 @@ window.Application = {
|
|||
|
||||
this.store = configureStore();
|
||||
this.actions = bindActionCreators(actions, this.store.dispatch);
|
||||
this.serviceWorkerRegistrationFronts = [];
|
||||
|
||||
services.init(this.toolbox);
|
||||
|
||||
|
@ -103,9 +104,7 @@ window.Application = {
|
|||
? (await this.deviceFront.getDescription()).canDebugServiceWorkers
|
||||
: false;
|
||||
|
||||
this.actions.updateCanDebugWorkers(
|
||||
canDebugWorkers && services.features.doesDebuggerSupportWorkers
|
||||
);
|
||||
this.actions.updateCanDebugWorkers(canDebugWorkers);
|
||||
},
|
||||
|
||||
destroy() {
|
||||
|
|
|
@ -6,10 +6,7 @@
|
|||
|
||||
const { l10n } = require("../modules/l10n");
|
||||
|
||||
const {
|
||||
services,
|
||||
ManifestDevToolsError,
|
||||
} = require("../modules/application-services");
|
||||
const { services, ManifestDevToolsError } = require("../modules/services");
|
||||
const {
|
||||
FETCH_MANIFEST_FAILURE,
|
||||
FETCH_MANIFEST_START,
|
||||
|
|
|
@ -31,11 +31,17 @@ const {
|
|||
const FluentReact = require("devtools/client/shared/vendor/fluent-react");
|
||||
const Localized = createFactory(FluentReact.Localized);
|
||||
|
||||
const { services } = require("../../modules/application-services");
|
||||
const Types = require("../../types/index");
|
||||
|
||||
const UIButton = createFactory(require("../ui/UIButton"));
|
||||
|
||||
loader.lazyRequireGetter(
|
||||
this,
|
||||
"gDevToolsBrowser",
|
||||
"devtools/client/framework/devtools-browser",
|
||||
true
|
||||
);
|
||||
|
||||
/**
|
||||
* This component is dedicated to display a worker, more accurately a service worker, in
|
||||
* the list of workers displayed in the application panel. It displays information about
|
||||
|
@ -64,7 +70,8 @@ class Worker extends PureComponent {
|
|||
return;
|
||||
}
|
||||
|
||||
services.openWorkerInDebugger(this.props.worker.workerTargetFront);
|
||||
const { workerTargetFront } = this.props.worker;
|
||||
gDevToolsBrowser.openWorkerToolbox(workerTargetFront);
|
||||
}
|
||||
|
||||
start() {
|
||||
|
|
|
@ -21,7 +21,7 @@ const {
|
|||
const FluentReact = require("devtools/client/shared/vendor/fluent-react");
|
||||
const Localized = createFactory(FluentReact.Localized);
|
||||
|
||||
const { services } = require("../../modules/application-services");
|
||||
const { services } = require("../../modules/services");
|
||||
|
||||
const DOC_URL =
|
||||
"https://developer.mozilla.org/docs/Web/API/Service_Worker_API/Using_Service_Workers" +
|
||||
|
|
|
@ -3,6 +3,6 @@
|
|||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
DevToolsModules(
|
||||
'application-services.js',
|
||||
'l10n.js',
|
||||
'services.js',
|
||||
)
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
const Services = require("Services");
|
||||
|
||||
class ManifestDevToolsError extends Error {
|
||||
constructor(...params) {
|
||||
super(...params);
|
||||
|
@ -14,16 +12,9 @@ class ManifestDevToolsError extends Error {
|
|||
}
|
||||
}
|
||||
|
||||
class ApplicationServices {
|
||||
class Services {
|
||||
init(toolbox) {
|
||||
this._toolbox = toolbox;
|
||||
|
||||
this.features = {
|
||||
doesDebuggerSupportWorkers: Services.prefs.getBoolPref(
|
||||
"devtools.debugger.features.windowless-service-workers",
|
||||
false
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
selectTool(toolId) {
|
||||
|
@ -31,11 +22,6 @@ class ApplicationServices {
|
|||
return this._toolbox.selectTool(toolId);
|
||||
}
|
||||
|
||||
async openWorkerInDebugger(workerTargetFront) {
|
||||
const debuggerPanel = await this.selectTool("jsdebugger");
|
||||
debuggerPanel.selectWorker(workerTargetFront);
|
||||
}
|
||||
|
||||
async fetchManifest() {
|
||||
let response;
|
||||
|
||||
|
@ -68,5 +54,5 @@ class ApplicationServices {
|
|||
module.exports = {
|
||||
ManifestDevToolsError,
|
||||
// exports a singleton, which will be used across all application panel modules
|
||||
services: new ApplicationServices(),
|
||||
services: new Services(),
|
||||
};
|
|
@ -30,7 +30,7 @@ support-files =
|
|||
[browser_application_panel_debug-service-worker.js]
|
||||
skip-if = debug || asan # Bug 1559591, 1575578
|
||||
[browser_application_panel_disable-start-service-worker.js]
|
||||
skip-if = (os == 'linux' && asan) || debug # Bug 1559487, 1559591
|
||||
skip-if = (os == 'linux' && asan) || debug || serviceworker_e10s # Bug 1559487, 1559591, 1447197
|
||||
[browser_application_panel_list-domain-workers.js]
|
||||
skip-if = debug # Bug 1559591
|
||||
[browser_application_panel_list-several-workers.js]
|
||||
|
@ -49,4 +49,4 @@ skip-if = true # Bug 1467256, 1559591
|
|||
[browser_application_panel_unregister-worker.js]
|
||||
skip-if = debug # Bug 1559591
|
||||
[browser_application_panel_start-service-worker.js]
|
||||
skip-if = (os == 'linux' && asan) || debug # Bug 1559487, 1559591
|
||||
skip-if = (os == 'linux' && asan) || debug # Bug 1559487, 1559591, 1447197
|
||||
|
|
|
@ -20,10 +20,7 @@ const TAB_URL = URL_ROOT + "resources/service-workers/debug.html";
|
|||
add_task(async function() {
|
||||
await enableApplicationPanel();
|
||||
|
||||
const { panel, tab, target, toolbox } = await openNewTabAndApplicationPanel(
|
||||
TAB_URL
|
||||
);
|
||||
|
||||
const { panel, tab, target } = await openNewTabAndApplicationPanel(TAB_URL);
|
||||
const doc = panel.panelWin.document;
|
||||
|
||||
selectPage(panel, "service-workers");
|
||||
|
@ -38,28 +35,39 @@ add_task(async function() {
|
|||
return button && !button.disabled;
|
||||
});
|
||||
|
||||
info("Click on the debug button and wait for debugger to be ready");
|
||||
info("Click on the debug button and wait for the new toolbox to be ready");
|
||||
const onToolboxReady = gDevTools.once("toolbox-ready");
|
||||
|
||||
const debugButton = container.querySelector(".js-debug-button");
|
||||
debugButton.click();
|
||||
await waitFor(() => toolbox.getPanel("jsdebugger"));
|
||||
|
||||
// add a breakpoint at line 11
|
||||
const debuggerContext = createDebuggerContext(toolbox);
|
||||
const serviceWorkerToolbox = await onToolboxReady;
|
||||
await serviceWorkerToolbox.selectTool("jsdebugger");
|
||||
const debuggerContext = createDebuggerContext(serviceWorkerToolbox);
|
||||
|
||||
await waitForSources(debuggerContext, "debug-sw.js");
|
||||
await selectSource(debuggerContext, "debug-sw.js");
|
||||
await waitForLoadedSource(debuggerContext, "debug-sw.js");
|
||||
await addBreakpoint(debuggerContext, "debug-sw.js", 11);
|
||||
|
||||
// force a pause at the breakpoint
|
||||
info("Invoke fetch, expect the service worker script to pause on line 11");
|
||||
await ContentTask.spawn(tab.linkedBrowser, {}, async function() {
|
||||
content.wrappedJSObject.fetchFromWorker();
|
||||
});
|
||||
await addBreakpoint(debuggerContext, "debug-sw.js", 8);
|
||||
|
||||
info(
|
||||
"Reload the main tab, expect the service worker script to pause on line 8"
|
||||
);
|
||||
tab.linkedBrowser.reload();
|
||||
|
||||
await waitForPaused(debuggerContext);
|
||||
assertPausedLocation(debuggerContext);
|
||||
await resume(debuggerContext);
|
||||
|
||||
// remove breakpoint
|
||||
const workerScript = findSource(debuggerContext, "debug-sw.js");
|
||||
await removeBreakpoint(debuggerContext, workerScript.id, 11);
|
||||
await removeBreakpoint(debuggerContext, workerScript.id, 8);
|
||||
|
||||
info("Destroy the worker toolbox");
|
||||
await serviceWorkerToolbox.destroy();
|
||||
|
||||
info("Wait until the focus goes back to the main window");
|
||||
await waitUntil(() => gBrowser.selectedBrowser === tab.linkedBrowser);
|
||||
|
||||
await unregisterAllWorkers(target.client);
|
||||
});
|
||||
|
|
|
@ -11,19 +11,9 @@ const TAB_URL = URL_ROOT + "resources/service-workers/simple.html";
|
|||
add_task(async function() {
|
||||
await enableApplicationPanel();
|
||||
|
||||
// Setting a low idle_timeout and idle_extended_timeout will allow the service worker
|
||||
// to reach the STOPPED state quickly, which will allow us to test the start button.
|
||||
// The default value is 30000 milliseconds.
|
||||
info("Set a low service worker idle timeout");
|
||||
await pushPref("dom.serviceWorkers.idle_timeout", 1000);
|
||||
await pushPref("dom.serviceWorkers.idle_extended_timeout", 1000);
|
||||
|
||||
// disable sw debugging
|
||||
// disable sw debugging by increasing the # of processes and thus multi-e10s kicking in
|
||||
info("Disable service worker debugging");
|
||||
await pushPref(
|
||||
"devtools.debugger.features.windowless-service-workers",
|
||||
false
|
||||
);
|
||||
await pushPref("dom.ipc.processCount", 8);
|
||||
|
||||
const { panel, tab, target } = await openNewTabAndApplicationPanel(TAB_URL);
|
||||
const doc = panel.panelWin.document;
|
||||
|
|
|
@ -25,9 +25,6 @@ async function enableServiceWorkerDebugging() {
|
|||
// SW debugging in multi-e10s.
|
||||
await pushPref("dom.ipc.processCount", 1);
|
||||
|
||||
// Enable service workers in the debugger
|
||||
await pushPref("devtools.debugger.features.windowless-service-workers", true);
|
||||
|
||||
// Wait for dom.ipc.processCount to be updated before releasing processes.
|
||||
Services.ppmm.releaseCachedProcesses();
|
||||
}
|
||||
|
|
|
@ -3,16 +3,8 @@
|
|||
|
||||
"use strict";
|
||||
|
||||
self.addEventListener("activate", event => {
|
||||
event.waitUntil(self.clients.claim());
|
||||
});
|
||||
|
||||
// Bug 1328293
|
||||
self.onfetch = function(event) {
|
||||
const url = event.request.url;
|
||||
|
||||
const response = url.endsWith("test")
|
||||
? new Response("lorem ipsum", { statusText: "OK" })
|
||||
: fetch(event.request);
|
||||
|
||||
event.respondWith(response);
|
||||
const a = 5;
|
||||
console.log(a);
|
||||
};
|
||||
|
|
|
@ -11,15 +11,6 @@
|
|||
<script type="text/javascript">
|
||||
"use strict";
|
||||
window.sw = navigator.serviceWorker.register("debug-sw.js");
|
||||
|
||||
/* exported fetchFromWorker */
|
||||
async function fetchFromWorker() {
|
||||
const response = await fetch("test");
|
||||
const text = await response.text();
|
||||
console.log(`Response from worker: ${text}`);
|
||||
}
|
||||
</script>
|
||||
|
||||
<p>This page has a <code>fetchFromWorker()</code> function.</p>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -12,7 +12,7 @@ const { setupStore } = require("devtools/client/application/test/node/helpers");
|
|||
const {
|
||||
ManifestDevToolsError,
|
||||
services,
|
||||
} = require("devtools/client/application/src/modules/application-services");
|
||||
} = require("devtools/client/application/src/modules/services");
|
||||
|
||||
const {
|
||||
FETCH_MANIFEST_FAILURE,
|
||||
|
|
|
@ -9,12 +9,6 @@ loader.lazyRequireGetter(
|
|||
"devtools/client/shared/link",
|
||||
true
|
||||
);
|
||||
loader.lazyRequireGetter(
|
||||
this,
|
||||
"features",
|
||||
"devtools/client/debugger/src/utils/prefs",
|
||||
true
|
||||
);
|
||||
|
||||
const DBG_STRINGS_URI = "devtools/client/locales/debugger.properties";
|
||||
const L10N = new LocalizationHelper(DBG_STRINGS_URI);
|
||||
|
@ -177,29 +171,6 @@ DebuggerPanel.prototype = {
|
|||
return this._actions.selectSourceURL(cx, url, { line, column });
|
||||
},
|
||||
|
||||
async selectWorker(workerTargetFront) {
|
||||
const threadId = workerTargetFront.threadFront.actorID;
|
||||
const isThreadAvailable = this._selectors
|
||||
.getThreads(this._getState())
|
||||
.find(x => x.actor === threadId);
|
||||
|
||||
if (!features.windowlessServiceWorkers) {
|
||||
console.error(
|
||||
"Selecting a worker needs the pref debugger.features.windowless-service-workers set to true"
|
||||
);
|
||||
} else if (!isThreadAvailable) {
|
||||
console.error(`Worker ${threadId} is not available for debugging`);
|
||||
} else {
|
||||
// select worker's thread
|
||||
const cx = this._selectors.getContext(this._getState());
|
||||
this._actions.selectThread(cx, threadId);
|
||||
|
||||
// select worker's source
|
||||
const source = this.getSourceByURL(workerTargetFront._url);
|
||||
await this.selectSource(source.id, 1, 1);
|
||||
}
|
||||
},
|
||||
|
||||
previewPausedLocation(location) {
|
||||
return this._actions.previewPausedLocation(location);
|
||||
},
|
||||
|
|
Загрузка…
Ссылка в новой задаче