Changeset 248753 in webkit
- Timestamp:
- Aug 15, 2019, 5:43:11 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 14 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/inspector/unit-tests/url-utilities-expected.txt (modified) (21 diffs)
-
LayoutTests/inspector/unit-tests/url-utilities.html (modified) (23 diffs)
-
Source/WebInspectorUI/ChangeLog (modified) (1 diff)
-
Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (modified) (1 diff)
-
Source/WebInspectorUI/UserInterface/Base/URLUtilities.js (modified) (3 diffs)
-
Source/WebInspectorUI/UserInterface/Controllers/CSSManager.js (modified) (2 diffs)
-
Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js (modified) (1 diff)
-
Source/WebInspectorUI/UserInterface/Models/Frame.js (modified) (1 diff)
-
Source/WebInspectorUI/UserInterface/Views/FilterBar.css (modified) (4 diffs)
-
Source/WebInspectorUI/UserInterface/Views/FilterBar.js (modified) (2 diffs)
-
Source/WebInspectorUI/UserInterface/Views/FrameTreeElement.js (modified) (1 diff)
-
Source/WebInspectorUI/UserInterface/Views/GeneralTreeElement.js (modified) (2 diffs)
-
Source/WebInspectorUI/UserInterface/Views/SourcesNavigationSidebarPanel.js (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r248752 r248753 1 2019-08-15 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: Sources: provide a way to create an arbitrary Inspector Style Sheet 4 https://bugs.webkit.org/show_bug.cgi?id=200425 5 6 Reviewed by Joseph Pecoraro. 7 8 * inspector/unit-tests/url-utilities.html: 9 * inspector/unit-tests/url-utilities-expected.txt: 10 1 11 2019-08-15 Wenson Hsieh <wenson_hsieh@apple.com> 2 12 -
trunk/LayoutTests/inspector/unit-tests/url-utilities-expected.txt
r246559 r248753 16 16 PASS: host should be: 'example.com' 17 17 PASS: port should be: 'null' 18 PASS: origin should be: 'http://example.com' 18 19 PASS: path should be: 'null' 19 20 PASS: queryString should be: 'null' … … 26 27 PASS: host should be: 'example.com' 27 28 PASS: port should be: 'null' 29 PASS: origin should be: 'http://example.com' 28 30 PASS: path should be: '/' 29 31 PASS: queryString should be: 'null' … … 36 38 PASS: host should be: 'example.com' 37 39 PASS: port should be: '80' 40 PASS: origin should be: 'http://example.com:80' 38 41 PASS: path should be: '/' 39 42 PASS: queryString should be: 'null' … … 46 49 PASS: host should be: 'example.com' 47 50 PASS: port should be: 'null' 51 PASS: origin should be: 'http://example.com' 48 52 PASS: path should be: '/path/to/page.html' 49 53 PASS: queryString should be: 'null' … … 56 60 PASS: host should be: 'example.com' 57 61 PASS: port should be: 'null' 62 PASS: origin should be: 'http://example.com' 58 63 PASS: path should be: '/path/to/page.html' 59 64 PASS: queryString should be: '' … … 66 71 PASS: host should be: 'example.com' 67 72 PASS: port should be: 'null' 73 PASS: origin should be: 'http://example.com' 68 74 PASS: path should be: '/path/to/page.html' 69 75 PASS: queryString should be: 'a=1' … … 76 82 PASS: host should be: 'example.com' 77 83 PASS: port should be: 'null' 84 PASS: origin should be: 'http://example.com' 78 85 PASS: path should be: '/path/to/page.html' 79 86 PASS: queryString should be: 'a=1&b=2' … … 86 93 PASS: host should be: 'example.com' 87 94 PASS: port should be: 'null' 95 PASS: origin should be: 'http://example.com' 88 96 PASS: path should be: '/path/to/page.html' 89 97 PASS: queryString should be: 'a=1&b=2' … … 96 104 PASS: host should be: 'example.com' 97 105 PASS: port should be: '123' 106 PASS: origin should be: 'http://example.com:123' 98 107 PASS: path should be: '/path/to/page.html' 99 108 PASS: queryString should be: 'a=1&b=2' … … 106 115 PASS: host should be: 'example.com' 107 116 PASS: port should be: 'null' 117 PASS: origin should be: 'http://example.com' 108 118 PASS: path should be: '/path/to/page.html' 109 119 PASS: queryString should be: 'null' … … 116 126 PASS: host should be: 'example.com' 117 127 PASS: port should be: 'null' 128 PASS: origin should be: 'http://example.com' 118 129 PASS: path should be: 'null' 119 130 PASS: queryString should be: 'null' … … 126 137 PASS: host should be: 'example.com' 127 138 PASS: port should be: 'null' 139 PASS: origin should be: 'app-specific://example.com' 128 140 PASS: path should be: 'null' 129 141 PASS: queryString should be: 'null' … … 136 148 PASS: host should be: 'example' 137 149 PASS: port should be: 'null' 150 PASS: origin should be: 'http://example' 138 151 PASS: path should be: 'null' 139 152 PASS: queryString should be: 'null' … … 146 159 PASS: host should be: 'my.example.com' 147 160 PASS: port should be: 'null' 161 PASS: origin should be: 'http://my.example.com' 148 162 PASS: path should be: 'null' 149 163 PASS: queryString should be: 'null' … … 156 170 PASS: host should be: 'null' 157 171 PASS: port should be: 'null' 172 PASS: origin should be: 'null' 158 173 PASS: path should be: 'null' 159 174 PASS: queryString should be: 'null' … … 184 199 Actual: null 185 200 PASS: port should be: 'null' 201 FAIL: origin should be: 'http://example.com' 202 Expected: "http://example.com" 203 Actual: null 186 204 FAIL: path should be: '/' 187 205 Expected: "/" … … 200 218 Actual: null 201 219 PASS: port should be: 'null' 220 FAIL: origin should be: 'http://example.com' 221 Expected: "http://example.com" 222 Actual: null 202 223 FAIL: path should be: '/' 203 224 Expected: "/" … … 212 233 PASS: host should be: 'example.com' 213 234 PASS: port should be: 'null' 235 PASS: origin should be: 'http://example.com' 214 236 PASS: path should be: '/' 215 237 PASS: queryString should be: 'null' … … 226 248 Actual: null 227 249 PASS: port should be: 'null' 250 FAIL: origin should be: 'http://example.com' 251 Expected: "http://example.com" 252 Actual: null 228 253 FAIL: path should be: '/' 229 254 Expected: "/" … … 240 265 Actual: "example.com?key=alpha" 241 266 PASS: port should be: 'null' 267 FAIL: origin should be: 'http://example.com' 268 Expected: "http://example.com" 269 Actual: "http://example.com?key=alpha" 242 270 FAIL: path should be: 'null' 243 271 Expected: null … … 351 379 PASS: The query 'a&b=1&c==2=&d&e=3&f==4=' was parsed successfully. 352 380 PASS: The query 'a=foo%20bar&b=123%3A456' was parsed successfully. 381 382 -- Running test case: WI.displayNameForURL 383 PASS: Display name of 'a' should be 'a'. 384 PASS: Display name of 'http://' should be 'http://'. 385 PASS: Display name of 'http://example' should be 'example'. 386 PASS: Display name of 'http://example.com' should be 'example.com'. 387 PASS: Display name of 'http://example.com/' should be 'example.com'. 388 PASS: Display name of 'http://example.com:999999999' should be 'example.com'. 389 PASS: Display name of 'http://example.com:80/' should be 'example.com'. 390 PASS: Display name of 'http://example.com/path' should be 'path'. 391 PASS: Display name of 'http://example.com/path/' should be 'path'. 392 PASS: Display name of 'http://example.com/path/to' should be 'to'. 393 PASS: Display name of 'http://example.com/path/to/' should be 'to'. 394 PASS: Display name of 'http://example.com/path/to/page.html' should be 'page.html'. 395 PASS: Display name of 'http://example.com/path/to/page.html?' should be 'page.html'. 396 PASS: Display name of 'http://example.com/path/to/page.html?a=1' should be 'page.html'. 397 PASS: Display name of 'http://example.com/path/to/page.html?a=1&b=2' should be 'page.html'. 398 PASS: Display name of 'http://example.com/path/to/page.html?a=1&b=2#test' should be 'page.html'. 399 PASS: Display name of 'http://example.com:123/path/to/page.html?a=1&b=2#test' should be 'page.html'. 400 PASS: Display name of 'http://example.com/path/to/page.html#test' should be 'page.html'. 401 PASS: Display name of 'http://example.com#alpha/beta' should be 'example.com'. 402 PASS: Display name of 'http://example.com?key=alpha/beta' should be 'beta'. 403 PASS: Display name of 'http://user:pass@example.com/' should be 'example.com'. 404 PASS: Display name of 'http://my.example.com' should be 'my.example.com'. 405 PASS: Display name of 'file://foo/bar' should be 'bar'. 406 PASS: Display name of 'data:text/plain,test' should be 'data:text/plain,test'. 407 PASS: Display name of 'about:blank' should be 'about:blank'. 408 PASS: Display name of 'about:srcdoc' should be 'about:srcdoc'. 409 PASS: Display name of 'app-specific://example.com' should be 'example.com'. 410 411 Allowing directory as name... 412 PASS: Display name of 'a' should be 'a'. 413 PASS: Display name of 'http://' should be 'http://'. 414 PASS: Display name of 'http://example' should be 'example'. 415 PASS: Display name of 'http://example.com' should be 'example.com'. 416 PASS: Display name of 'http://example.com/' should be '/'. 417 PASS: Display name of 'http://example.com:999999999' should be 'example.com'. 418 PASS: Display name of 'http://example.com:80/' should be '/'. 419 PASS: Display name of 'http://example.com/path' should be 'path'. 420 PASS: Display name of 'http://example.com/path/' should be '/'. 421 PASS: Display name of 'http://example.com/path/to' should be 'to'. 422 PASS: Display name of 'http://example.com/path/to/' should be '/'. 423 PASS: Display name of 'http://example.com/path/to/page.html' should be 'page.html'. 424 PASS: Display name of 'http://example.com/path/to/page.html?' should be 'page.html'. 425 PASS: Display name of 'http://example.com/path/to/page.html?a=1' should be 'page.html'. 426 PASS: Display name of 'http://example.com/path/to/page.html?a=1&b=2' should be 'page.html'. 427 PASS: Display name of 'http://example.com/path/to/page.html?a=1&b=2#test' should be 'page.html'. 428 PASS: Display name of 'http://example.com:123/path/to/page.html?a=1&b=2#test' should be 'page.html'. 429 PASS: Display name of 'http://example.com/path/to/page.html#test' should be 'page.html'. 430 PASS: Display name of 'http://example.com#alpha/beta' should be 'example.com'. 431 PASS: Display name of 'http://example.com?key=alpha/beta' should be 'beta'. 432 PASS: Display name of 'http://user:pass@example.com/' should be '/'. 433 PASS: Display name of 'http://my.example.com' should be 'my.example.com'. 434 PASS: Display name of 'file://foo/bar' should be 'bar'. 435 PASS: Display name of 'data:text/plain,test' should be 'data:text/plain,test'. 436 PASS: Display name of 'about:blank' should be 'about:blank'. 437 PASS: Display name of 'about:srcdoc' should be 'about:srcdoc'. 438 PASS: Display name of 'app-specific://example.com' should be 'example.com'. 353 439 354 440 -- Running test case: WI.h2Authority -
trunk/LayoutTests/inspector/unit-tests/url-utilities.html
r246559 r248753 28 28 InspectorTest.log("Test Valid: " + url); 29 29 30 let {scheme: expectedScheme, userinfo: expectedUserInfo, host: expectedHost, port: expectedPort, path: expectedPath, queryString: expectedQueryString, fragment: expectedFragment, lastPathComponent: expectedLastPathComponent} = expected;31 let {scheme: actualScheme, userinfo: actualUserInfo, host: actualHost, port: actualPort, path: actualPath, queryString: actualQueryString, fragment: actualFragment, lastPathComponent: actualLastPathComponent} = parseURL(url);30 let {scheme: expectedScheme, userinfo: expectedUserInfo, host: expectedHost, port: expectedPort, origin: expectedOrigin, path: expectedPath, queryString: expectedQueryString, fragment: expectedFragment, lastPathComponent: expectedLastPathComponent} = expected; 31 let {scheme: actualScheme, userinfo: actualUserInfo, host: actualHost, port: actualPort, origin: actualOrigin, path: actualPath, queryString: actualQueryString, fragment: actualFragment, lastPathComponent: actualLastPathComponent} = parseURL(url); 32 32 33 33 InspectorTest.expectEqual(actualScheme, expectedScheme, `scheme should be: '${expectedScheme}'`); … … 35 35 InspectorTest.expectEqual(actualHost, expectedHost, `host should be: '${expectedHost}'`); 36 36 InspectorTest.expectEqual(actualPort, expectedPort, `port should be: '${expectedPort}'`); 37 InspectorTest.expectEqual(actualOrigin, expectedOrigin, `origin should be: '${expectedOrigin}'`); 37 38 InspectorTest.expectEqual(actualPath, expectedPath, `path should be: '${expectedPath}'`); 38 39 InspectorTest.expectEqual(actualQueryString, expectedQueryString, `queryString should be: '${expectedQueryString}'`); … … 49 50 host: "example.com", 50 51 port: null, 52 origin: "http://example.com", 51 53 path: null, 52 54 queryString: null, … … 60 62 host: "example.com", 61 63 port: null, 64 origin: "http://example.com", 62 65 path: "/", 63 66 queryString: null, … … 71 74 host: "example.com", 72 75 port: 80, 76 origin: "http://example.com:80", 73 77 path: "/", 74 78 queryString: null, … … 82 86 host: "example.com", 83 87 port: null, 88 origin: "http://example.com", 84 89 path: "/path/to/page.html", 85 90 queryString: null, … … 93 98 host: "example.com", 94 99 port: null, 100 origin: "http://example.com", 95 101 path: "/path/to/page.html", 96 102 queryString: "", … … 104 110 host: "example.com", 105 111 port: null, 112 origin: "http://example.com", 106 113 path: "/path/to/page.html", 107 114 queryString: "a=1", … … 115 122 host: "example.com", 116 123 port: null, 124 origin: "http://example.com", 117 125 path: "/path/to/page.html", 118 126 queryString: "a=1&b=2", … … 126 134 host: "example.com", 127 135 port: null, 136 origin: "http://example.com", 128 137 path: "/path/to/page.html", 129 138 queryString: "a=1&b=2", … … 137 146 host: "example.com", 138 147 port: 123, 148 origin: "http://example.com:123", 139 149 path: "/path/to/page.html", 140 150 queryString: "a=1&b=2", … … 148 158 host: "example.com", 149 159 port: null, 160 origin: "http://example.com", 150 161 path: "/path/to/page.html", 151 162 queryString: null, … … 159 170 host: "example.com", 160 171 port: null, 172 origin: "http://example.com", 161 173 path: null, 162 174 queryString: null, … … 170 182 host: "example.com", 171 183 port: null, 184 origin: "app-specific://example.com", 172 185 path: null, 173 186 queryString: null, … … 181 194 host: "example", 182 195 port: null, 196 origin: "http://example", 183 197 path: null, 184 198 queryString: null, … … 192 206 host: "my.example.com", 193 207 port: null, 208 origin: "http://my.example.com", 194 209 path: null, 195 210 queryString: null, … … 204 219 host: null, 205 220 port: null, 221 origin: null, 206 222 path: null, 207 223 queryString: null, … … 222 238 host: "example.com", 223 239 port: null, 240 origin: "http://example.com", 224 241 path: "/", 225 242 queryString: null, … … 233 250 host: "example.com", 234 251 port: null, 252 origin: "http://example.com", 235 253 path: "/", 236 254 queryString: null, … … 244 262 host: "example.com", 245 263 port: null, 264 origin: "http://example.com", 246 265 path: "/", 247 266 queryString: null, … … 255 274 host: "example.com", 256 275 port: null, 276 origin: "http://example.com", 257 277 path: "/", 258 278 queryString: null, … … 266 286 host: "example.com", 267 287 port: null, 288 origin: "http://example.com", 268 289 path: null, 269 290 queryString: "key=alpha/beta", … … 420 441 421 442 suite.addTestCase({ 443 name: "WI.displayNameForURL", 444 test() { 445 const tests = [ 446 {url: "a", expected: "a"}, 447 {url: "http://", expected: "http://"}, 448 {url: "http://example", expected: "example"}, 449 {url: "http://example.com", expected: "example.com"}, 450 {url: "http://example.com/", expected: "example.com", directory: "/"}, 451 {url: "http://example.com:999999999", expected: "example.com"}, 452 {url: "http://example.com:80/", expected: "example.com", directory: "/"}, 453 {url: "http://example.com/path", expected: "path"}, 454 {url: "http://example.com/path/", expected: "path", directory: "/"}, 455 {url: "http://example.com/path/to", expected: "to"}, 456 {url: "http://example.com/path/to/", expected: "to", directory: "/"}, 457 {url: "http://example.com/path/to/page.html", expected: "page.html"}, 458 {url: "http://example.com/path/to/page.html?", expected: "page.html"}, 459 {url: "http://example.com/path/to/page.html?a=1", expected: "page.html"}, 460 {url: "http://example.com/path/to/page.html?a=1&b=2", expected: "page.html"}, 461 {url: "http://example.com/path/to/page.html?a=1&b=2#test", expected: "page.html"}, 462 {url: "http://example.com:123/path/to/page.html?a=1&b=2#test", expected: "page.html"}, 463 {url: "http://example.com/path/to/page.html#test", expected: "page.html"}, 464 {url: "http://example.com#alpha/beta", expected: "example.com"}, 465 {url: "http://example.com?key=alpha/beta", expected: "beta"}, 466 {url: "http://user:pass@example.com/", expected: "example.com", directory: "/"}, 467 {url: "http://my.example.com", expected: "my.example.com"}, 468 {url: "file://foo/bar", expected: "bar"}, 469 {url: "data:text/plain,test", expected: "data:text/plain,test"}, 470 {url: "about:blank", expected: "about:blank"}, 471 {url: "about:srcdoc", expected: "about:srcdoc"}, 472 {url: "app-specific://example.com", expected: "example.com"}, 473 ]; 474 475 for (let {url, expected} of tests) 476 InspectorTest.expectEqual(WI.displayNameForURL(url), expected, `Display name of '${url}' should be '${expected}'.`); 477 478 InspectorTest.newline(); 479 480 InspectorTest.log("Allowing directory as name..."); 481 for (let {url, expected, directory} of tests) 482 InspectorTest.expectEqual(WI.displayNameForURL(url, null, {allowDirectoryAsName: true}), directory || expected, `Display name of '${url}' should be '${directory || expected}'.`); 483 }, 484 }); 485 486 suite.addTestCase({ 422 487 name: "WI.h2Authority", 423 488 test() { -
trunk/Source/WebInspectorUI/ChangeLog
r248739 r248753 1 2019-08-15 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: Sources: provide a way to create an arbitrary Inspector Style Sheet 4 https://bugs.webkit.org/show_bug.cgi?id=200425 5 6 Reviewed by Joseph Pecoraro. 7 8 Right now, the only way to create an Inspector Style Sheet is by creating a new rule in the 9 Styles sidebar of the Elements Tab. This is unnecessarily restrictive, especially for those 10 who don't use the Elements tab. 11 12 Add a + button after the filter bar in the Navigation sidebar. Clicking on the + button will 13 show a menu with the following (more likely to be added later): 14 - Inspector Style Sheet 15 - Frames (if there are subframes) 16 - (name of subframe) 17 - Inspector Style Sheet 18 19 * UserInterface/Views/SourcesNavigationSidebarPanel.js: 20 (WI.SourcesNavigationSidebarPanel): 21 (WI.SourcesNavigationSidebarPanel.prototype.treeElementForRepresentedObject): Added. 22 (WI.SourcesNavigationSidebarPanel.prototype._filterByResourcesWithIssues): Added. 23 (WI.SourcesNavigationSidebarPanel.prototype._compareTreeElements): 24 (WI.SourcesNavigationSidebarPanel.prototype._updateMainFrameTreeElement): 25 (WI.SourcesNavigationSidebarPanel.prototype._addResource): 26 (WI.SourcesNavigationSidebarPanel.prototype._handleTreeSelectionDidChange): 27 (WI.SourcesNavigationSidebarPanel.prototype._populateCreateResourceContextMenu): Added. 28 (WI.SourcesNavigationSidebarPanel.prototype._handleResourceGroupingModeChanged): 29 (WI.SourcesNavigationSidebarPanel.prototype._handleFrameWasAdded): Added. 30 (WI.SourcesNavigationSidebarPanel.prototype._handleMainFrameDidChange): Deleted. 31 * UserInterface/Views/GeneralTreeElement.js: 32 (WI.GeneralTreeElement.prototype.createFoldersAsNeededForSubpath): 33 Drive-by: sort `WI.ResourceTreeElement`s alongside `WI.FolderTreeElement`s for easier readability. 34 35 * UserInterface/Views/FrameTreeElement.js: 36 (WI.FrameTreeElement.prototype.onpopulate): 37 Add all `inspectorStyleSheetsForFrame` instead of just the preferred one so that they all 38 are visible/selectable for editing. 39 40 * UserInterface/Views/FilterBar.js: 41 (WI.FilterBar): 42 * UserInterface/Views/FilterBar.css: 43 (.filter-bar > .navigation-bar > .item): 44 (.filter-bar > input[type="search"]): 45 (.filter-bar > .navigation-bar + input[type="search"]): Added. 46 (.filter-bar > input[type="search"] + .navigation-bar:empty): Added. 47 Move the position of the filter bar buttons to be after the filter bar itself, so that other 48 parents can add action items before the filter bar to keep a consistent positioning. 49 - to the left of the filter bar are action items (e.g. "+") 50 - the filter bar itself 51 - to the right of the filter bar are filter buttons (e.g. "filter by resoure with issue") 52 53 * UserInterface/Controllers/NetworkManager.js: 54 (WI.NetworkManager.prototype.get frames): 55 Drive-by: use `Array.from`, instead of `[...map.values()]`. 56 57 * UserInterface/Models/Frame.js: 58 (WI.Frame.prototype.get url): 59 (WI.Frame.prototype.get urlComponents): Added. 60 61 * UserInterface/Base/URLUtilities.js.js: 62 (parseURL): 63 Calculate and include the `origin` string with the output. 64 65 * UserInterface/Controllers/CSSManager.js: 66 (WI.CSSManager.prototype.preferredInspectorStyleSheetForFrame): 67 Remove `doNotCreateIfMissing` now that the last caller has been removed. 68 69 * Localizations/en.lproj/localizedStrings.js: 70 1 71 2019-08-15 Devin Rousso <drousso@apple.com> 2 72 -
trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
r248485 r248753 301 301 localizedStrings["Create %s Rule"] = "Create %s Rule"; 302 302 localizedStrings["Create Breakpoint"] = "Create Breakpoint"; 303 localizedStrings["Create Resource"] = "Create Resource"; 303 304 localizedStrings["Create a new tab"] = "Create a new tab"; 304 305 localizedStrings["Cross-Origin Restrictions"] = "Cross-Origin Restrictions"; -
trunk/Source/WebInspectorUI/UserInterface/Base/URLUtilities.js
r246559 r248753 97 97 98 98 if (url.startsWith("data:")) 99 return {scheme: "data", userinfo: null, host: null, port: null, path: null, queryString: null, fragment: null, lastPathComponent: null};99 return {scheme: "data", userinfo: null, host: null, port: null, origin: null, path: null, queryString: null, fragment: null, lastPathComponent: null}; 100 100 101 101 let match = url.match(/^(?<scheme>[^\/:]+):\/\/(?:(?<userinfo>[^#@\/]+)@)?(?<host>[^\/#:]*)(?::(?<port>[\d]+))?(?:(?<path>\/[^#]*)?(?:#(?<fragment>.*))?)?$/i); 102 102 if (!match) 103 return {scheme: null, userinfo: null, host: null, port: null, path: null, queryString: null, fragment: null, lastPathComponent: null};103 return {scheme: null, userinfo: null, host: null, port: null, origin: null, path: null, queryString: null, fragment: null, lastPathComponent: null}; 104 104 105 105 let scheme = match.groups.scheme.toLowerCase(); … … 132 132 } 133 133 134 return {scheme, userinfo, host, port, path, queryString, fragment, lastPathComponent}; 134 let origin = null; 135 if (scheme && host) { 136 origin = scheme + "://" + host; 137 if (port) 138 origin += ":" + port; 139 } 140 141 return {scheme, userinfo, host, port, origin, path, queryString, fragment, lastPathComponent}; 135 142 } 136 143 … … 235 242 } 236 243 237 if (options.allowDirectoryAsName && ( !displayName || urlComponents.path.endsWith(displayName + "/")))244 if (options.allowDirectoryAsName && (urlComponents.path === "/" || (displayName && urlComponents.path.endsWith(displayName + "/")))) 238 245 displayName = "/"; 239 246 -
trunk/Source/WebInspectorUI/UserInterface/Controllers/CSSManager.js
r248602 r248753 306 306 } 307 307 308 preferredInspectorStyleSheetForFrame(frame, callback , doNotCreateIfMissing)308 preferredInspectorStyleSheetForFrame(frame, callback) 309 309 { 310 310 var inspectorStyleSheets = this.inspectorStyleSheetsForFrame(frame); … … 315 315 } 316 316 } 317 318 if (doNotCreateIfMissing)319 return;320 317 321 318 if (CSSAgent.createStyleSheet) { -
trunk/Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js
r248536 r248753 114 114 get frames() 115 115 { 116 return [...this._frameIdentifierMap.values()];116 return Array.from(this._frameIdentifierMap.values()); 117 117 } 118 118 -
trunk/Source/WebInspectorUI/UserInterface/Models/Frame.js
r248497 r248753 188 188 get url() 189 189 { 190 return this._mainResource._url; 190 return this._mainResource.url; 191 } 192 193 get urlComponents() 194 { 195 return this._mainResource.urlComponents; 191 196 } 192 197 -
trunk/Source/WebInspectorUI/UserInterface/Views/FilterBar.css
r242768 r248753 41 41 .filter-bar > .navigation-bar > .item { 42 42 padding: 0 0 3px; 43 -webkit-padding-start: 8px;44 43 } 45 44 … … 49 48 min-width: 0; 50 49 51 margin: 3px 6px 4px; 50 margin: 3px 0 4px; 51 -webkit-margin-start: 6px; 52 52 padding-top: 0; 53 53 … … 62 62 63 63 height: 22px; 64 } 65 66 .filter-bar > .navigation-bar + input[type="search"] { 67 -webkit-margin-start: 0; 64 68 } 65 69 … … 97 101 animation-timing-function: step-start; 98 102 } 103 104 .filter-bar > input[type="search"] + .navigation-bar:empty { 105 -webkit-margin-start: 6px; 106 } -
trunk/Source/WebInspectorUI/UserInterface/Views/FilterBar.js
r248198 r248753 33 33 this._element.classList.add("filter-bar"); 34 34 35 this._filtersNavigationBar = new WI.NavigationBar;36 this._element.appendChild(this._filtersNavigationBar.element);37 38 35 this._filterFunctionsMap = new Map; 39 36 … … 47 44 this._element.appendChild(this._inputField); 48 45 46 this._filtersNavigationBar = new WI.NavigationBar; 47 this._element.appendChild(this._filtersNavigationBar.element); 48 49 49 this._lastFilterValue = this.filters; 50 50 } -
trunk/Source/WebInspectorUI/UserInterface/Views/FrameTreeElement.js
r236885 r248753 179 179 } 180 180 181 const doNotCreateIfMissing = true;182 WI.cssManager.preferredInspectorStyleSheetForFrame(this._frame, this.addRepresentedObjectToNewChildQueue.bind(this), doNotCreateIfMissing);181 for (let styleSheet of WI.cssManager.inspectorStyleSheetsForFrame(this._frame)) 182 this.addChildForRepresentedObject(styleSheet); 183 183 } 184 184 -
trunk/Source/WebInspectorUI/UserInterface/Views/GeneralTreeElement.js
r243300 r248753 192 192 } 193 193 194 createFoldersAsNeededForSubpath(subpath )194 createFoldersAsNeededForSubpath(subpath, comparator) 195 195 { 196 196 if (!subpath) … … 224 224 this._subpathFolderTreeElementMap.set(currentPath, newFolder); 225 225 226 let index = insertionIndexForObjectInListSortedByFunction(newFolder, currentFolderTreeElement.children, WI.ResourceTreeElement.compareFolderAndResourceTreeElements);226 let index = insertionIndexForObjectInListSortedByFunction(newFolder, currentFolderTreeElement.children, comparator || WI.ResourceTreeElement.compareFolderAndResourceTreeElements); 227 227 currentFolderTreeElement.insertChild(newFolder, index); 228 228 currentFolderTreeElement = newFolder; -
trunk/Source/WebInspectorUI/UserInterface/Views/SourcesNavigationSidebarPanel.js
r248737 r248753 243 243 resourcesContainer.appendChild(this._resourcesTreeOutline.element); 244 244 245 let onlyShowResourcesWithIssuesFilterFunction = (treeElement) => { 246 if (treeElement.treeOutline !== this._resourcesTreeOutline) 247 return true; 248 249 if (treeElement instanceof WI.IssueTreeElement) 250 return true; 251 252 if (treeElement.hasChildren) { 253 for (let child of treeElement.children) { 254 if (child instanceof WI.IssueTreeElement) 255 return true; 256 } 257 } 258 return false; 259 }; 245 if (InspectorBackend.domains.CSS) { 246 let createResourceNavigationBar = new WI.NavigationBar; 247 248 let createResourceButtonNavigationItem = new WI.ButtonNavigationItem("create-resource", WI.UIString("Create Resource"), "Images/Plus15.svg", 15, 15); 249 WI.addMouseDownContextMenuHandlers(createResourceButtonNavigationItem.element, this._populateCreateResourceContextMenu.bind(this)); 250 createResourceNavigationBar.addNavigationItem(createResourceButtonNavigationItem); 251 252 this.filterBar.element.insertBefore(createResourceNavigationBar.element, this.filterBar.element.firstChild); 253 } 254 260 255 const activatedByDefault = false; 261 this.filterBar.addFilterBarButton("sources-only-show-resources-with-issues", onlyShowResourcesWithIssuesFilterFunction, activatedByDefault, WI.UIString("Only show resources with issues"), WI.UIString("Show all resources"), "Images/Errors.svg", 15, 15);256 this.filterBar.addFilterBarButton("sources-only-show-resources-with-issues", this._filterByResourcesWithIssues.bind(this), activatedByDefault, WI.UIString("Only show resources with issues"), WI.UIString("Show all resources"), "Images/Errors.svg", 15, 15); 262 257 263 258 WI.settings.resourceGroupingMode.addEventListener(WI.Setting.Event.Changed, this._handleResourceGroupingModeChanged, this); … … 267 262 WI.Target.addEventListener(WI.Target.Event.ResourceAdded, this._handleResourceAdded, this); 268 263 269 WI.networkManager.addEventListener(WI.NetworkManager.Event. MainFrameDidChange, this._handleMainFrameDidChange, this);264 WI.networkManager.addEventListener(WI.NetworkManager.Event.FrameWasAdded, this._handleFrameWasAdded, this); 270 265 271 266 WI.debuggerManager.addEventListener(WI.DebuggerManager.Event.BreakpointAdded, this._handleDebuggerBreakpointAdded, this); … … 430 425 } 431 426 432 if (representedObject instanceof WI.Resource && representedObject.parentFrame && representedObject.parentFrame.mainResource === representedObject) 433 representedObject = representedObject.parentFrame; 427 switch (WI.settings.resourceGroupingMode.value) { 428 case WI.Resource.GroupingMode.Path: 429 if (representedObject instanceof WI.Frame) 430 representedObject = representedObject.mainResource; 431 break; 432 433 default: 434 WI.reportInternalError("Unknown resource grouping mode", {"Resource Grouping Mode": WI.settings.resourceGroupingMode.value}); 435 // Fallthrough for default value. 436 437 case WI.Resource.GroupingMode.Type: 438 if (representedObject instanceof WI.Resource && representedObject.parentFrame && representedObject.parentFrame.mainResource === representedObject) 439 representedObject = representedObject.parentFrame; 440 break; 441 } 434 442 435 443 function isAncestor(ancestor, resourceOrFrame) { … … 598 606 // Private 599 607 608 _filterByResourcesWithIssues(treeElement) 609 { 610 if (treeElement.treeOutline !== this._resourcesTreeOutline) 611 return true; 612 613 if (treeElement instanceof WI.IssueTreeElement) 614 return true; 615 616 if (treeElement.hasChildren) { 617 for (let child of treeElement.children) { 618 if (child instanceof WI.IssueTreeElement) 619 return true; 620 } 621 } 622 return false; 623 } 624 600 625 _compareTreeElements(a, b) 601 626 { … … 605 630 (treeElement) => treeElement instanceof WI.FrameTreeElement, 606 631 (treeElement) => { 607 return treeElement instanceof WI.FolderTreeElement 608 && treeElement !== this._extensionScriptsFolderTreeElement 632 return treeElement !== this._extensionScriptsFolderTreeElement 609 633 && treeElement !== this._extraScriptsFolderTreeElement 610 634 && treeElement !== this._anonymousScriptsFolderTreeElement; … … 639 663 return; 640 664 641 let resourceGroupingMode = WI.settings.resourceGroupingMode.value; 642 switch (resourceGroupingMode) { 643 case WI.Resource.GroupingMode.Path: 665 switch (WI.settings.resourceGroupingMode.value) { 666 case WI.Resource.GroupingMode.Path: { 644 667 for (let treeElement of this._originTreeElementMap.values()) { 645 668 if (treeElement !== oldMainFrameTreeElement) … … 648 671 this._originTreeElementMap.clear(); 649 672 650 this._mainFrameTreeElement = new WI.FolderTreeElement(mainFrame.securityOrigin, mainFrame); 651 this._originTreeElementMap.set(mainFrame.securityOrigin, this._mainFrameTreeElement); 673 let origin = mainFrame.urlComponents.origin; 674 this._mainFrameTreeElement = new WI.FolderTreeElement(origin); 675 this._originTreeElementMap.set(origin, this._mainFrameTreeElement); 652 676 break; 677 } 653 678 654 679 default: … … 712 737 return; 713 738 714 let origin = null;715 if (resource.urlComponents.scheme && resource.urlComponents.host) {716 origin = resource.urlComponents.scheme + "://" + resource.urlComponents.host;717 if (resource.urlComponents.port)718 origin += ":" + resource.urlComponents.port;719 } else if (resource.parentFrame)720 origin = resource.parentFrame.securityOrigin;721 722 739 let parentTreeElement = null; 723 if (origin) { 724 let frameTreeElement = this._originTreeElementMap.get(origin); 725 if (!frameTreeElement) { 726 frameTreeElement = new WI.FolderTreeElement(origin, origin === resource.parentFrame.securityOrigin ? resource.parentFrame : null); 727 this._originTreeElementMap.set(origin, frameTreeElement); 728 729 let index = insertionIndexForObjectInListSortedByFunction(frameTreeElement, this._resourcesTreeOutline.children, this._boundCompareTreeElements); 730 this._resourcesTreeOutline.insertChild(frameTreeElement, index); 731 } 732 733 let subpath = resource.urlComponents.path; 734 if (subpath && subpath[0] === "/") 735 subpath = subpath.substring(1); 736 737 parentTreeElement = frameTreeElement.createFoldersAsNeededForSubpath(subpath); 738 } else { 739 parentTreeElement = this._resourcesTreeOutline; 740 741 if (resource instanceof WI.CSSStyleSheet && resource.isInspectorStyleSheet()) 742 parentTreeElement = this._resourcesTreeOutline.findTreeElement(resource.parentFrame.mainResource); 743 744 if (!parentTreeElement) { 745 let origin = resource.urlComponents.origin; 746 if (origin) { 747 let frameTreeElement = this._originTreeElementMap.get(origin); 748 if (!frameTreeElement) { 749 frameTreeElement = new WI.FolderTreeElement(origin); 750 this._originTreeElementMap.set(origin, frameTreeElement); 751 752 let index = insertionIndexForObjectInListSortedByFunction(frameTreeElement, this._resourcesTreeOutline.children, this._boundCompareTreeElements); 753 this._resourcesTreeOutline.insertChild(frameTreeElement, index); 754 } 755 756 let subpath = resource.urlComponents.path; 757 if (subpath && subpath[0] === "/") 758 subpath = subpath.substring(1); 759 760 parentTreeElement = frameTreeElement.createFoldersAsNeededForSubpath(subpath, this._boundCompareTreeElements); 761 } else 762 parentTreeElement = this._resourcesTreeOutline; 740 763 } 741 764 … … 1506 1529 || treeElement instanceof WI.CSSStyleSheetTreeElement) { 1507 1530 let representedObject = treeElement.representedObject; 1508 if (representedObject instanceof WI.Collection || representedObject instanceof WI.SourceCode )1531 if (representedObject instanceof WI.Collection || representedObject instanceof WI.SourceCode || representedObject instanceof WI.Frame) 1509 1532 WI.showRepresentedObject(representedObject); 1510 1533 return; … … 1647 1670 } 1648 1671 1672 _populateCreateResourceContextMenu(contextMenu) 1673 { 1674 if (InspectorBackend.domains.CSS) { 1675 let addInspectorStyleSheetItem = (menu, frame) => { 1676 menu.appendItem(WI.UIString("Inspector Style Sheet"), () => { 1677 if (WI.settings.resourceGroupingMode.value === WI.Resource.GroupingMode.Path) { 1678 // Force the parent to populate. 1679 let parentFrameTreeElement = this._resourcesTreeOutline.findTreeElement(frame.mainResource); 1680 parentFrameTreeElement.reveal(); 1681 parentFrameTreeElement.expand(); 1682 } 1683 1684 WI.cssManager.preferredInspectorStyleSheetForFrame(frame, (styleSheet) => { 1685 WI.showRepresentedObject(styleSheet); 1686 }); 1687 }); 1688 }; 1689 1690 addInspectorStyleSheetItem(contextMenu, WI.networkManager.mainFrame); 1691 1692 let frames = WI.networkManager.frames; 1693 if (frames.length > 2) { 1694 let framesSubMenu = contextMenu.appendSubMenuItem(WI.UIString("Frames")); 1695 1696 for (let frame of frames) { 1697 if (frame === WI.networkManager.mainFrame || frame.mainResource.type !== WI.Resource.Type.Document) 1698 continue; 1699 1700 let frameSubMenuItem = framesSubMenu.appendSubMenuItem(frame.name ? WI.UIString("%s (%s)").format(frame.name, frame.mainResource.displayName) : frame.mainResource.displayName); 1701 1702 addInspectorStyleSheetItem(frameSubMenuItem, frame); 1703 } 1704 } 1705 } 1706 } 1707 1649 1708 _handleResourceGroupingModeChanged(event) 1650 1709 { … … 1663 1722 this._updateMainFrameTreeElement(mainFrame); 1664 1723 this._addResourcesRecursivelyForFrame(mainFrame); 1724 1725 for (let frame of WI.networkManager.frames) { 1726 if (frame !== mainFrame) 1727 this._addResourcesRecursivelyForFrame(frame); 1728 } 1665 1729 } 1666 1730 … … 1696 1760 } 1697 1761 1698 _handleMainFrameDidChange(event) 1699 { 1700 let mainFrame = WI.networkManager.mainFrame; 1701 this._updateMainFrameTreeElement(mainFrame); 1702 this._addResourcesRecursivelyForFrame(mainFrame); 1762 _handleFrameWasAdded(event) 1763 { 1764 let {frame} = event.data; 1765 1766 if (frame.isMainFrame()) 1767 this._updateMainFrameTreeElement(frame); 1768 1769 this._addResourcesRecursivelyForFrame(frame); 1703 1770 } 1704 1771
Note:
See TracChangeset
for help on using the changeset viewer.