Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(817)

Unified Diff: third_party/WebKit/Source/devtools/front_end/main/Main.js

Issue 2137773002: [DevTools] Replace the target type with capabilities (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing the code review comments Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/main/Main.js
diff --git a/third_party/WebKit/Source/devtools/front_end/main/Main.js b/third_party/WebKit/Source/devtools/front_end/main/Main.js
index 8c8748bfb858a998fbaaa0c822000a21fe0a9695..d924eb8e734d36e999adecce193609f6080707e1 100644
--- a/third_party/WebKit/Source/devtools/front_end/main/Main.js
+++ b/third_party/WebKit/Source/devtools/front_end/main/Main.js
@@ -308,13 +308,13 @@ WebInspector.Main.prototype = {
WebInspector.RemoteDebuggingTerminatedScreen.show(event.data.reason);
}
- var targetType = WebInspector.Target.Type.Page;
+ var capabilities = WebInspector.Target.Capability.Browser | WebInspector.Target.Capability.JS | WebInspector.Target.Capability.Network | WebInspector.Target.Capability.Worker;
if (Runtime.queryParam("isSharedWorker"))
- targetType = WebInspector.Target.Type.ServiceWorker;
+ capabilities = WebInspector.Target.Capability.Network | WebInspector.Target.Capability.Worker;
else if (Runtime.queryParam("v8only"))
- targetType = WebInspector.Target.Type.JSInspector;
+ capabilities = WebInspector.Target.Capability.JS;
- this._mainTarget = WebInspector.targetManager.createTarget(WebInspector.UIString("Main"), targetType, connection, null);
+ this._mainTarget = WebInspector.targetManager.createTarget(WebInspector.UIString("Main"), capabilities, connection, null);
console.timeStamp("Main._mainTargetCreated");
this._registerShortcuts();
@@ -322,8 +322,7 @@ WebInspector.Main.prototype = {
InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.ReloadInspectedPage, this._reloadInspectedPage, this);
InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.EvaluateForTestInFrontend, this._evaluateForTestInFrontend, this);
- if (this._mainTarget.isServiceWorker() || this._mainTarget.isPage() || this._mainTarget.isJSInspector())
- this._mainTarget.runtimeAgent().run();
+ this._mainTarget.runtimeAgent().run();
this._mainTarget.inspectorAgent().enable();
InspectorFrontendHost.readyForTest();
@@ -711,9 +710,8 @@ WebInspector.Main._reloadPage = function(hard)
{
if (!WebInspector.targetManager.hasTargets())
return;
- if (WebInspector.targetManager.mainTarget().isServiceWorker())
- return;
- WebInspector.targetManager.reloadPage(hard);
+ if (WebInspector.targetManager.mainTarget().hasBrowserCapability())
+ WebInspector.targetManager.reloadPage(hard);
}
/**
@@ -726,7 +724,8 @@ WebInspector.Main._addWebSocketTarget = function(ws)
*/
function callback(connection)
{
- WebInspector.targetManager.createTarget(ws, WebInspector.Target.Type.Page, connection, null);
+ var capabilities = WebInspector.Target.Capability.Browser | WebInspector.Target.Capability.JS | WebInspector.Target.Capability.Network | WebInspector.Target.Capability.Worker;
+ WebInspector.targetManager.createTarget(ws, capabilities, connection, null);
}
new WebInspector.WebSocketConnection(ws, callback);
}
@@ -1064,7 +1063,7 @@ WebInspector.BackendSettingsSync = function()
this._disableJavascriptSetting.addChangeListener(this._update, this);
this._blockedEventsWarningSetting = WebInspector.settings.moduleSetting("blockedEventsWarningEnabled");
this._blockedEventsWarningSetting.addChangeListener(this._update, this);
- WebInspector.targetManager.observeTargets(this, WebInspector.Target.Type.Page);
+ WebInspector.targetManager.observeTargets(this, WebInspector.Target.Capability.Browser);
}
WebInspector.BackendSettingsSync.prototype = {
@@ -1081,7 +1080,7 @@ WebInspector.BackendSettingsSync.prototype = {
_update: function()
{
- WebInspector.targetManager.targets(WebInspector.Target.Type.Page).forEach(this._updateTarget, this);
+ WebInspector.targetManager.targets(WebInspector.Target.Capability.Browser).forEach(this._updateTarget, this);
},
/**

Powered by Google App Engine
This is Rietveld 408576698