Skip to content

Commit ce92800

Browse files
committed
squash 'resources/unpacked/devtools' changes from 07e3483..b289bdc
b289bdc DevTools: all ToolbarInputs should have clear button 7fcee9d DevTools: move tests (part 11) d5467a1 [DevTools] Mark targets as 'page' by default in ChromeDevToolsManagerDelegate cb106ac DevTools: sort service workers in the applications panel. e92f24e [Devtools] Minor fixes for accessibility 'tree' f148685 [Devtools] Style fixes for contrast line 4592d46 [Devtools] Maintain selection when selecting accessibility tree nodes which aren't represented in Elements tree a1b02a9 DevTools: move http/tests/inspector/network/* tests (part 10) f368889 [DevTools] Check valid origin before tracking for Cache Storage live update git-subtree-dir: resources/unpacked/devtools git-subtree-split: b289bdc
1 parent 9ee4d15 commit ce92800

File tree

14 files changed

+171
-69
lines changed

14 files changed

+171
-69
lines changed

front_end/Tests.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -905,6 +905,20 @@
905905
}
906906
};
907907

908+
TestSuite.prototype.testCreateTargetType = function() {
909+
var test = this;
910+
test.takeControl();
911+
912+
var target = SDK.targetManager.mainTarget();
913+
target.registerTargetDispatcher({
914+
targetCreated: function(targetInfo) {
915+
test.assertEquals('page', targetInfo.type);
916+
test.releaseControl();
917+
}
918+
});
919+
target.targetAgent().createTarget('about:blank');
920+
};
921+
908922
TestSuite.prototype.testWindowInitializedOnNavigateBack = function() {
909923
var messages = ConsoleModel.consoleModel.messages();
910924
this.assertEquals(1, messages.length);

front_end/accessibility/AXBreadcrumbsPane.js

Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Accessibility.AXBreadcrumbsPane = class extends Accessibility.AccessibilitySubPa
1616

1717
/** @type {?Accessibility.AXBreadcrumb} */
1818
this._preselectedBreadcrumb = null;
19+
/** @type {?Accessibility.AXBreadcrumb} */
20+
this._inspectedNodeBreadcrumb = null;
1921

2022
this._selectedByUser = true;
2123

@@ -27,6 +29,7 @@ Accessibility.AXBreadcrumbsPane = class extends Accessibility.AccessibilitySubPa
2729
this._rootElement.addEventListener('mouseleave', this._onMouseLeave.bind(this), false);
2830
this._rootElement.addEventListener('click', this._onClick.bind(this), false);
2931
this._rootElement.addEventListener('contextmenu', this._contextMenuEventFired.bind(this), false);
32+
this._rootElement.addEventListener('focusout', this._onFocusOut.bind(this), false);
3033
this.registerRequiredCSS('accessibility/axBreadcrumbs.css');
3134
}
3235

@@ -65,14 +68,14 @@ Accessibility.AXBreadcrumbsPane = class extends Accessibility.AccessibilitySubPa
6568
depth++;
6669
}
6770

68-
var inspectedNodeBreadcrumb = breadcrumb;
69-
inspectedNodeBreadcrumb.setPreselected(true, this._selectedByUser);
71+
this._inspectedNodeBreadcrumb = breadcrumb;
72+
this._inspectedNodeBreadcrumb.setPreselected(true, this._selectedByUser);
7073

71-
this._setPreselectedBreadcrumb(inspectedNodeBreadcrumb);
74+
this._setPreselectedBreadcrumb(this._inspectedNodeBreadcrumb);
7275

7376
for (var child of axNode.children()) {
7477
var childBreadcrumb = new Accessibility.AXBreadcrumb(child, depth, false);
75-
inspectedNodeBreadcrumb.appendChild(childBreadcrumb);
78+
this._inspectedNodeBreadcrumb.appendChild(childBreadcrumb);
7679
}
7780

