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

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

Issue 2895913003: DevTools: Audits2 use location.href when available (Closed)
Patch Set: release object 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..44475267d74e85512c302f094088e782b24eae4b 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,29 @@ 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;
+ object.release();
+ }
+
+ resolve();
+ });
+ });
+ }
+
_start() {
var emulationModel = self.singleton(Emulation.DeviceModeModel);
this._emulationEnabledBefore = emulationModel.enabledSetting().get();
@@ -155,7 +178,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 +186,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