chrome-devtools-frontend 1.0.1705227 → 1.0.1708524
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/code-review/SKILL.md +121 -0
- package/eslint.config.mjs +1 -0
- package/front_end/Images/src/nodejsHex.svg +28 -0
- package/front_end/core/sdk/CPUThrottlingManager.ts +14 -10
- package/front_end/core/sdk/DOMModel.ts +73 -21
- package/front_end/core/sdk/DebuggerModel.ts +0 -4
- package/front_end/core/sdk/NetworkRequest.ts +43 -7
- package/front_end/core/sdk/PageResourceLoader.ts +12 -11
- package/front_end/core/sdk/SourceMap.ts +11 -18
- package/front_end/core/sdk/SourceMapFunctionRanges.ts +22 -37
- package/front_end/core/sdk/SourceMapScopeChainEntry.ts +3 -3
- package/front_end/core/sdk/SourceMapScopesInfo.ts +183 -147
- package/front_end/core/text_utils/ContentData.ts +18 -1
- package/front_end/entrypoints/formatter_worker/formatter_worker-entrypoint.ts +7 -2
- package/front_end/entrypoints/heap_snapshot_worker/ContextAnalyzer.ts +238 -20
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotLoader.ts +16 -5
- package/front_end/entrypoints/inspector_main/nodeIcon.css +1 -1
- package/front_end/generated/InspectorBackendCommands.ts +8 -2
- package/front_end/generated/SupportedCSSProperties.ts +11 -2
- package/front_end/generated/protocol-mapping.d.ts +31 -0
- package/front_end/generated/protocol-proxy-api.d.ts +32 -0
- package/front_end/generated/protocol.ts +12 -1
- package/front_end/models/ai_assistance/AiAgent2.ts +1 -0
- package/front_end/models/ai_assistance/AiConversation.ts +16 -3
- package/front_end/models/ai_assistance/data_formatters/LighthouseFormatter.ts +26 -3
- package/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.ts +15 -16
- package/front_end/models/ai_assistance/skills/Skill.ts +1 -2
- package/front_end/models/ai_assistance/skills/SkillRegistry.ts +2 -0
- package/front_end/models/ai_assistance/skills/accessibility.md +8 -7
- package/front_end/models/ai_assistance/skills/lighthouse.md +33 -0
- package/front_end/models/ai_assistance/tools/GetLighthouseAudits.ts +6 -6
- package/front_end/models/ai_assistance/tools/RunLighthouse.ts +8 -5
- package/front_end/models/bindings/CompilerScriptMapping.ts +102 -45
- package/front_end/models/bindings/DebuggerLanguagePlugins.ts +25 -33
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +33 -39
- package/front_end/models/bindings/StylesSourceMapping.ts +3 -0
- package/front_end/models/extensions/ExtensionEndpoint.ts +27 -6
- package/front_end/models/extensions/LanguageExtensionEndpoint.ts +106 -21
- package/front_end/models/extensions/RecorderExtensionEndpoint.ts +4 -2
- package/front_end/models/formatter/FormatterWorkerPool.ts +6 -1
- package/front_end/models/javascript_metadata/NativeFunctions.ts +12 -4
- package/front_end/models/persistence/NetworkPersistenceManager.ts +4 -3
- package/front_end/models/source_map_scopes/NamesResolver.ts +7 -17
- package/front_end/models/stack_trace/StackTraceImpl.ts +138 -47
- package/front_end/models/stack_trace/StackTraceModel.ts +117 -84
- package/front_end/models/stack_trace/Trie.ts +27 -0
- package/front_end/panels/accessibility/ARIAAttributesView.ts +6 -6
- package/front_end/panels/accessibility/AccessibilityAnnouncementRecordingView.ts +2 -2
- package/front_end/panels/accessibility/AccessibilityNodeView.ts +6 -9
- package/front_end/panels/accessibility/AccessibilitySidebarView.ts +83 -69
- package/front_end/panels/accessibility/AccessibilitySubPane.ts +24 -9
- package/front_end/panels/accessibility/SourceOrderView.ts +7 -3
- package/front_end/panels/accessibility/accessibilitySidebarView.css +5 -3
- package/front_end/panels/application/BackgroundServiceView.ts +1 -0
- package/front_end/panels/application/components/AdsView.ts +6 -6
- package/front_end/panels/application/components/BackForwardCacheView.ts +1 -1
- package/front_end/panels/application/serviceWorkersView.css +1 -1
- package/front_end/panels/common/CommentThreadWidget.ts +30 -1
- package/front_end/panels/common/CommentsOverlayWidget.ts +42 -38
- package/front_end/panels/common/common-meta.ts +21 -9
- package/front_end/panels/console/ConsoleInsightTeaser.ts +25 -19
- package/front_end/panels/console/ConsoleViewMessage.ts +51 -21
- package/front_end/panels/console/console-meta.ts +1 -5
- package/front_end/panels/elements/CSSRuleValidator.ts +3 -0
- package/front_end/panels/elements/ClassesPaneWidget.ts +4 -1
- package/front_end/panels/elements/DOMTreeWidget.ts +207 -586
- package/front_end/panels/elements/ElementsPanel.ts +1 -5
- package/front_end/panels/elements/LayoutPane.ts +17 -20
- package/front_end/panels/elements/StylePropertyTreeElement.ts +100 -5
- package/front_end/panels/lighthouse/LighthouseController.ts +9 -4
- package/front_end/panels/network/NetworkConfigView.ts +231 -187
- package/front_end/panels/network/NetworkLogViewColumns.ts +10 -3
- package/front_end/panels/network/RequestPayloadView.ts +22 -14
- package/front_end/panels/network/ShowMoreDetailsWidget.ts +1 -1
- package/front_end/panels/profiler/HeapDetachedElementsDataGrid.ts +0 -1
- package/front_end/panels/recorder/RecordingView.ts +42 -47
- package/front_end/panels/recorder/StepEditor.ts +1 -0
- package/front_end/panels/recorder/recordingView.css +4 -4
- package/front_end/panels/security/SecurityPanel.ts +14 -7
- package/front_end/panels/sources/BreakpointEditDialog.ts +13 -1
- package/front_end/panels/sources/CSSPlugin.ts +11 -0
- package/front_end/panels/sources/CoveragePlugin.ts +34 -23
- package/front_end/panels/sources/DebuggerPlugin.ts +66 -54
- package/front_end/panels/sources/EditingLocationHistoryManager.ts +6 -6
- package/front_end/panels/sources/NavigatorView.ts +97 -52
- package/front_end/panels/sources/OpenFileQuickOpen.ts +2 -2
- package/front_end/panels/sources/Plugin.ts +18 -3
- package/front_end/panels/sources/ResourceOriginPlugin.ts +14 -17
- package/front_end/panels/sources/SourcesPanel.ts +1 -1
- package/front_end/panels/sources/SourcesView.ts +67 -157
- package/front_end/panels/sources/TabbedEditorContainer.ts +102 -23
- package/front_end/panels/sources/UISourceCodeFrame.ts +33 -15
- package/front_end/panels/sources/navigatorTree.css +2 -2
- package/front_end/panels/sources/sourcesView.css +17 -27
- package/front_end/panels/timeline/overlays/components/EntryLabelOverlay.ts +1 -0
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/source-map-scopes-codec/README.chromium +2 -2
- package/front_end/third_party/source-map-scopes-codec/package/CONTRIBUTING.md +14 -1
- package/front_end/third_party/source-map-scopes-codec/package/README.md +8 -6
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/builder.d.ts +4 -1
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/builder.d.ts.map +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/safe_builder.d.ts +3 -1
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/builder/safe_builder.d.ts.map +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/decode/decode.d.ts.map +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/scopes.d.ts +4 -3
- package/front_end/third_party/source-map-scopes-codec/package/_dist/src/scopes.d.ts.map +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/deno.json +6 -2
- package/front_end/third_party/source-map-scopes-codec/package/package.json +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/src/builder/builder.js +18 -2
- package/front_end/third_party/source-map-scopes-codec/package/src/builder/builder.js.map +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/src/builder/builder.ts +22 -3
- package/front_end/third_party/source-map-scopes-codec/package/src/builder/safe_builder.js +33 -5
- package/front_end/third_party/source-map-scopes-codec/package/src/builder/safe_builder.js.map +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/src/builder/safe_builder.ts +41 -5
- package/front_end/third_party/source-map-scopes-codec/package/src/codec.js +0 -2
- package/front_end/third_party/source-map-scopes-codec/package/src/codec.js.map +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/src/codec.ts +4 -3
- package/front_end/third_party/source-map-scopes-codec/package/src/decode/decode.js +99 -36
- package/front_end/third_party/source-map-scopes-codec/package/src/decode/decode.js.map +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/src/decode/decode.ts +143 -49
- package/front_end/third_party/source-map-scopes-codec/package/src/encode/encode.js +3 -1
- package/front_end/third_party/source-map-scopes-codec/package/src/encode/encode.js.map +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/src/encode/encode.ts +3 -1
- package/front_end/third_party/source-map-scopes-codec/package/src/encode/encoder.js +40 -18
- package/front_end/third_party/source-map-scopes-codec/package/src/encode/encoder.js.map +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/src/encode/encoder.ts +51 -21
- package/front_end/third_party/source-map-scopes-codec/package/src/scopes.ts +4 -3
- package/front_end/third_party/source-map-scopes-codec/package/src/vlq.js +18 -4
- package/front_end/third_party/source-map-scopes-codec/package/src/vlq.js.map +1 -1
- package/front_end/third_party/source-map-scopes-codec/package/src/vlq.ts +18 -4
- package/front_end/ui/comments/CommentAnchorResolver.ts +17 -0
- package/front_end/ui/comments/CommentOverlayManager.ts +23 -10
- package/front_end/ui/components/suggestion_input/SuggestionInput.ts +10 -1
- package/front_end/ui/components/text_editor/AiCodeCompletionTeaser.ts +1 -1
- package/front_end/ui/components/text_editor/AiCodeGenerationTeaser.ts +2 -2
- package/front_end/ui/components/text_editor/aiCodeCompletionTeaser.css +0 -11
- package/front_end/ui/components/text_editor/aiCodeGenerationTeaser.css +0 -11
- package/front_end/ui/components/text_editor/javascript.ts +128 -52
- package/front_end/ui/legacy/SearchableView.ts +125 -74
- package/front_end/ui/legacy/SoftDropDown.ts +17 -4
- package/front_end/ui/legacy/StackPane.ts +141 -0
- package/front_end/ui/legacy/TextPrompt.ts +37 -7
- package/front_end/ui/legacy/Toolbar.ts +7 -5
- package/front_end/ui/legacy/Widget.ts +3 -3
- package/front_end/ui/legacy/components/inline_editor/PositionAreaEditor.ts +85 -0
- package/front_end/ui/legacy/components/inline_editor/positionAreaEditor.css +61 -0
- package/front_end/ui/legacy/components/source_frame/FontView.ts +5 -5
- package/front_end/ui/legacy/components/source_frame/ImageView.ts +13 -13
- package/front_end/ui/legacy/components/source_frame/ResourceSourceFrame.ts +2 -6
- package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +3 -2
- package/front_end/ui/legacy/components/utils/Linkifier.ts +21 -45
- package/front_end/ui/legacy/inspectorCommon.css +11 -0
- package/front_end/ui/legacy/legacy.ts +2 -0
- package/front_end/ui/legacy/softContextMenu.css +2 -0
- package/front_end/ui/settings/ConsoleSettings.ts +7 -0
- package/front_end/ui/visual_logging/KnownContextValues.ts +10 -0
- package/mcp/mcp.ts +1 -0
- package/package.json +1 -1
- package/front_end/Images/nodeIcon.avif +0 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-review
|
|
3
|
+
description: Generic checklist for reviewing DevTools CLs (your own before upload, or someone else's on Gerrit). Covers test correctness (tautological/vacuous tests, cleanup, leaks), code clarity, CL hygiene, and points to the specialized skills to consult for imports, UI, testing, strings, models, and verification. Use when asked to review a CL, a diff, a patch, or to self-review before `git cl upload`.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Code Review
|
|
7
|
+
|
|
8
|
+
This checklist comes from recurring reviewer feedback on landed DevTools CLs.
|
|
9
|
+
Use it for self-review before upload and for reviewing other people's CLs.
|
|
10
|
+
|
|
11
|
+
## 1. Gather context
|
|
12
|
+
|
|
13
|
+
- **Local change:** `git diff origin/main...HEAD` (or `git show HEAD` for a
|
|
14
|
+
single-commit branch). To learn about the branch and upload workflow, see the
|
|
15
|
+
`devtools-version-control` skill.
|
|
16
|
+
- **Gerrit CL:** strip the leading `)]}'` line from each response to get JSON:
|
|
17
|
+
- Diff: `git cl diff` (for the current branch), or fetch the patch set.
|
|
18
|
+
- Inline comments:
|
|
19
|
+
`curl -s https://chromium-review.googlesource.com/changes/devtools%2Fdevtools-frontend~<CL_NUMBER>/comments | tail -n +2`
|
|
20
|
+
- Messages:
|
|
21
|
+
`.../changes/devtools%2Fdevtools-frontend~<CL_NUMBER>/messages`
|
|
22
|
+
- Read the CL description first. Then check that the diff does what the
|
|
23
|
+
description says, and nothing else.
|
|
24
|
+
|
|
25
|
+
## 2. Consult the specialized skills
|
|
26
|
+
|
|
27
|
+
Load the skill that matches what the diff touches, and apply its rules:
|
|
28
|
+
|
|
29
|
+
| If the diff touches… | Use skill |
|
|
30
|
+
| :--- | :--- |
|
|
31
|
+
| Any `import` statement, or a new cross-module dependency | `devtools-imports` |
|
|
32
|
+
| `UI.Widget`, lit-html views, components, CSS | `devtools-ui-widgets` |
|
|
33
|
+
| Migration of legacy imperative DOM to widgets or Lit | `ui-eng-vision-orchestrator` (and its sub-skills) |
|
|
34
|
+
| New or changed tests: choosing unit, API, or E2E | `devtools-testing-guidance` |
|
|
35
|
+
| Tests that use `describeWithEnvironment` or `describeWithMockConnection`, or foundation modules | `foundation-test-migration` |
|
|
36
|
+
| Ported Chromium web tests (`web_tests/http/tests/devtools`) | `migrate-chromium-test` |
|
|
37
|
+
| Flaky or disabled tests, or `it.skip` / `it.skipOnPlatforms` | `fix-tests` |
|
|
38
|
+
| `UIStrings` / user-facing text | `devtools-ux-writing-refactor` |
|
|
39
|
+
| Rendering user-controlled strings (URLs, names, console text) | `devtools-unicode-escaping` |
|
|
40
|
+
| `front_end/models/*`, `BUILD.gn`, `devtools_grd_files.gni`, entrypoints | `devtools-model-management` |
|
|
41
|
+
| Merging modules or consolidating `BUILD.gn` | `merging-devtools-module` |
|
|
42
|
+
| `Settings` registrations and descriptors | `devtools-setting-migration` |
|
|
43
|
+
| Stack traces, source maps, `DebuggerWorkspaceBinding` | `devtools-source-maps` |
|
|
44
|
+
| Building, running tests, or lint | `devtools-verification` |
|
|
45
|
+
|
|
46
|
+
## 3. Test correctness (the most common review feedback)
|
|
47
|
+
|
|
48
|
+
- **Tautological tests:** A test must exercise real production code. If a
|
|
49
|
+
mock does the thing the test asserts (for example, a mocked `DOM.undo` that
|
|
50
|
+
calls `removeSection()` directly, followed by an assertion that the section
|
|
51
|
+
was removed), the test checks the mock and nothing else. Mock the *boundary*
|
|
52
|
+
instead (for example, have the CDP stub emit `CSSModel.Events.StyleSheetChanged`)
|
|
53
|
+
and let production code react to it.
|
|
54
|
+
- **Vacuous tests:** Look for local promises or data that are never connected
|
|
55
|
+
to DevTools logic, or stubs (like `initialize`) that skip the code path under
|
|
56
|
+
test. These tests pass because nothing happens.
|
|
57
|
+
- **Assertions that check the setup:** For example,
|
|
58
|
+
`assert.isNull(pane.node())` right after `pane.setNodeForTest(null)`. Each
|
|
59
|
+
assertion should verify the behavior that the test name describes.
|
|
60
|
+
- **Test lives where it belongs:** A test in `Foo.test.ts` should exercise
|
|
61
|
+
`Foo`. Move logic-only tests to the model's test file (for example,
|
|
62
|
+
`CSSMatchedStyles.test.ts`). Otherwise, render the UI and assert on the DOM.
|
|
63
|
+
- **Test covers the scenario it claims:** For example, an "iframe event
|
|
64
|
+
listeners" test must select a node *inside* the iframe. It is not enough
|
|
65
|
+
that it passes on `<body>` of the main frame.
|
|
66
|
+
- **Right suite:** Ask whether an E2E test could be a unit test, or whether the
|
|
67
|
+
E2E coverage is intentional for a user story. See `devtools-testing-guidance`.
|
|
68
|
+
- **E2E selectors match real UI:** Labels and `aria-label`s must match the
|
|
69
|
+
actual strings, for example "Show user agent shadow DOM" and not "User agent
|
|
70
|
+
shadow DOM". Check that the setting being toggled actually affects the
|
|
71
|
+
scenario.
|
|
72
|
+
- **Fail fast:** Throw or assert when a required value is missing. Don't let
|
|
73
|
+
the test time out later.
|
|
74
|
+
|
|
75
|
+
## 4. Test hygiene and cleanup
|
|
76
|
+
|
|
77
|
+
- Pair every `beforeEach` singleton creation with a cleanup in `afterEach`
|
|
78
|
+
(for example, `CSSWorkspaceBinding.removeInstance()` or
|
|
79
|
+
`WorkspaceImpl.removeInstance()`) so that state does not leak between tests.
|
|
80
|
+
- Restore fake timers in `try { … } finally { clock.restore(); }`, or use the
|
|
81
|
+
sandbox or cleanup that the test runner provides. Keep the scope of fake
|
|
82
|
+
timers small.
|
|
83
|
+
- Don't stub the same method twice without calling `restore()` first. Sinon
|
|
84
|
+
throws `Attempted to wrap … which is already wrapped` when the object is the
|
|
85
|
+
same instance.
|
|
86
|
+
- Remove guards that were copied from helpers for no reason (for example,
|
|
87
|
+
`if (!stub.called) …` in a test that stubs the method only once).
|
|
88
|
+
|
|
89
|
+
## 5. Code clarity
|
|
90
|
+
|
|
91
|
+
- Don't take detours to reach a value. If a module is imported, call
|
|
92
|
+
`TextUtils.TextRange.TextRange.fromObject(...)` directly instead of going
|
|
93
|
+
through `rule.style.range.constructor`.
|
|
94
|
+
- Look for dead code, leftover debug code, commented-out blocks, and unrelated
|
|
95
|
+
formatting churn.
|
|
96
|
+
- Check that the change stays in scope. Flag unrelated refactors that should be
|
|
97
|
+
split into a separate CL.
|
|
98
|
+
- Check for lifecycle issues: event listeners and observers that are added
|
|
99
|
+
without being removed, and async work that continues after a widget is
|
|
100
|
+
detached.
|
|
101
|
+
|
|
102
|
+
## 6. CL hygiene
|
|
103
|
+
|
|
104
|
+
- The description explains *why*, including external dependencies (for
|
|
105
|
+
example, "V8 will stop emitting X; this must land first").
|
|
106
|
+
- Include a `Bug:` or `Fixed:` trailer, or `Bug: None`. Keep lines under 72
|
|
107
|
+
characters.
|
|
108
|
+
- For migrations and stacked series, list the legacy tests or files covered,
|
|
109
|
+
and number the series (for example, `(13/16)`).
|
|
110
|
+
- Disabled tests reference a bug.
|
|
111
|
+
- Presubmit, lint, and format pass. See `devtools-verification`.
|
|
112
|
+
|
|
113
|
+
## 7. Writing review comments
|
|
114
|
+
|
|
115
|
+
- Be specific: cite file and line, explain the concrete failure mode (such as
|
|
116
|
+
a leak, a hang, or "passes vacuously"), and suggest a fix. Include a code
|
|
117
|
+
snippet when it helps.
|
|
118
|
+
- Separate blocking issues from nits and questions (for example, "Should we
|
|
119
|
+
move this to a unit test?").
|
|
120
|
+
- When a reviewer's concern is not an actual bug, reply with the rationale.
|
|
121
|
+
Don't make a silent change.
|
package/eslint.config.mjs
CHANGED
|
@@ -628,6 +628,7 @@ export default defineConfig([
|
|
|
628
628
|
'@devtools/l10n-no-i18nString-calls-module-instantiation': 'error',
|
|
629
629
|
'@devtools/l10n-no-uistrings-export': 'error',
|
|
630
630
|
'@devtools/l10n-no-unused-message': 'error',
|
|
631
|
+
'@devtools/l10n-uistrings-sentence-punctuation': 'error',
|
|
631
632
|
'@devtools/l10n-uistrings-text-style': 'error',
|
|
632
633
|
},
|
|
633
634
|
},
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<svg width="200" height="200" viewBox="0 0 44 50" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<defs>
|
|
3
|
+
<clipPath id="hexClip">
|
|
4
|
+
<path d="M22.8725 0.4166C22.136 0 21.2616 0 20.5253 0.4166L1.1505 11.6694C0.4142 12.0862 0 12.8733 0 13.707V36.2584C0 37.0921 0.4602 37.8791 1.1505 38.296L20.5253 49.5487C21.2616 49.9653 22.136 49.9653 22.8725 49.5487L42.2471 38.296C42.9836 37.8791 43.3976 37.0921 43.3976 36.2584V13.707C43.3976 12.8733 42.9375 12.0862 42.2471 11.6694L22.8725 0.4166Z" />
|
|
5
|
+
</clipPath>
|
|
6
|
+
<linearGradient id="main" x1="30.33" y1="8.56" x2="14.9" y2="44.7" gradientUnits="userSpaceOnUse">
|
|
7
|
+
<stop stop-color="#3F8B3D"/>
|
|
8
|
+
<stop offset="0.64" stop-color="#3F873F"/>
|
|
9
|
+
<stop offset="0.93" stop-color="#3DA92E"/>
|
|
10
|
+
<stop offset="1" stop-color="#3DAE2B"/>
|
|
11
|
+
</linearGradient>
|
|
12
|
+
<linearGradient id="r1" x1="18.8" y1="26.8" x2="68" y2="0.4" gradientUnits="userSpaceOnUse">
|
|
13
|
+
<stop offset="0.14" stop-color="#3F873F"/>
|
|
14
|
+
<stop offset="0.4" stop-color="#52A044"/>
|
|
15
|
+
<stop offset="0.71" stop-color="#64B749"/>
|
|
16
|
+
<stop offset="0.91" stop-color="#6ABF4B"/>
|
|
17
|
+
</linearGradient>
|
|
18
|
+
<linearGradient id="r2" x1="0.25" y1="24.5" x2="44" y2="24.5" gradientUnits="userSpaceOnUse">
|
|
19
|
+
<stop offset="0.09" stop-color="#6ABF4B"/>
|
|
20
|
+
<stop offset="0.29" stop-color="#64B749"/>
|
|
21
|
+
<stop offset="0.6" stop-color="#52A044"/>
|
|
22
|
+
<stop offset="0.86" stop-color="#3F873F"/>
|
|
23
|
+
</linearGradient>
|
|
24
|
+
</defs>
|
|
25
|
+
<path fill="url(#main)" d="M22.8725 0.4166C22.136 0 21.2616 0 20.5253 0.4166L1.1505 11.6694C0.4142 12.0862 0 12.8733 0 13.707V36.2584C0 37.0921 0.4602 37.8791 1.1505 38.296L20.5253 49.5487C21.2616 49.9653 22.136 49.9653 22.8725 49.5487L42.2471 38.296C42.9836 37.8791 43.3976 37.0921 43.3976 36.2584V13.707C43.3976 12.8733 42.9375 12.0862 42.2471 11.6694L22.8725 0.4166Z" />
|
|
26
|
+
<polygon fill="url(#r1)" clip-path="url(#hexClip)" points="21.698901,-1.046618 43.20532,11.948247 21.698901,51.072715 0.152778,38.055107" />
|
|
27
|
+
<polygon fill="url(#r2)" clip-path="url(#hexClip)" points="21.698901,-1.046618 0.152778,11.948247 21.698901,51.072715 43.20532,38.055107" />
|
|
28
|
+
</svg>
|
|
@@ -191,19 +191,22 @@ export class CPUThrottlingManager extends Common.ObjectWrapper.ObjectWrapper<Eve
|
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
-
#
|
|
195
|
-
|
|
194
|
+
#activeCPUPerformanceOverride(): CPUPerformanceTier|undefined {
|
|
195
|
+
// If neither a manual override nor CPU throttling is enabled, no override is active.
|
|
196
|
+
if (this.#manualCPUPerformanceOverride === undefined && this.#cpuThrottlingRate === 1) {
|
|
197
|
+
return undefined;
|
|
198
|
+
}
|
|
199
|
+
return this.effectiveCPUPerformanceTier();
|
|
196
200
|
}
|
|
197
201
|
|
|
198
202
|
#syncCPUPerformanceTier(): void {
|
|
199
|
-
const effectiveTier = this.effectiveCPUPerformanceTier();
|
|
200
203
|
// Synchronize with Chromium backend, via CDP.
|
|
201
|
-
const activeOverride = this.#
|
|
204
|
+
const activeOverride = this.#activeCPUPerformanceOverride();
|
|
202
205
|
for (const emulationModel of this.#targetManager.models(EmulationModel)) {
|
|
203
206
|
void emulationModel.setCPUPerformanceOverride(activeOverride);
|
|
204
207
|
}
|
|
205
208
|
// Notify UI and other listeners.
|
|
206
|
-
this.dispatchEventToListeners(Events.CPU_PERFORMANCE_TIER_CHANGED,
|
|
209
|
+
this.dispatchEventToListeners(Events.CPU_PERFORMANCE_TIER_CHANGED, this.effectiveCPUPerformanceTier());
|
|
207
210
|
}
|
|
208
211
|
|
|
209
212
|
setCPUThrottlingRate(rate: number): void {
|
|
@@ -282,9 +285,9 @@ export class CPUThrottlingManager extends Common.ObjectWrapper.ObjectWrapper<Eve
|
|
|
282
285
|
}
|
|
283
286
|
|
|
284
287
|
async updateHostDefaultCPUPerformanceTier(): Promise<void> {
|
|
285
|
-
if (this.#
|
|
286
|
-
// We do not want to update the host default tier
|
|
287
|
-
// (in which case, `navigator.cpuPerformance` would return the override).
|
|
288
|
+
if (this.#activeCPUPerformanceOverride() !== undefined) {
|
|
289
|
+
// We do not want to update the host default tier if an override has already been sent
|
|
290
|
+
// to the backend (in which case, `navigator.cpuPerformance` would return the override).
|
|
288
291
|
return;
|
|
289
292
|
}
|
|
290
293
|
const target = this.#targetManager.primaryPageTarget();
|
|
@@ -314,8 +317,9 @@ export class CPUThrottlingManager extends Common.ObjectWrapper.ObjectWrapper<Eve
|
|
|
314
317
|
if (this.#hardwareConcurrency !== undefined) {
|
|
315
318
|
void emulationModel.setHardwareConcurrency(this.#hardwareConcurrency);
|
|
316
319
|
}
|
|
317
|
-
|
|
318
|
-
|
|
320
|
+
const activeOverride = this.#activeCPUPerformanceOverride();
|
|
321
|
+
if (activeOverride !== undefined) {
|
|
322
|
+
void emulationModel.setCPUPerformanceOverride(activeOverride);
|
|
319
323
|
}
|
|
320
324
|
|
|
321
325
|
// If there are any callers blocked on a getHardwareConcurrency call, let's wake them now.
|
|
@@ -319,7 +319,7 @@ export class DOMNode extends Common.ObjectWrapper.ObjectWrapper<DOMNodeEventType
|
|
|
319
319
|
|
|
320
320
|
const frameOwnerTags = new Set(['EMBED', 'IFRAME', 'OBJECT', 'FENCEDFRAME']);
|
|
321
321
|
if (payload.contentDocument) {
|
|
322
|
-
this.contentDocumentInternal = new DOMDocument(this.#domModel, payload.contentDocument);
|
|
322
|
+
this.contentDocumentInternal = new DOMDocument(this.#domModel, payload.contentDocument, payload.frameId);
|
|
323
323
|
this.contentDocumentInternal.parentNode = this;
|
|
324
324
|
this.childrenInternal = [];
|
|
325
325
|
} else if (payload.frameId && frameOwnerTags.has(payload.nodeName)) {
|
|
@@ -1139,7 +1139,7 @@ export class DOMNode extends Common.ObjectWrapper.ObjectWrapper<DOMNodeEventType
|
|
|
1139
1139
|
}
|
|
1140
1140
|
|
|
1141
1141
|
isCustomElement(): boolean {
|
|
1142
|
-
if (this.nodeType() !== NodeType.ELEMENT_NODE || this.isXMLNode()) {
|
|
1142
|
+
if (this.nodeType() !== NodeType.ELEMENT_NODE || this.isXMLNode() || Boolean(this.pseudoType())) {
|
|
1143
1143
|
return false;
|
|
1144
1144
|
}
|
|
1145
1145
|
const localName = this.localName() || this.nodeName().toLowerCase();
|
|
@@ -1391,17 +1391,27 @@ export class DOMNode extends Common.ObjectWrapper.ObjectWrapper<DOMNodeEventType
|
|
|
1391
1391
|
}
|
|
1392
1392
|
|
|
1393
1393
|
async takeSnapshot(ownerDocumentSnapshot?: DOMDocument): Promise<DOMNode> {
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1394
|
+
let snapshot: DOMNode;
|
|
1395
|
+
if (this instanceof DOMDocument) {
|
|
1396
|
+
const doc: DOMDocument = this;
|
|
1397
|
+
snapshot = new DOMDocumentSnapshot(
|
|
1398
|
+
this.domModel(),
|
|
1399
|
+
{
|
|
1400
|
+
nodeId: this.id,
|
|
1401
|
+
backendNodeId: this.backendNodeId(),
|
|
1402
|
+
nodeType: this.nodeType(),
|
|
1403
|
+
nodeName: this.nodeName(),
|
|
1404
|
+
localName: this.localName(),
|
|
1405
|
+
nodeValue: this.nodeValueInternal,
|
|
1406
|
+
documentURL: this.documentURL,
|
|
1407
|
+
baseURL: this.baseURL,
|
|
1408
|
+
} as Protocol.DOM.Node,
|
|
1409
|
+
this.frameId(),
|
|
1410
|
+
doc.securityOrigin(),
|
|
1411
|
+
);
|
|
1412
|
+
} else {
|
|
1413
|
+
snapshot = new DOMNodeSnapshot(this.domModel());
|
|
1414
|
+
}
|
|
1405
1415
|
snapshot.id = this.id;
|
|
1406
1416
|
snapshot.#backendNodeId = this.#backendNodeId;
|
|
1407
1417
|
snapshot.#frameOwnerFrameId = this.#frameOwnerFrameId;
|
|
@@ -1573,16 +1583,35 @@ export class DOMDocument extends DOMNode {
|
|
|
1573
1583
|
documentElement: DOMNode|null;
|
|
1574
1584
|
#documentURL: Platform.DevToolsPath.UrlString;
|
|
1575
1585
|
#baseURL: Platform.DevToolsPath.UrlString;
|
|
1586
|
+
#frameId: Protocol.Page.FrameId|null;
|
|
1576
1587
|
#securityOrigin: SecurityOrigin;
|
|
1577
1588
|
|
|
1578
|
-
constructor(
|
|
1589
|
+
constructor(
|
|
1590
|
+
domModel: DOMModel,
|
|
1591
|
+
payload: Protocol.DOM.Node,
|
|
1592
|
+
frameId?: Protocol.Page.FrameId|null,
|
|
1593
|
+
) {
|
|
1579
1594
|
super(domModel);
|
|
1580
1595
|
this.body = null;
|
|
1581
1596
|
this.documentElement = null;
|
|
1582
1597
|
this.init(this, false, payload);
|
|
1583
1598
|
this.#documentURL = (payload.documentURL || '') as Platform.DevToolsPath.UrlString;
|
|
1584
1599
|
this.#baseURL = (payload.baseURL || '') as Platform.DevToolsPath.UrlString;
|
|
1585
|
-
this.#
|
|
1600
|
+
this.#frameId = frameId ?? null;
|
|
1601
|
+
|
|
1602
|
+
const resourceTreeModel = this.domModel().target().model(ResourceTreeModel);
|
|
1603
|
+
const frame = this.#frameId ? resourceTreeModel?.frameForId(this.#frameId) : null;
|
|
1604
|
+
if (frame) {
|
|
1605
|
+
this.#securityOrigin = frame.securityOrigin();
|
|
1606
|
+
} else if (resourceTreeModel?.mainFrame) {
|
|
1607
|
+
// If the target has an active frame tree, a DOMDocument without a matching
|
|
1608
|
+
// frame is a detached document and must be isolated with an opaque origin.
|
|
1609
|
+
this.#securityOrigin = SecurityOrigin.createUniqueOpaque();
|
|
1610
|
+
} else {
|
|
1611
|
+
// TODO(b/567434846): Migrate synthetic unit tests to attach frames so this
|
|
1612
|
+
// fallback to parsing documentURL can be removed.
|
|
1613
|
+
this.#securityOrigin = SecurityOrigin.create(this.#documentURL);
|
|
1614
|
+
}
|
|
1586
1615
|
}
|
|
1587
1616
|
|
|
1588
1617
|
get documentURL(): Platform.DevToolsPath.UrlString {
|
|
@@ -1593,10 +1622,14 @@ export class DOMDocument extends DOMNode {
|
|
|
1593
1622
|
return this.#baseURL;
|
|
1594
1623
|
}
|
|
1595
1624
|
|
|
1625
|
+
override frameId(): Protocol.Page.FrameId|null {
|
|
1626
|
+
return this.#frameId;
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1596
1629
|
/**
|
|
1597
1630
|
* Returns the security origin of this document.
|
|
1598
1631
|
*
|
|
1599
|
-
* The security origin is
|
|
1632
|
+
* The security origin is resolved from the document's frame and is recomputed
|
|
1600
1633
|
* when the document navigates to a new URL via `setDocumentURL`.
|
|
1601
1634
|
*/
|
|
1602
1635
|
override securityOrigin(): SecurityOrigin {
|
|
@@ -1604,12 +1637,14 @@ export class DOMDocument extends DOMNode {
|
|
|
1604
1637
|
}
|
|
1605
1638
|
|
|
1606
1639
|
/**
|
|
1607
|
-
* Updates the document and base URLs, and
|
|
1640
|
+
* Updates the document and base URLs, and updates the document's security origin.
|
|
1608
1641
|
*/
|
|
1609
|
-
setDocumentURL(url: Platform.DevToolsPath.UrlString): void {
|
|
1642
|
+
setDocumentURL(url: Platform.DevToolsPath.UrlString, securityOrigin?: SecurityOrigin|null): void {
|
|
1610
1643
|
this.#documentURL = url;
|
|
1611
1644
|
this.#baseURL = url;
|
|
1612
|
-
|
|
1645
|
+
// Prefer the canonical security origin from the frame, falling back to creating
|
|
1646
|
+
// an origin from the URL as a last resort for test environments.
|
|
1647
|
+
this.#securityOrigin = securityOrigin ?? SecurityOrigin.create(url);
|
|
1613
1648
|
}
|
|
1614
1649
|
}
|
|
1615
1650
|
|
|
@@ -1695,7 +1730,7 @@ export class DOMModel extends SDKModel<EventTypes> {
|
|
|
1695
1730
|
if (node) {
|
|
1696
1731
|
const contentDocument = node.contentDocument();
|
|
1697
1732
|
if (contentDocument && contentDocument.documentURL !== frame.url) {
|
|
1698
|
-
contentDocument.setDocumentURL(frame.url);
|
|
1733
|
+
contentDocument.setDocumentURL(frame.url, frame.securityOrigin());
|
|
1699
1734
|
this.dispatchEventToListeners(Events.DocumentURLChanged, contentDocument);
|
|
1700
1735
|
}
|
|
1701
1736
|
}
|
|
@@ -1879,7 +1914,8 @@ export class DOMModel extends SDKModel<EventTypes> {
|
|
|
1879
1914
|
this.idToDOMNode = new Map();
|
|
1880
1915
|
this.frameIdToOwnerNode = new Map();
|
|
1881
1916
|
if (payload && 'nodeId' in payload) {
|
|
1882
|
-
|
|
1917
|
+
const mainFrameId = this.target().model(ResourceTreeModel)?.mainFrame?.id;
|
|
1918
|
+
this.#document = new DOMDocument(this, payload, mainFrameId);
|
|
1883
1919
|
} else {
|
|
1884
1920
|
this.#document = null;
|
|
1885
1921
|
}
|
|
@@ -2543,6 +2579,22 @@ export class DOMNodeSnapshot extends DOMNode {
|
|
|
2543
2579
|
}
|
|
2544
2580
|
|
|
2545
2581
|
export class DOMDocumentSnapshot extends DOMDocument {
|
|
2582
|
+
readonly #snapshotSecurityOrigin: SecurityOrigin;
|
|
2583
|
+
|
|
2584
|
+
constructor(
|
|
2585
|
+
domModel: DOMModel,
|
|
2586
|
+
payload: Protocol.DOM.Node,
|
|
2587
|
+
frameId: Protocol.Page.FrameId|null|undefined,
|
|
2588
|
+
securityOrigin: SecurityOrigin,
|
|
2589
|
+
) {
|
|
2590
|
+
super(domModel, payload, frameId);
|
|
2591
|
+
this.#snapshotSecurityOrigin = securityOrigin;
|
|
2592
|
+
}
|
|
2593
|
+
|
|
2594
|
+
override securityOrigin(): SecurityOrigin {
|
|
2595
|
+
return this.#snapshotSecurityOrigin;
|
|
2596
|
+
}
|
|
2597
|
+
|
|
2546
2598
|
override init(
|
|
2547
2599
|
_doc: DOMDocument|null, _isInShadowTree: boolean, _payload: Protocol.DOM.Node,
|
|
2548
2600
|
_retainedNodes?: Set<Protocol.DOM.BackendNodeId>|undefined): void {
|
|
@@ -1480,10 +1480,6 @@ export class Scope implements ScopeChainEntry {
|
|
|
1480
1480
|
return undefined;
|
|
1481
1481
|
}
|
|
1482
1482
|
|
|
1483
|
-
empty(): boolean {
|
|
1484
|
-
return Boolean(this.#payload.empty);
|
|
1485
|
-
}
|
|
1486
|
-
|
|
1487
1483
|
extraProperties(): RemoteObjectProperty[] {
|
|
1488
1484
|
if (this !== this.#callFrame.localScope() || this.#callFrame.script.isWasm()) {
|
|
1489
1485
|
return [];
|
|
@@ -179,6 +179,7 @@ export class NetworkRequest extends Common.ObjectWrapper.ObjectWrapper<EventType
|
|
|
179
179
|
#blockedReason: Protocol.Network.BlockedReason|undefined = undefined;
|
|
180
180
|
#renderBlockingBehavior?: Protocol.Network.RenderBlockingBehavior;
|
|
181
181
|
#initiatorSecurityOrigin?: SecurityOrigin;
|
|
182
|
+
#requestURLSecurityOrigin?: SecurityOrigin;
|
|
182
183
|
#corsErrorStatus: Protocol.Network.CorsErrorStatus|undefined = undefined;
|
|
183
184
|
statusCode = 0;
|
|
184
185
|
statusText = '';
|
|
@@ -193,6 +194,7 @@ export class NetworkRequest extends Common.ObjectWrapper.ObjectWrapper<EventType
|
|
|
193
194
|
#resourceType: Common.ResourceType.ResourceType = Common.ResourceType.resourceTypes.Other;
|
|
194
195
|
#contentData: Promise<TextUtils.ContentData.ContentDataOrError>|null = null;
|
|
195
196
|
#streamingContentData: Promise<TextUtils.StreamingContentData.StreamingContentDataOrError>|null = null;
|
|
197
|
+
#resolvedStreamingContentData: TextUtils.StreamingContentData.StreamingContentData|null = null;
|
|
196
198
|
readonly #frames: WebSocketFrame[] = [];
|
|
197
199
|
#responseHeaderValues: Record<string, string|undefined> = {};
|
|
198
200
|
#responseHeadersText = '';
|
|
@@ -402,10 +404,17 @@ export class NetworkRequest extends Common.ObjectWrapper.ObjectWrapper<EventType
|
|
|
402
404
|
* (`imported-har://${authority}`) to ensure recorded network traffic never collides with
|
|
403
405
|
* live web origins.
|
|
404
406
|
*
|
|
407
|
+
* The result is cached, so repeated calls return the same instance until the URL or the
|
|
408
|
+
* imported HAR flag changes. This keeps opaque origins (such as `data:` URLs) same-origin
|
|
409
|
+
* with themselves.
|
|
410
|
+
*
|
|
405
411
|
* @see {@link initiatorSecurityOrigin} to obtain the origin of the document that initiated the request.
|
|
406
412
|
*/
|
|
407
413
|
requestURLSecurityOrigin(): SecurityOrigin {
|
|
408
|
-
|
|
414
|
+
if (!this.#requestURLSecurityOrigin) {
|
|
415
|
+
this.#requestURLSecurityOrigin = this.#resolveSecurityOrigin(this.#url);
|
|
416
|
+
}
|
|
417
|
+
return this.#requestURLSecurityOrigin;
|
|
409
418
|
}
|
|
410
419
|
|
|
411
420
|
/**
|
|
@@ -422,6 +431,9 @@ export class NetworkRequest extends Common.ObjectWrapper.ObjectWrapper<EventType
|
|
|
422
431
|
* For imported HAR files, the origin is mapped to an isolated virtual domain
|
|
423
432
|
* (`imported-har://${authority}`) matching the imported initiating document.
|
|
424
433
|
*
|
|
434
|
+
* The result is cached, so repeated calls return the same instance until the imported HAR
|
|
435
|
+
* flag changes. This keeps opaque origins same-origin with themselves.
|
|
436
|
+
*
|
|
425
437
|
* @see {@link requestURLSecurityOrigin} to obtain the origin of the target resource URL being requested.
|
|
426
438
|
*/
|
|
427
439
|
initiatorSecurityOrigin(): SecurityOrigin {
|
|
@@ -462,6 +474,7 @@ export class NetworkRequest extends Common.ObjectWrapper.ObjectWrapper<EventType
|
|
|
462
474
|
this.#parsedQueryParameters = undefined;
|
|
463
475
|
this.#name = undefined;
|
|
464
476
|
this.#path = undefined;
|
|
477
|
+
this.#requestURLSecurityOrigin = undefined;
|
|
465
478
|
}
|
|
466
479
|
|
|
467
480
|
get documentURL(): Platform.DevToolsPath.UrlString {
|
|
@@ -1207,7 +1220,12 @@ export class NetworkRequest extends Common.ObjectWrapper.ObjectWrapper<EventType
|
|
|
1207
1220
|
}
|
|
1208
1221
|
|
|
1209
1222
|
setIsImportedHar(isImportedHar: boolean): void {
|
|
1223
|
+
if (this.#isImportedHar === isImportedHar) {
|
|
1224
|
+
return;
|
|
1225
|
+
}
|
|
1210
1226
|
this.#isImportedHar = isImportedHar;
|
|
1227
|
+
this.#requestURLSecurityOrigin = undefined;
|
|
1228
|
+
this.#initiatorSecurityOrigin = undefined;
|
|
1211
1229
|
}
|
|
1212
1230
|
|
|
1213
1231
|
setEarlyHintsHeaders(headers: NameValue[]): void {
|
|
@@ -1488,9 +1506,11 @@ export class NetworkRequest extends Common.ObjectWrapper.ObjectWrapper<EventType
|
|
|
1488
1506
|
}
|
|
1489
1507
|
// Note that this is save: "streamResponseBody()" always creates base64-based ContentData and
|
|
1490
1508
|
// for "contentData()" we'll never call "addChunk".
|
|
1491
|
-
|
|
1509
|
+
const streamingContentData = TextUtils.StreamingContentData.StreamingContentData.from(
|
|
1492
1510
|
contentData,
|
|
1493
1511
|
);
|
|
1512
|
+
this.#resolvedStreamingContentData = streamingContentData;
|
|
1513
|
+
return streamingContentData;
|
|
1494
1514
|
});
|
|
1495
1515
|
|
|
1496
1516
|
return this.#streamingContentData;
|
|
@@ -1510,6 +1530,18 @@ export class NetworkRequest extends Common.ObjectWrapper.ObjectWrapper<EventType
|
|
|
1510
1530
|
isRegex: boolean,
|
|
1511
1531
|
): Promise<TextUtils.ContentProvider.SearchMatch[]> {
|
|
1512
1532
|
if (!this.#contentDataProvider) {
|
|
1533
|
+
const cachedContentData = this.finished && !this.failed ?
|
|
1534
|
+
(await this.#contentData ?? this.#resolvedStreamingContentData?.content()) :
|
|
1535
|
+
undefined;
|
|
1536
|
+
if (cachedContentData && !TextUtils.ContentData.ContentData.isError(cachedContentData) &&
|
|
1537
|
+
cachedContentData.isTextContent) {
|
|
1538
|
+
return TextUtils.TextUtils.performSearchInContentData(
|
|
1539
|
+
cachedContentData,
|
|
1540
|
+
query,
|
|
1541
|
+
caseSensitive,
|
|
1542
|
+
isRegex,
|
|
1543
|
+
);
|
|
1544
|
+
}
|
|
1513
1545
|
return await NetworkManager.searchInRequest(
|
|
1514
1546
|
this,
|
|
1515
1547
|
query,
|
|
@@ -1940,11 +1972,15 @@ export class NetworkRequest extends Common.ObjectWrapper.ObjectWrapper<EventType
|
|
|
1940
1972
|
}
|
|
1941
1973
|
this.endTime = timestamp;
|
|
1942
1974
|
if (data) {
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1975
|
+
if (this.#resolvedStreamingContentData) {
|
|
1976
|
+
this.#resolvedStreamingContentData.addChunk(data);
|
|
1977
|
+
} else {
|
|
1978
|
+
void this.#streamingContentData?.then(contentData => {
|
|
1979
|
+
if (!TextUtils.StreamingContentData.isError(contentData)) {
|
|
1980
|
+
contentData.addChunk(data);
|
|
1981
|
+
}
|
|
1982
|
+
});
|
|
1983
|
+
}
|
|
1948
1984
|
}
|
|
1949
1985
|
}
|
|
1950
1986
|
|
|
@@ -343,24 +343,25 @@ export class PageResourceLoader extends Common.ObjectWrapper.ObjectWrapper<Event
|
|
|
343
343
|
// directive is present. A null/error response keeps the guard armed so that a
|
|
344
344
|
// detached-frame or protocol-error path cannot fall through to loadFromHostBindings.
|
|
345
345
|
let mustEnforceCSP = isHttp;
|
|
346
|
-
|
|
347
|
-
|
|
346
|
+
let frameTarget: Target|null = initiator.target;
|
|
347
|
+
while (frameTarget && !frameTarget.model(ResourceTreeModel)) {
|
|
348
|
+
frameTarget = frameTarget.parentTarget();
|
|
349
|
+
}
|
|
350
|
+
const frameId = initiator.frameId ?? frameTarget?.model(ResourceTreeModel)?.mainFrame?.id ?? null;
|
|
351
|
+
if (isHttp && frameTarget) {
|
|
352
|
+
const networkManager = frameTarget.model(NetworkManager);
|
|
348
353
|
if (networkManager) {
|
|
349
|
-
|
|
350
|
-
if (
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
if (status) {
|
|
354
|
-
const csps = status.csp ?? [];
|
|
355
|
-
mustEnforceCSP = csps.some(csp => csp.effectiveDirectives.includes('connect-src') ||
|
|
356
|
-
csp.effectiveDirectives.includes('default-src'));
|
|
354
|
+
const status = await networkManager.getSecurityIsolationStatus(frameId);
|
|
355
|
+
if (status?.csp) {
|
|
356
|
+
mustEnforceCSP = status.csp.some(csp => csp.effectiveDirectives.includes('connect-src') ||
|
|
357
|
+
csp.effectiveDirectives.includes('default-src'));
|
|
357
358
|
}
|
|
358
359
|
}
|
|
359
360
|
}
|
|
360
361
|
|
|
361
362
|
try {
|
|
362
363
|
Host.userMetrics.developerResourceLoaded(Host.UserMetrics.DeveloperResourceLoaded.LOAD_THROUGH_PAGE_VIA_TARGET);
|
|
363
|
-
const result = await this.loadFromTarget(initiator.target,
|
|
364
|
+
const result = await this.loadFromTarget(frameTarget ?? initiator.target, frameId, url, isBinary);
|
|
364
365
|
return result;
|
|
365
366
|
} catch (e) {
|
|
366
367
|
if (e instanceof Error) {
|
|
@@ -12,7 +12,7 @@ import {scopeTreeForScript} from './ScopeTreeCache.js';
|
|
|
12
12
|
import type {Script} from './Script.js';
|
|
13
13
|
import {buildOriginalScopes, decodePastaRanges, type NamedFunctionRange} from './SourceMapFunctionRanges.js';
|
|
14
14
|
import {decodeRangeMappings} from './SourceMapRangeMappings.js';
|
|
15
|
-
import {scriptRelativePosition, SourceMapScopesInfo
|
|
15
|
+
import {type RawFrameTranslation, scriptRelativePosition, SourceMapScopesInfo} from './SourceMapScopesInfo.js';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Type of the base source map JSON object, which contains the sources and the mappings at the very least, plus
|
|
@@ -33,7 +33,8 @@ export interface SourceMapV3Object {
|
|
|
33
33
|
|
|
34
34
|
names?: string[];
|
|
35
35
|
ignoreList?: number[];
|
|
36
|
-
scopes?: string
|
|
36
|
+
scopes?: Array<string|null>;
|
|
37
|
+
ranges?: string[];
|
|
37
38
|
rangeMappings?: string;
|
|
38
39
|
debugId?: string;
|
|
39
40
|
x_google_linecount?: number;
|
|
@@ -609,11 +610,11 @@ export class SourceMap {
|
|
|
609
610
|
if (!this.#scopesInfo) {
|
|
610
611
|
this.#scopesInfo = new SourceMapScopesInfo(this, {scopes: [], ranges: []});
|
|
611
612
|
}
|
|
612
|
-
if (map.scopes) {
|
|
613
|
+
if (map.scopes || map.ranges) {
|
|
613
614
|
const {scopes, ranges} = ScopesCodec.decode(
|
|
614
615
|
map as ScopesCodec.SourceMapJson,
|
|
615
616
|
{mode: ScopesCodec.DecodeMode.LAX, generatedOffset: {line: baseLineNumber, column: baseColumnNumber}});
|
|
616
|
-
this.#scopesInfo.addOriginalScopes(scopes);
|
|
617
|
+
this.#scopesInfo.addOriginalScopes(scopes.length ? scopes : new Array(map.sources.length).fill(null));
|
|
617
618
|
this.#scopesInfo.addGeneratedRanges(ranges);
|
|
618
619
|
} else if (map.x_com_bloomberg_sourcesFunctionMappings) {
|
|
619
620
|
const originalScopes = this.parseBloombergScopes(map);
|
|
@@ -662,7 +663,7 @@ export class SourceMap {
|
|
|
662
663
|
}
|
|
663
664
|
}
|
|
664
665
|
|
|
665
|
-
private parseBloombergScopes(map: SourceMapV3Object): Array<ScopesCodec.OriginalScope|null> {
|
|
666
|
+
private parseBloombergScopes(map: SourceMapV3Object): Array<ScopesCodec.OriginalScope[]|null> {
|
|
666
667
|
const scopeList = map.x_com_bloomberg_sourcesFunctionMappings;
|
|
667
668
|
if (!scopeList) {
|
|
668
669
|
throw new Error('Cant decode pasta scopes without x_com_bloomberg_sourcesFunctionMappings field');
|
|
@@ -851,7 +852,8 @@ export class SourceMap {
|
|
|
851
852
|
}
|
|
852
853
|
|
|
853
854
|
const {line, column} = scriptRelativePosition(location);
|
|
854
|
-
return this.#scopesInfo.resolveMappedVariablesAtPosition(line, column, ignoreInnerBlockScopes
|
|
855
|
+
return this.#scopesInfo.resolveMappedVariablesAtPosition(line, column, ignoreInnerBlockScopes,
|
|
856
|
+
location.inlineFrameIndex);
|
|
855
857
|
}
|
|
856
858
|
|
|
857
859
|
findOriginalFunctionName(position: ScopesCodec.Position): string|null {
|
|
@@ -865,19 +867,10 @@ export class SourceMap {
|
|
|
865
867
|
return this.#scopesInfo?.findOriginalFunctionScope(position) ?? null;
|
|
866
868
|
}
|
|
867
869
|
|
|
868
|
-
|
|
870
|
+
/** See {@link SourceMapScopesInfo.translateRawFrame}. `null` if no scopes information is available. */
|
|
871
|
+
translateRawFrame(generatedLine: number, generatedColumn: number): RawFrameTranslation|null {
|
|
869
872
|
this.#ensureSourceMapProcessed();
|
|
870
|
-
return this.#scopesInfo?.
|
|
871
|
-
}
|
|
872
|
-
|
|
873
|
-
hasInlinedFrames(generatedLine: number, generatedColumn: number): boolean {
|
|
874
|
-
this.#ensureSourceMapProcessed();
|
|
875
|
-
return this.#scopesInfo?.hasInlinedFrames(generatedLine, generatedColumn) ?? false;
|
|
876
|
-
}
|
|
877
|
-
|
|
878
|
-
translateCallSite(generatedLine: number, generatedColumn: number): TranslatedFrame[] {
|
|
879
|
-
this.#ensureSourceMapProcessed();
|
|
880
|
-
return this.#scopesInfo?.translateCallSite(generatedLine, generatedColumn) ?? [];
|
|
873
|
+
return this.#scopesInfo?.translateRawFrame(generatedLine, generatedColumn) ?? null;
|
|
881
874
|
}
|
|
882
875
|
}
|
|
883
876
|
|