7881
this._selectedByUser = false;
@@ -147,10 +150,12 @@ Accessibility.AXBreadcrumbsPane = class extends Accessibility.AccessibilitySubPa
147150
return;
148151
if (this._preselectedBreadcrumb)
149152
this._preselectedBreadcrumb.setPreselected(false, this._selectedByUser);
150-
this._preselectedBreadcrumb = breadcrumb;
151-
if (this._preselectedBreadcrumb)
152-
this._preselectedBreadcrumb.setPreselected(true, this._selectedByUser);
153-
else if (this._selectedByUser)
153+
if (breadcrumb)
154+
this._preselectedBreadcrumb = breadcrumb;
155+
else
156+
this._preselectedBreadcrumb = this._inspectedNodeBreadcrumb;
157+
this._preselectedBreadcrumb.setPreselected(true, this._selectedByUser);
158+
if (!breadcrumb && this._selectedByUser)
154159
SDK.OverlayModel.hideDOMNodeHighlight();
155160
}
156161

@@ -171,11 +176,20 @@ Accessibility.AXBreadcrumbsPane = class extends Accessibility.AccessibilitySubPa
171176
return;
172177
}
173178
var breadcrumb = breadcrumbElement.breadcrumb;
174-
if (breadcrumb.preselected() || breadcrumb.inspected() || !breadcrumb.isDOMNode())
179+
if (!breadcrumb.isDOMNode())
175180
return;
176181
this._setHoveredBreadcrumb(breadcrumb);
177182
}
178183

184+
/**
185+
* @param {!Event} event
186+
*/
187+
_onFocusOut(event) {
188+
if (!this._preselectedBreadcrumb || event.target !== this._preselectedBreadcrumb.nodeElement())
189+
return;
190+
this._setPreselectedBreadcrumb(null);
191+
}
192+
179193
/**
180194
* @param {!Event} event
181195
*/
@@ -189,7 +203,7 @@ Accessibility.AXBreadcrumbsPane = class extends Accessibility.AccessibilitySubPa
189203
if (breadcrumb.inspected()) {
190204
// If the user is clicking the inspected breadcrumb, they probably want to
191205
// focus it.
192-
breadcrumb.element().focus();
206+
breadcrumb.nodeElement().focus();
193207
return;
194208
}
195209
if (!breadcrumb.isDOMNode())
@@ -228,15 +242,8 @@ Accessibility.AXBreadcrumbsPane = class extends Accessibility.AccessibilitySubPa
228242
this._selectedByUser = true;
229243

230244
axNode.deferredDOMNode().resolve(domNode => {
231-
var inspectedDOMNode = UI.context.flavor(SDK.DOMNode);
232-
// Special case the root accessibility node: set the node for the
233-
// accessibility panel, not the Elements tree, as it maps to the Document
234-
// node which is not shown in the DOM panel, causing the first child to be
235-
// inspected instead.
236-
if (axNode.parentNode() && domNode !== inspectedDOMNode)
237-
Common.Revealer.reveal(domNode, true /* omitFocus */);
238-
else
239-
this._axSidebarView.setNode(domNode);
245+
this._axSidebarView.setNode(domNode, true /* fromAXTree */);
246+
Common.Revealer.reveal(domNode, true /* omitFocus */);
240247
});
241248

