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

Unified Diff: third_party/WebKit/Source/devtools/front_end/audits2/Audits2Panel.js

Issue 2895913003: DevTools: Audits2 use location.href when available (Closed)
Patch Set: feedback Created 3 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/audits2/Audits2Panel.js
diff --git a/third_party/WebKit/Source/devtools/front_end/audits2/Audits2Panel.js b/third_party/WebKit/Source/devtools/front_end/audits2/Audits2Panel.js
index ff23436b180b2d3c5ac373030dc4ccc5c2608cc1..d23224ec3a7c152d789a9a529e327d2276a265ae 100644
--- a/third_party/WebKit/Source/devtools/front_end/audits2/Audits2Panel.js
+++ b/third_party/WebKit/Source/devtools/front_end/audits2/Audits2Panel.js
@@ -142,6 +142,26 @@ Audits2.Audits2Panel = class extends UI.PanelWithSidebar {
return statusView;
}
+ /**
+ * @return {!Promise<undefined>}
+ */
+ _updateInspectedURL() {
+ var mainTarget = SDK.targetManager.mainTarget();
+ var runtimeModel = mainTarget.model(SDK.RuntimeModel);
+ var executionContext = runtimeModel && runtimeModel.defaultExecutionContext();
+ this._inspectedURL = mainTarget.inspectedURL();
+ if (!executionContext)
+ return Promise.resolve();
+
+ return new Promise(resolve => {
+ executionContext.evaluate('window.location.href', 'audits', false, false, true, false, false, (object, err) => {
+ if (!err && object)
+ this._inspectedURL = object.value;
dgozman 2017/05/22 20:48:14 object.release();
+ resolve();
+ });
+ });
+ }
+
_start() {
var emulationModel = self.singleton(Emulation.DeviceModeModel);
this._emulationEnabledBefore = emulationModel.enabledSetting().get();
@@ -155,7 +175,6 @@ Audits2.Audits2Panel = class extends UI.PanelWithSidebar {
emulationModel.emulate(Emulation.DeviceModeModel.Type.Device, device, device.modes[0], 1);
}
this._dialog.setCloseOnEscape(false);
- this._inspectedURL = SDK.targetManager.mainTarget().inspectedURL();
var categoryIDs = [];
for (var preset of Audits2.Audits2Panel.Presets) {
@@ -164,6 +183,7 @@ Audits2.Audits2Panel = class extends UI.PanelWithSidebar {
}
return Promise.resolve()
+ .then(_ => this._updateInspectedURL())
.then(_ => this._protocolService.attach())
.then(_ => {
this._auditRunning = true;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698