242249
return true;
@@ -246,7 +253,7 @@ Accessibility.AXBreadcrumbsPane = class extends Accessibility.AccessibilitySubPa
246253
* @param {!Event} event
247254
*/
248255
_contextMenuEventFired(event) {
249-
var breadcrumbElement = event.target.enclosingNodeOrSelfWithClass('ax-node');
256+
var breadcrumbElement = event.target.enclosingNodeOrSelfWithClass('ax-breadcrumb');
250257
if (!breadcrumbElement)
251258
return;
252259

@@ -279,10 +286,11 @@ Accessibility.AXBreadcrumb = class {
279286
this._axNode = axNode;
280287

281288
this._element = createElementWithClass('div', 'ax-breadcrumb');
282-
UI.ARIAUtils.markAsTreeitem(this._element);
283289
this._element.breadcrumb = this;
284290

285291
this._nodeElement = createElementWithClass('div', 'ax-node');
292+
UI.ARIAUtils.markAsTreeitem(this._nodeElement);
293+
this._nodeElement.tabIndex = -1;
286294
this._element.appendChild(this._nodeElement);
287295
this._nodeWrapper = createElementWithClass('div', 'wrapper');
288296
this._nodeElement.appendChild(this._nodeWrapper);
@@ -329,14 +337,21 @@ Accessibility.AXBreadcrumb = class {
329337
return this._element;
330338
}
331339

340+
/**
341+
* @return {!Element}
342+
*/
343+
nodeElement() {
344+
return this._nodeElement;
345+
}
346+
332347
/**
333348
* @param {!Accessibility.AXBreadcrumb} breadcrumb
334349
*/
335350
appendChild(breadcrumb) {
336351
this._children.push(breadcrumb);
337352
breadcrumb.setParent(this);
338353
this._nodeElement.classList.add('parent');
339-
UI.ARIAUtils.setExpanded(this._element, true);
354+
UI.ARIAUtils.setExpanded(this._nodeElement, true);
340355
this._childrenGroupElement.appendChild(breadcrumb.element());
341356
}
342357

@@ -366,7 +381,7 @@ Accessibility.AXBreadcrumb = class {
366381
if (preselected)
367382
this._nodeElement.setAttribute('tabIndex', 0);
368383
else
369-
this._nodeElement.removeAttribute('tabIndex');
384+
this._nodeElement.setAttribute('tabIndex', -1);
370385
if (this._preselected) {
371386
if (selectedByUser)
372387
this._nodeElement.focus();

front_end/accessibility/AccessibilitySidebarView.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Accessibility.AccessibilitySidebarView = class extends UI.ThrottledWidget {
99
super();
1010
this._node = null;
1111
this._axNode = null;
12+
this._skipNextPullNode = false;
1213
this._sidebarPaneStack = UI.viewManager.createStackLocation();
1314
this._breadcrumbsSubPane = new Accessibility.AXBreadcrumbsPane(this);
1415
this._sidebarPaneStack.showView(this._breadcrumbsSubPane);
@@ -37,8 +38,10 @@ Accessibility.AccessibilitySidebarView = class extends UI.ThrottledWidget {
3738

3839
/**
3940
* @param {?SDK.DOMNode} node
41+
* @param {boolean=} fromAXTree
4042
*/
41-
setNode(node) {
43+
setNode(node, fromAXTree) {
44+
this._skipNextPullNode = !!fromAXTree;
4245
this._node = node;
4346
this.update();
4447
}
@@ -72,6 +75,7 @@ Accessibility.AccessibilitySidebarView = class extends UI.ThrottledWidget {
7275
var node = this.node();
7376
this._axNodeSubPane.setNode(node);
7477
this._ariaSubPane.setNode(node);
78+
this._breadcrumbsSubPane.setNode(node);
7579
if (!node)
7680
return Promise.resolve();
7781
var accessibilityModel = node.domModel().target().model(Accessibility.AccessibilityModel);
@@ -114,6 +118,10 @@ Accessibility.AccessibilitySidebarView = class extends UI.ThrottledWidget {
114118
}
115119

116120
_pullNode() {
121+
if (this._skipNextPullNode) {
122+
this._skipNextPullNode = false;
123+
return;
124+
}
117125
this.setNode(UI.context.flavor(SDK.DOMNode));
118126
}
119127

front_end/color_picker/spectrum.css

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
background-color: rgba(255, 255, 255, 0.2);
102102
align-items: center;
103103
transition: right .05s ease-out, left .05s ease-out, bottom .05s ease-out, top .05s ease-out;
104+
cursor: pointer;
104105
}
105106

106107
.spectrum-contrast-info.contrast-unknown .value {
@@ -623,6 +624,10 @@ button.background-color-picker {
623624
top: 7px;
624625
}
625626

626-
button.background-color-picker.active [is=ui-icon].largeicon-eyedropper.icon-mask{
627+
button.background-color-picker.active [is=ui-icon].largeicon-eyedropper.icon-mask {
627628
background-color: hsl(218, 81%, 59%);
628629
}
630+
631+
button.background-color-picker:hover [is=ui-icon].largeicon-eyedropper.icon-mask {
632+
background-color: #333;
633+
}

front_end/console/ConsoleView.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,7 @@ Console.ConsoleViewFilter = class {
10191019
this._filterByExecutionContextSetting.addChangeListener(this._filterChanged);
10201020
this._filterByConsoleAPISetting.addChangeListener(this._filterChanged);
10211021

1022-
this._textFilterUI = new UI.ToolbarInput(Common.UIString('Filter'), 0.2, 1, true);
1022+
this._textFilterUI = new UI.ToolbarInput(Common.UIString('Filter'), 0.2, 1);
10231023
this._textFilterUI.element.title = Common.UIString('e.g. /event\\d/ -cdn url:a.com');
10241024
this._textFilterUI.addEventListener(UI.ToolbarInput.Event.TextChanged, this._textFilterChanged, this);
10251025
this._filterParser = new TextUtils.FilterParser(Object.values(Console.ConsoleViewFilter._filterType));

front_end/coverage/CoverageView.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Coverage.CoverageView = class extends UI.VBox {
3535
this._textFilterRegExp = null;
3636

3737
toolbar.appendSeparator();
38-
this._filterInput = new UI.ToolbarInput(Common.UIString('URL filter'), 0.4, 1, true);
38+
this._filterInput = new UI.ToolbarInput(Common.UIString('URL filter'), 0.4, 1);
3939
this._filterInput.setEnabled(false);
4040
this._filterInput.addEventListener(UI.ToolbarInput.Event.TextChanged, this._onFilterChanged, this);
4141
toolbar.appendToolbarItem(this._filterInput);

front_end/network/ResourceWebSocketFrameView.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Network.ResourceWebSocketFrameView = class extends UI.VBox {
7373
this._filterType = null;
7474

7575
var placeholder = 'Enter regex, for example: (web)?socket';
76-
this._filterTextInput = new UI.ToolbarInput(Common.UIString(placeholder), 0.4, undefined, true);
76+
this._filterTextInput = new UI.ToolbarInput(Common.UIString(placeholder), 0.4);
7777
this._filterTextInput.addEventListener(UI.ToolbarInput.Event.TextChanged, this._updateFilterSetting, this);
7878
this._mainToolbar.appendToolbarItem(this._filterTextInput);
7979
this._filterRegex = null;

front_end/resources/ServiceWorkersView.js

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,23 @@ Resources.ServiceWorkersView = class extends UI.VBox {
8383

8484
_updateSectionVisibility() {
8585
var securityOrigins = new Set(this._securityOriginManager.securityOrigins());
86+
var matchingSections = new Set();
8687
for (var section of this._sections.values()) {
87-
var visible = this._showAllCheckbox.checked() || securityOrigins.has(section._registration.securityOrigin);
88-
section._section.element.classList.toggle('hidden', !visible);
88+
if (securityOrigins.has(section._registration.securityOrigin))
89+
matchingSections.add(section._section);
90+
}
91+
92+
this._reportView.sortSections((a, b) => {
93+
var aMatching = matchingSections.has(a);
94+
var bMatching = matchingSections.has(b);
95+
if (aMatching === bMatching)
96+
return a.title().localeCompare(b.title());
97+
return aMatching ? -1 : 1;
98+
});
99+
100+
for (var section of this._sections.values()) {
101+
var sameOrigin = securityOrigins.has(section._registration.securityOrigin);
102+
section._section.element.classList.toggle('hidden', !this._showAllCheckbox.checked() && !sameOrigin);
89103
}
90104
}
91105

@@ -139,8 +153,10 @@ Resources.ServiceWorkersView = class extends UI.VBox {
139153
_updateRegistration(registration) {
140154
var section = this._sections.get(registration);
141155
if (!section) {
142-
section =
143-
new Resources.ServiceWorkersView.Section(this._manager, this._reportView.appendSection(''), registration);
156+
section = new Resources.ServiceWorkersView.Section(
157+
this._manager,
158+
this._reportView.appendSection(Resources.ServiceWorkersView._displayScopeURL(registration.scopeURL)),
159+
registration);
144160
this._sections.set(registration, section);
145161
}
146162
this._updateSectionVisibility();
@@ -161,9 +177,21 @@ Resources.ServiceWorkersView = class extends UI.VBox {
161177
_removeRegistrationFromList(registration) {
162178
var section = this._sections.get(registration);
163179
if (section)
164-
section._section.remove();
180+
section._section.detach();
165181
this._sections.delete(registration);
166182
}
183+
184+
/**
185+
* @param {string} scopeURL
186+
* @return {string}
187+
*/
188+
static _displayScopeURL(scopeURL) {
189+
var parsedURL = scopeURL.asParsedURL();
190+
var path = parsedURL.path;
191+
if (path.endsWith('/'))
192+
path = path.substring(0, path.length - 1);
193+
return parsedURL.host + path;
194+
}
167195
};
168196

169197
/**
@@ -244,8 +272,8 @@ Resources.ServiceWorkersView.Section = class {
244272
this._toolbar.setEnabled(!this._registration.isDeleted);
245273

246274
var versions = this._registration.versionsByMode();
247-
var title = this._registration.isDeleted ? Common.UIString('%s - deleted', this._registration.scopeURL) :
248-
this._registration.scopeURL;
275+
var scopeURL = Resources.ServiceWorkersView._displayScopeURL(this._registration.scopeURL);
276+
var title = this._registration.isDeleted ? Common.UIString('%s - deleted', scopeURL) : scopeURL;
249277
this._section.setTitle(title);
250278

251279
var active = versions.get(SDK.ServiceWorkerVersion.Modes.Active);

front_end/resources/StorageItemsView.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Resources.StorageItemsView = class extends UI.VBox {
1919

2020
this._mainToolbar = new UI.Toolbar('top-resources-toolbar', this.element);
2121

22-
this._filterItem = new UI.ToolbarInput(Common.UIString('Filter'), 0.4, undefined, true);
22+
this._filterItem = new UI.ToolbarInput(Common.UIString('Filter'), 0.4);
2323
this._filterItem.addEventListener(UI.ToolbarInput.Event.TextChanged, this._filterChanged, this);
2424

2525
var toolbarItems = [this._refreshButton, this._deleteAllButton, this._deleteSelectedButton, this._filterItem];

front_end/sdk/ServiceWorkerCacheModel.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,9 @@ SDK.ServiceWorkerCacheModel = class extends SDK.SDKModel {
124124

125125
_addOrigin(securityOrigin) {
126126
this._loadCacheNames(securityOrigin);
127+
var parsedURL = securityOrigin.asParsedURL();
128+
if (!parsedURL || !parsedURL.scheme.startsWith('http'))
129+
return;
127130
this._storageAgent.trackCacheStorageForOrigin(securityOrigin);
128131
}
129132

@@ -138,6 +141,9 @@ SDK.ServiceWorkerCacheModel = class extends SDK.SDKModel {
138141
this._cacheRemoved(cache);
139142
}
140143
}
144+
var parsedURL = securityOrigin.asParsedURL();
145+
if (!parsedURL || !parsedURL.scheme.startsWith('http'))
146+
return;
141147
this._storageAgent.untrackCacheStorageForOrigin(securityOrigin);
142148
}
143149

0 commit comments

Comments
 (0)