chrome-devtools-frontend 1.0.973645 → 1.0.975056
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/config/gni/devtools_grd_files.gni +3 -0
- package/config/gni/devtools_image_files.gni +2 -0
- package/front_end/Images/src/triangle-collapsed.svg +1 -0
- package/front_end/Images/src/triangle-expanded.svg +1 -0
- package/front_end/core/common/ParsedURL.ts +9 -9
- package/front_end/core/i18n/locales/af.json +74 -29
- package/front_end/core/i18n/locales/am.json +74 -29
- package/front_end/core/i18n/locales/ar.json +74 -29
- package/front_end/core/i18n/locales/as.json +74 -29
- package/front_end/core/i18n/locales/az.json +74 -29
- package/front_end/core/i18n/locales/be.json +74 -29
- package/front_end/core/i18n/locales/bg.json +74 -29
- package/front_end/core/i18n/locales/bn.json +74 -29
- package/front_end/core/i18n/locales/bs.json +75 -30
- package/front_end/core/i18n/locales/ca.json +74 -29
- package/front_end/core/i18n/locales/cs.json +74 -29
- package/front_end/core/i18n/locales/cy.json +74 -29
- package/front_end/core/i18n/locales/da.json +74 -29
- package/front_end/core/i18n/locales/de.json +76 -31
- package/front_end/core/i18n/locales/el.json +76 -31
- package/front_end/core/i18n/locales/en-GB.json +74 -29
- package/front_end/core/i18n/locales/es-419.json +74 -29
- package/front_end/core/i18n/locales/es.json +74 -29
- package/front_end/core/i18n/locales/et.json +74 -29
- package/front_end/core/i18n/locales/eu.json +76 -31
- package/front_end/core/i18n/locales/fa.json +74 -29
- package/front_end/core/i18n/locales/fi.json +75 -30
- package/front_end/core/i18n/locales/fil.json +74 -29
- package/front_end/core/i18n/locales/fr-CA.json +74 -29
- package/front_end/core/i18n/locales/fr.json +74 -29
- package/front_end/core/i18n/locales/gl.json +81 -36
- package/front_end/core/i18n/locales/gu.json +74 -29
- package/front_end/core/i18n/locales/he.json +74 -29
- package/front_end/core/i18n/locales/hi.json +74 -29
- package/front_end/core/i18n/locales/hr.json +74 -29
- package/front_end/core/i18n/locales/hu.json +74 -29
- package/front_end/core/i18n/locales/hy.json +74 -29
- package/front_end/core/i18n/locales/id.json +74 -29
- package/front_end/core/i18n/locales/is.json +74 -29
- package/front_end/core/i18n/locales/it.json +74 -29
- package/front_end/core/i18n/locales/ja.json +74 -29
- package/front_end/core/i18n/locales/ka.json +74 -29
- package/front_end/core/i18n/locales/kk.json +74 -29
- package/front_end/core/i18n/locales/km.json +74 -29
- package/front_end/core/i18n/locales/kn.json +74 -29
- package/front_end/core/i18n/locales/ko.json +74 -29
- package/front_end/core/i18n/locales/ky.json +74 -29
- package/front_end/core/i18n/locales/lo.json +74 -29
- package/front_end/core/i18n/locales/lt.json +74 -29
- package/front_end/core/i18n/locales/lv.json +74 -29
- package/front_end/core/i18n/locales/mk.json +75 -30
- package/front_end/core/i18n/locales/ml.json +74 -29
- package/front_end/core/i18n/locales/mn.json +74 -29
- package/front_end/core/i18n/locales/mr.json +74 -29
- package/front_end/core/i18n/locales/ms.json +74 -29
- package/front_end/core/i18n/locales/my.json +74 -29
- package/front_end/core/i18n/locales/ne.json +74 -29
- package/front_end/core/i18n/locales/nl.json +74 -29
- package/front_end/core/i18n/locales/no.json +74 -29
- package/front_end/core/i18n/locales/or.json +75 -30
- package/front_end/core/i18n/locales/pa.json +74 -29
- package/front_end/core/i18n/locales/pl.json +74 -29
- package/front_end/core/i18n/locales/pt-PT.json +74 -29
- package/front_end/core/i18n/locales/pt.json +74 -29
- package/front_end/core/i18n/locales/ro.json +74 -29
- package/front_end/core/i18n/locales/ru.json +78 -33
- package/front_end/core/i18n/locales/si.json +74 -29
- package/front_end/core/i18n/locales/sk.json +74 -29
- package/front_end/core/i18n/locales/sl.json +74 -29
- package/front_end/core/i18n/locales/sq.json +74 -29
- package/front_end/core/i18n/locales/sr-Latn.json +74 -29
- package/front_end/core/i18n/locales/sr.json +74 -29
- package/front_end/core/i18n/locales/sv.json +74 -29
- package/front_end/core/i18n/locales/sw.json +74 -29
- package/front_end/core/i18n/locales/ta.json +74 -29
- package/front_end/core/i18n/locales/te.json +75 -30
- package/front_end/core/i18n/locales/th.json +74 -29
- package/front_end/core/i18n/locales/tr.json +74 -29
- package/front_end/core/i18n/locales/uk.json +74 -29
- package/front_end/core/i18n/locales/ur.json +74 -29
- package/front_end/core/i18n/locales/uz.json +74 -29
- package/front_end/core/i18n/locales/vi.json +74 -29
- package/front_end/core/i18n/locales/zh-HK.json +74 -29
- package/front_end/core/i18n/locales/zh-TW.json +74 -29
- package/front_end/core/i18n/locales/zh.json +74 -29
- package/front_end/core/i18n/locales/zu.json +74 -29
- package/front_end/core/sdk/DOMModel.ts +7 -7
- package/front_end/core/sdk/ResourceTreeModel.ts +1 -1
- package/front_end/core/sdk/SourceMap.ts +45 -38
- package/front_end/core/sdk/SourceMapManager.ts +2 -2
- package/front_end/core/sdk/Target.ts +5 -4
- package/front_end/entrypoints/formatter_worker/FormatterWorker.ts +3 -0
- package/front_end/entrypoints/formatter_worker/Substitute.ts +536 -0
- package/front_end/entrypoints/formatter_worker/formatter_worker.ts +2 -0
- package/front_end/entrypoints/node_app/NodeMain.ts +2 -1
- package/front_end/generated/InspectorBackendCommands.js +11 -9
- package/front_end/generated/protocol-mapping.d.ts +13 -0
- package/front_end/generated/protocol-proxy-api.d.ts +15 -0
- package/front_end/generated/protocol.ts +65 -9
- package/front_end/models/bindings/CompilerScriptMapping.ts +3 -2
- package/front_end/models/bindings/SASSSourceMapping.ts +1 -1
- package/front_end/models/formatter/SourceFormatter.ts +1 -1
- package/front_end/models/issues_manager/IssuesManager.ts +6 -0
- package/front_end/models/javascript_metadata/NativeFunctions.js +87 -19
- package/front_end/models/text_utils/StaticContentProvider.ts +4 -4
- package/front_end/models/workspace/UISourceCode.ts +8 -1
- package/front_end/panels/application/AppManifestView.ts +10 -4
- package/front_end/panels/application/DOMStorageItemsView.ts +2 -1
- package/front_end/panels/application/InterestGroupTreeElement.ts +3 -0
- package/front_end/panels/application/components/InterestGroupAccessGrid.ts +11 -0
- package/front_end/panels/console/ConsolePrompt.ts +9 -4
- package/front_end/panels/console/ErrorStackParser.ts +5 -1
- package/front_end/panels/elements/StylesSidebarPane.ts +2 -1
- package/front_end/panels/network/BinaryResourceView.ts +4 -1
- package/front_end/panels/network/RequestTimingView.ts +12 -2
- package/front_end/panels/network/ResourceWebSocketFrameView.ts +3 -2
- package/front_end/panels/sources/SourcesView.ts +51 -0
- package/front_end/panels/timeline/timelineStatusDialog.css +1 -0
- package/front_end/third_party/acorn/estree-legacy.d.ts +1 -0
- package/front_end/third_party/puppeteer/package/README.md +15 -22
- package/front_end/third_party/puppeteer/package/cjs-entry-core.js +1 -1
- package/front_end/third_party/puppeteer/package/cjs-entry.js +1 -1
- package/front_end/third_party/puppeteer/package/install.js +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.js +46 -13
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/BrowserConnector.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/BrowserConnector.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/BrowserConnector.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.d.ts +3 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.js +11 -7
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Connection.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConnectionTransport.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConnectionTransport.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Coverage.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.js +3 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DOMWorld.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.js +336 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/DeviceDescriptors.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.js +4 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.js +2 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ExecutionContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.d.ts +9 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.js +11 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/FrameManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPResponse.d.ts +5 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPResponse.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPResponse.js +7 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/HTTPResponse.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/JSHandle.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Puppeteer.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/WebWorker.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/WebWorker.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/fetch.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/fetch.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/helper.d.ts +3 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/helper.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/helper.js +13 -6
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/helper.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/initialize-node.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/initialize-node.js +16 -5
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/initialize-node.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserRunner.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserRunner.js +25 -4
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/BrowserRunner.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Launcher.d.ts +5 -4
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Launcher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Launcher.js +35 -21
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Launcher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Puppeteer.d.ts +5 -5
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Puppeteer.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Puppeteer.js +3 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/Puppeteer.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/install.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/install.js +12 -6
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/node/install.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Browser.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Browser.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Browser.js +46 -13
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Browser.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Connection.d.ts +3 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Connection.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Connection.js +11 -7
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Connection.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConnectionTransport.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConnectionTransport.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Coverage.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Coverage.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/DOMWorld.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/DOMWorld.js +3 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/DOMWorld.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/DeviceDescriptors.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/DeviceDescriptors.js +336 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/DeviceDescriptors.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Errors.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Errors.js +4 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Errors.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/EventEmitter.js +2 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/EventEmitter.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ExecutionContext.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ExecutionContext.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/FrameManager.d.ts +9 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/FrameManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/FrameManager.js +11 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/FrameManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/HTTPResponse.d.ts +5 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/HTTPResponse.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/HTTPResponse.js +7 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/HTTPResponse.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/JSHandle.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Page.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Puppeteer.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/WebWorker.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/WebWorker.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/fetch.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/fetch.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/helper.d.ts +3 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/helper.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/helper.js +13 -6
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/helper.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/initialize-node.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/initialize-node.js +16 -2
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/initialize-node.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserRunner.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserRunner.js +25 -4
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/BrowserRunner.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Launcher.d.ts +5 -4
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Launcher.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Launcher.js +35 -21
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Launcher.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Puppeteer.d.ts +5 -5
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Puppeteer.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Puppeteer.js +3 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/Puppeteer.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/install.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/install.js +12 -6
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/node/install.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/types.d.ts +32 -18
- package/front_end/third_party/puppeteer/package/package.json +36 -35
- package/front_end/ui/components/text_editor/config.ts +17 -1
- package/front_end/ui/components/text_editor/cursor_tooltip.ts +2 -1
- package/front_end/ui/components/text_editor/javascript.ts +10 -3
- package/front_end/ui/components/text_prompt/TextPrompt.ts +9 -8
- package/front_end/ui/components/text_prompt/textPrompt.css +1 -6
- package/front_end/ui/legacy/TabbedPane.ts +3 -0
- package/front_end/ui/legacy/Toolbar.ts +25 -13
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +17 -3
- package/front_end/ui/legacy/components/source_frame/BinaryResourceViewFactory.ts +8 -8
- package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +1 -1
- package/package.json +1 -1
- package/scripts/build/assert_third_party_readmes.py +1 -1
@@ -0,0 +1,536 @@
|
|
1
|
+
// Copyright 2022 The Chromium Authors. All rights reserved.
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
3
|
+
// found in the LICENSE file.
|
4
|
+
|
5
|
+
import * as Acorn from '../../third_party/acorn/acorn.js';
|
6
|
+
|
7
|
+
import {ECMA_VERSION} from './AcornTokenizer.js';
|
8
|
+
|
9
|
+
export interface Replacement {
|
10
|
+
from: string;
|
11
|
+
to: string;
|
12
|
+
offset: number;
|
13
|
+
isShorthandAssignmentProperty: boolean;
|
14
|
+
}
|
15
|
+
|
16
|
+
// Given an |expression| and a mapping from names to new names, the |computeSubstitution|
|
17
|
+
// function returns a list of replacements sorted by the offset. The function throws if
|
18
|
+
// it cannot parse the expression or the substitution is impossible to perform (for example
|
19
|
+
// if the substitution target is 'this' within a function, it would become bound there).
|
20
|
+
export function computeSubstitution(expression: string, nameMap: Map<string, string>): Replacement[] {
|
21
|
+
// Parse the expression and find variables and scopes.
|
22
|
+
const root = Acorn.parse(expression, {ecmaVersion: ECMA_VERSION, allowAwaitOutsideFunction: true, ranges: false}) as
|
23
|
+
Acorn.ESTree.Node;
|
24
|
+
const scopeVariables = new ScopeVariableAnalysis();
|
25
|
+
scopeVariables.processNode(root);
|
26
|
+
const freeVariables = scopeVariables.getFreeVariables();
|
27
|
+
const result: Replacement[] = [];
|
28
|
+
|
29
|
+
// Prepare the machinery for generating fresh names (to avoid variable captures).
|
30
|
+
const allNames = scopeVariables.getAllNames();
|
31
|
+
for (const rename of nameMap.values()) {
|
32
|
+
allNames.add(rename);
|
33
|
+
}
|
34
|
+
function getNewName(base: string): string {
|
35
|
+
let i = 1;
|
36
|
+
while (allNames.has(`${base}_${i}`)) {
|
37
|
+
i++;
|
38
|
+
}
|
39
|
+
const newName = `${base}_${i}`;
|
40
|
+
allNames.add(newName);
|
41
|
+
return newName;
|
42
|
+
}
|
43
|
+
|
44
|
+
// Perform the substitutions.
|
45
|
+
for (const [name, rename] of nameMap.entries()) {
|
46
|
+
const defUse = freeVariables.get(name);
|
47
|
+
if (!defUse) {
|
48
|
+
continue;
|
49
|
+
}
|
50
|
+
|
51
|
+
const binders = [];
|
52
|
+
for (const use of defUse) {
|
53
|
+
result.push({
|
54
|
+
from: name,
|
55
|
+
to: rename,
|
56
|
+
offset: use.offset,
|
57
|
+
isShorthandAssignmentProperty: use.isShorthandAssignmentProperty,
|
58
|
+
});
|
59
|
+
binders.push(...use.scope.findBinders(rename));
|
60
|
+
}
|
61
|
+
// If there is a capturing binder, rename the bound variable.
|
62
|
+
for (const binder of binders) {
|
63
|
+
if (binder.definitionKind === DefinitionKind.Fixed) {
|
64
|
+
// If the identifier is bound to a fixed name, such as 'this',
|
65
|
+
// then refuse to do the substitution.
|
66
|
+
throw new Error(`Cannot avoid capture of '${rename}'`);
|
67
|
+
}
|
68
|
+
const newName = getNewName(rename);
|
69
|
+
for (const use of binder.uses) {
|
70
|
+
result.push({
|
71
|
+
from: rename,
|
72
|
+
to: newName,
|
73
|
+
offset: use.offset,
|
74
|
+
isShorthandAssignmentProperty: use.isShorthandAssignmentProperty,
|
75
|
+
});
|
76
|
+
}
|
77
|
+
}
|
78
|
+
}
|
79
|
+
result.sort((l, r) => l.offset - r.offset);
|
80
|
+
return result;
|
81
|
+
}
|
82
|
+
|
83
|
+
export function applySubstitution(expression: string, replacements: Replacement[]): string {
|
84
|
+
const accumulator = [];
|
85
|
+
let last = 0;
|
86
|
+
for (const r of replacements) {
|
87
|
+
accumulator.push(expression.slice(last, r.offset));
|
88
|
+
let replacement = r.to;
|
89
|
+
if (r.isShorthandAssignmentProperty) {
|
90
|
+
// Let us expand the shorthand to full assignment.
|
91
|
+
replacement = `${r.from}: ${r.to}`;
|
92
|
+
}
|
93
|
+
accumulator.push(replacement);
|
94
|
+
last = r.offset + r.from.length;
|
95
|
+
}
|
96
|
+
accumulator.push(expression.slice(last));
|
97
|
+
return accumulator.join('');
|
98
|
+
}
|
99
|
+
|
100
|
+
interface Use {
|
101
|
+
offset: number;
|
102
|
+
scope: Scope;
|
103
|
+
isShorthandAssignmentProperty: boolean;
|
104
|
+
}
|
105
|
+
|
106
|
+
const enum DefinitionKind {
|
107
|
+
None = 0,
|
108
|
+
Let = 1,
|
109
|
+
Var = 2,
|
110
|
+
Fixed = 3,
|
111
|
+
}
|
112
|
+
|
113
|
+
interface VariableUses {
|
114
|
+
definitionKind: DefinitionKind;
|
115
|
+
uses: Use[];
|
116
|
+
}
|
117
|
+
|
118
|
+
class Scope {
|
119
|
+
readonly variables = new Map<string, VariableUses>();
|
120
|
+
readonly parent: Scope|null;
|
121
|
+
|
122
|
+
constructor(parent: Scope|null) {
|
123
|
+
this.parent = parent;
|
124
|
+
}
|
125
|
+
|
126
|
+
addVariable(name: string, offset: number, definitionKind: DefinitionKind, isShorthandAssignmentProperty: boolean):
|
127
|
+
void {
|
128
|
+
const variable = this.variables.get(name);
|
129
|
+
const use = {offset, scope: this, isShorthandAssignmentProperty};
|
130
|
+
if (!variable) {
|
131
|
+
this.variables.set(name, {definitionKind, uses: [use]});
|
132
|
+
return;
|
133
|
+
}
|
134
|
+
if (variable.definitionKind === DefinitionKind.None) {
|
135
|
+
variable.definitionKind = definitionKind;
|
136
|
+
}
|
137
|
+
variable.uses.push(use);
|
138
|
+
}
|
139
|
+
|
140
|
+
findBinders(name: string): VariableUses[] {
|
141
|
+
const result = [];
|
142
|
+
let scope: Scope|null = this;
|
143
|
+
while (scope !== null) {
|
144
|
+
const defUse = scope.variables.get(name);
|
145
|
+
if (defUse && defUse.definitionKind !== DefinitionKind.None) {
|
146
|
+
result.push(defUse);
|
147
|
+
}
|
148
|
+
scope = scope.parent;
|
149
|
+
}
|
150
|
+
return result;
|
151
|
+
}
|
152
|
+
|
153
|
+
#mergeChildDefUses(name: string, defUses: VariableUses): void {
|
154
|
+
const variable = this.variables.get(name);
|
155
|
+
if (!variable) {
|
156
|
+
this.variables.set(name, defUses);
|
157
|
+
return;
|
158
|
+
}
|
159
|
+
variable.uses.push(...defUses.uses);
|
160
|
+
if (defUses.definitionKind === DefinitionKind.Var) {
|
161
|
+
console.assert(variable.definitionKind !== DefinitionKind.Let);
|
162
|
+
if (variable.definitionKind === DefinitionKind.None) {
|
163
|
+
variable.definitionKind = defUses.definitionKind;
|
164
|
+
}
|
165
|
+
} else {
|
166
|
+
console.assert(defUses.definitionKind === DefinitionKind.None);
|
167
|
+
}
|
168
|
+
}
|
169
|
+
|
170
|
+
finalizeToParent(isFunctionScope: boolean): void {
|
171
|
+
if (!this.parent) {
|
172
|
+
console.error('Internal error: wrong nesting in scope analysis.');
|
173
|
+
throw new Error('Internal error');
|
174
|
+
}
|
175
|
+
|
176
|
+
// Move all unbound variables to the parent (also move var-bound variables
|
177
|
+
// if the parent is not a function).
|
178
|
+
const keysToRemove = [];
|
179
|
+
for (const [name, defUse] of this.variables.entries()) {
|
180
|
+
if (defUse.definitionKind === DefinitionKind.None ||
|
181
|
+
(defUse.definitionKind === DefinitionKind.Var && !isFunctionScope)) {
|
182
|
+
this.parent.#mergeChildDefUses(name, defUse);
|
183
|
+
keysToRemove.push(name);
|
184
|
+
}
|
185
|
+
}
|
186
|
+
keysToRemove.forEach(k => this.variables.delete(k));
|
187
|
+
}
|
188
|
+
}
|
189
|
+
|
190
|
+
class ScopeVariableAnalysis {
|
191
|
+
readonly #rootScope = new Scope(null);
|
192
|
+
readonly #allNames = new Set<string>();
|
193
|
+
#currentScope = this.#rootScope;
|
194
|
+
|
195
|
+
processNode(node: Acorn.ESTree.Node|null): void {
|
196
|
+
if (node === null) {
|
197
|
+
return;
|
198
|
+
}
|
199
|
+
switch (node.type) {
|
200
|
+
case 'AwaitExpression':
|
201
|
+
this.processNode(node.argument);
|
202
|
+
break;
|
203
|
+
case 'ArrayExpression':
|
204
|
+
node.elements.forEach(item => this.processNode(item));
|
205
|
+
break;
|
206
|
+
case 'ExpressionStatement':
|
207
|
+
this.processNode(node.expression);
|
208
|
+
break;
|
209
|
+
case 'Program':
|
210
|
+
console.assert(this.#currentScope === this.#rootScope);
|
211
|
+
node.body.forEach(item => this.processNode(item));
|
212
|
+
console.assert(this.#currentScope === this.#rootScope);
|
213
|
+
break;
|
214
|
+
case 'ArrayPattern':
|
215
|
+
node.elements.forEach(item => this.processNode(item));
|
216
|
+
break;
|
217
|
+
case 'ArrowFunctionExpression':
|
218
|
+
this.#pushScope();
|
219
|
+
node.params.forEach(this.#processNodeAsDefinition.bind(this, DefinitionKind.Var));
|
220
|
+
this.processNode(node.body);
|
221
|
+
this.#popScope(true);
|
222
|
+
break;
|
223
|
+
case 'AssignmentExpression':
|
224
|
+
case 'AssignmentPattern':
|
225
|
+
case 'BinaryExpression':
|
226
|
+
case 'LogicalExpression':
|
227
|
+
this.processNode(node.left);
|
228
|
+
this.processNode(node.right);
|
229
|
+
break;
|
230
|
+
case 'BlockStatement':
|
231
|
+
this.#pushScope();
|
232
|
+
node.body.forEach(this.processNode.bind(this));
|
233
|
+
this.#popScope(false);
|
234
|
+
break;
|
235
|
+
case 'CallExpression':
|
236
|
+
this.processNode(node.callee);
|
237
|
+
node.arguments.forEach(this.processNode.bind(this));
|
238
|
+
break;
|
239
|
+
case 'VariableDeclaration': {
|
240
|
+
const definitionKind = node.kind === 'var' ? DefinitionKind.Var : DefinitionKind.Let;
|
241
|
+
node.declarations.forEach(this.#processVariableDeclarator.bind(this, definitionKind));
|
242
|
+
break;
|
243
|
+
}
|
244
|
+
case 'CatchClause':
|
245
|
+
this.#pushScope();
|
246
|
+
this.#processNodeAsDefinition(DefinitionKind.Let, node.param);
|
247
|
+
node.body.body.forEach(this.processNode.bind(this));
|
248
|
+
this.#popScope(false);
|
249
|
+
break;
|
250
|
+
case 'ClassBody':
|
251
|
+
node.body.forEach(this.processNode.bind(this));
|
252
|
+
break;
|
253
|
+
case 'ClassDeclaration':
|
254
|
+
this.#processNodeAsDefinition(DefinitionKind.Let, node.id);
|
255
|
+
this.#pushScope();
|
256
|
+
this.processNode(node.superClass ?? null);
|
257
|
+
this.processNode(node.body);
|
258
|
+
this.#popScope(false);
|
259
|
+
break;
|
260
|
+
case 'ClassExpression':
|
261
|
+
this.#pushScope();
|
262
|
+
// Intentionally ignore the id.
|
263
|
+
this.processNode(node.superClass ?? null);
|
264
|
+
this.processNode(node.body);
|
265
|
+
this.#popScope(false);
|
266
|
+
break;
|
267
|
+
case 'ChainExpression':
|
268
|
+
this.processNode(node.expression);
|
269
|
+
break;
|
270
|
+
case 'ConditionalExpression':
|
271
|
+
this.processNode(node.test);
|
272
|
+
this.processNode(node.consequent);
|
273
|
+
this.processNode(node.alternate);
|
274
|
+
break;
|
275
|
+
case 'DoWhileStatement':
|
276
|
+
this.processNode(node.body);
|
277
|
+
this.processNode(node.test);
|
278
|
+
break;
|
279
|
+
case 'ForInStatement':
|
280
|
+
case 'ForOfStatement':
|
281
|
+
this.#pushScope();
|
282
|
+
this.processNode(node.left);
|
283
|
+
this.processNode(node.right);
|
284
|
+
this.processNode(node.body);
|
285
|
+
this.#popScope(false);
|
286
|
+
break;
|
287
|
+
case 'ForStatement':
|
288
|
+
this.#pushScope();
|
289
|
+
this.processNode(node.init ?? null);
|
290
|
+
this.processNode(node.test ?? null);
|
291
|
+
this.processNode(node.update ?? null);
|
292
|
+
this.processNode(node.body);
|
293
|
+
this.#popScope(false);
|
294
|
+
break;
|
295
|
+
case 'FunctionDeclaration':
|
296
|
+
this.#processNodeAsDefinition(DefinitionKind.Var, node.id);
|
297
|
+
this.#pushScope();
|
298
|
+
this.#addVariable('this', node.start, DefinitionKind.Fixed);
|
299
|
+
this.#addVariable('arguments', node.start, DefinitionKind.Fixed);
|
300
|
+
node.params.forEach(this.#processNodeAsDefinition.bind(this, DefinitionKind.Let));
|
301
|
+
this.processNode(node.body);
|
302
|
+
this.#popScope(true);
|
303
|
+
break;
|
304
|
+
case 'FunctionExpression':
|
305
|
+
// Id is intentionally ignored in function expressions.
|
306
|
+
this.#pushScope();
|
307
|
+
this.#addVariable('this', node.start, DefinitionKind.Fixed);
|
308
|
+
this.#addVariable('arguments', node.start, DefinitionKind.Fixed);
|
309
|
+
node.params.forEach(this.#processNodeAsDefinition.bind(this, DefinitionKind.Let));
|
310
|
+
this.processNode(node.body);
|
311
|
+
this.#popScope(true);
|
312
|
+
break;
|
313
|
+
case 'Identifier':
|
314
|
+
this.#addVariable(node.name, node.start);
|
315
|
+
break;
|
316
|
+
case 'IfStatement':
|
317
|
+
this.processNode(node.test);
|
318
|
+
this.processNode(node.consequent);
|
319
|
+
this.processNode(node.alternate ?? null);
|
320
|
+
break;
|
321
|
+
case 'LabeledStatement':
|
322
|
+
this.processNode(node.body);
|
323
|
+
break;
|
324
|
+
case 'MetaProperty':
|
325
|
+
break;
|
326
|
+
case 'MethodDefinition':
|
327
|
+
if (node.computed) {
|
328
|
+
this.processNode(node.key);
|
329
|
+
}
|
330
|
+
this.processNode(node.value);
|
331
|
+
break;
|
332
|
+
case 'NewExpression':
|
333
|
+
this.processNode(node.callee);
|
334
|
+
node.arguments.forEach(this.processNode.bind(this));
|
335
|
+
break;
|
336
|
+
case 'MemberExpression':
|
337
|
+
this.processNode(node.object);
|
338
|
+
if (node.computed) {
|
339
|
+
this.processNode(node.property);
|
340
|
+
}
|
341
|
+
break;
|
342
|
+
case 'ObjectExpression':
|
343
|
+
node.properties.forEach(this.processNode.bind(this));
|
344
|
+
break;
|
345
|
+
case 'ObjectPattern':
|
346
|
+
node.properties.forEach(this.processNode.bind(this));
|
347
|
+
break;
|
348
|
+
case 'PrivateIdentifier':
|
349
|
+
break;
|
350
|
+
case 'PropertyDefinition':
|
351
|
+
if (node.computed) {
|
352
|
+
this.processNode(node.key);
|
353
|
+
}
|
354
|
+
this.processNode(node.value ?? null);
|
355
|
+
break;
|
356
|
+
case 'Property':
|
357
|
+
if (node.shorthand) {
|
358
|
+
console.assert(node.value === node.key);
|
359
|
+
console.assert(node.value.type === 'Identifier');
|
360
|
+
this.#addVariable((node.value as Acorn.ESTree.Identifier).name, node.value.start, DefinitionKind.None, true);
|
361
|
+
} else {
|
362
|
+
if (node.computed) {
|
363
|
+
this.processNode(node.key);
|
364
|
+
}
|
365
|
+
this.processNode(node.value);
|
366
|
+
}
|
367
|
+
break;
|
368
|
+
case 'RestElement':
|
369
|
+
this.#processNodeAsDefinition(DefinitionKind.Let, node.argument);
|
370
|
+
break;
|
371
|
+
case 'ReturnStatement':
|
372
|
+
this.processNode(node.argument ?? null);
|
373
|
+
break;
|
374
|
+
case 'SequenceExpression':
|
375
|
+
node.expressions.forEach(this.processNode.bind(this));
|
376
|
+
break;
|
377
|
+
case 'SpreadElement':
|
378
|
+
this.processNode(node.argument);
|
379
|
+
break;
|
380
|
+
case 'SwitchCase':
|
381
|
+
this.processNode(node.test ?? null);
|
382
|
+
node.consequent.forEach(this.processNode.bind(this));
|
383
|
+
break;
|
384
|
+
case 'SwitchStatement':
|
385
|
+
this.processNode(node.discriminant);
|
386
|
+
node.cases.forEach(this.processNode.bind(this));
|
387
|
+
break;
|
388
|
+
case 'TaggedTemplateExpression':
|
389
|
+
this.processNode(node.tag);
|
390
|
+
this.processNode(node.quasi);
|
391
|
+
break;
|
392
|
+
case 'TemplateLiteral':
|
393
|
+
node.expressions.forEach(this.processNode.bind(this));
|
394
|
+
break;
|
395
|
+
case 'ThisExpression':
|
396
|
+
this.#addVariable('this', node.start);
|
397
|
+
break;
|
398
|
+
case 'ThrowStatement':
|
399
|
+
this.processNode(node.argument);
|
400
|
+
break;
|
401
|
+
case 'TryStatement':
|
402
|
+
this.processNode(node.block);
|
403
|
+
this.processNode(node.handler ?? null);
|
404
|
+
this.processNode(node.finalizer ?? null);
|
405
|
+
break;
|
406
|
+
case 'WithStatement':
|
407
|
+
this.processNode(node.object);
|
408
|
+
// TODO jarin figure how to treat the with body.
|
409
|
+
this.processNode(node.body);
|
410
|
+
break;
|
411
|
+
case 'YieldExpression':
|
412
|
+
this.processNode(node.argument ?? null);
|
413
|
+
break;
|
414
|
+
case 'UnaryExpression':
|
415
|
+
case 'UpdateExpression':
|
416
|
+
this.processNode(node.argument);
|
417
|
+
break;
|
418
|
+
case 'WhileStatement':
|
419
|
+
this.processNode(node.test);
|
420
|
+
this.processNode(node.body);
|
421
|
+
break;
|
422
|
+
|
423
|
+
// Ignore, no expressions involved.
|
424
|
+
case 'BreakStatement':
|
425
|
+
case 'ContinueStatement':
|
426
|
+
case 'DebuggerStatement':
|
427
|
+
case 'EmptyStatement':
|
428
|
+
case 'Literal':
|
429
|
+
case 'Super':
|
430
|
+
case 'TemplateElement':
|
431
|
+
break;
|
432
|
+
// Ignore, cannot be used outside of a module.
|
433
|
+
case 'ImportDeclaration':
|
434
|
+
case 'ImportDefaultSpecifier':
|
435
|
+
case 'ImportNamespaceSpecifier':
|
436
|
+
case 'ImportSpecifier':
|
437
|
+
case 'ImportExpression':
|
438
|
+
case 'ExportAllDeclaration':
|
439
|
+
case 'ExportDefaultDeclaration':
|
440
|
+
case 'ExportNamedDeclaration':
|
441
|
+
case 'ExportSpecifier':
|
442
|
+
break;
|
443
|
+
|
444
|
+
case 'VariableDeclarator':
|
445
|
+
console.error('Should not encounter VariableDeclarator in general traversal.');
|
446
|
+
break;
|
447
|
+
}
|
448
|
+
}
|
449
|
+
|
450
|
+
getFreeVariables(): Map<string, Use[]> {
|
451
|
+
const result = new Map<string, Use[]>();
|
452
|
+
for (const [name, defUse] of this.#rootScope.variables) {
|
453
|
+
if (defUse.definitionKind !== DefinitionKind.None) {
|
454
|
+
// Skip bound variables.
|
455
|
+
continue;
|
456
|
+
}
|
457
|
+
result.set(name, defUse.uses);
|
458
|
+
}
|
459
|
+
return result;
|
460
|
+
}
|
461
|
+
|
462
|
+
getAllNames(): Set<string> {
|
463
|
+
return this.#allNames;
|
464
|
+
}
|
465
|
+
|
466
|
+
#pushScope(): void {
|
467
|
+
this.#currentScope = new Scope(this.#currentScope);
|
468
|
+
}
|
469
|
+
|
470
|
+
#popScope(isFunctionContext: boolean): void {
|
471
|
+
if (this.#currentScope.parent === null) {
|
472
|
+
console.error('Internal error: wrong nesting in scope analysis.');
|
473
|
+
throw new Error('Internal error');
|
474
|
+
}
|
475
|
+
this.#currentScope.finalizeToParent(isFunctionContext);
|
476
|
+
this.#currentScope = this.#currentScope.parent;
|
477
|
+
}
|
478
|
+
|
479
|
+
#addVariable(
|
480
|
+
name: string, offset: number, definitionKind: DefinitionKind = DefinitionKind.None,
|
481
|
+
isShorthandAssignmentProperty: boolean = false): void {
|
482
|
+
this.#allNames.add(name);
|
483
|
+
this.#currentScope.addVariable(name, offset, definitionKind, isShorthandAssignmentProperty);
|
484
|
+
}
|
485
|
+
|
486
|
+
#processNodeAsDefinition(
|
487
|
+
definitionKind: DefinitionKind.Let|DefinitionKind.Var,
|
488
|
+
node: Acorn.ESTree.Pattern|Acorn.ESTree.AssignmentProperty|null): void {
|
489
|
+
if (node === null) {
|
490
|
+
return;
|
491
|
+
}
|
492
|
+
switch (node.type) {
|
493
|
+
case 'ArrayPattern':
|
494
|
+
node.elements.forEach(this.#processNodeAsDefinition.bind(this, definitionKind));
|
495
|
+
break;
|
496
|
+
case 'AssignmentPattern':
|
497
|
+
this.#processNodeAsDefinition(definitionKind, node.left);
|
498
|
+
this.processNode(node.right);
|
499
|
+
break;
|
500
|
+
case 'Identifier':
|
501
|
+
this.#addVariable(node.name, node.start, definitionKind);
|
502
|
+
break;
|
503
|
+
case 'MemberExpression':
|
504
|
+
this.processNode(node.object);
|
505
|
+
if (node.computed) {
|
506
|
+
this.processNode(node.property);
|
507
|
+
}
|
508
|
+
break;
|
509
|
+
case 'ObjectPattern':
|
510
|
+
node.properties.forEach(this.#processNodeAsDefinition.bind(this, definitionKind));
|
511
|
+
break;
|
512
|
+
case 'Property':
|
513
|
+
// This is AssignmentProperty inside an object pattern.
|
514
|
+
if (node.shorthand) {
|
515
|
+
console.assert(node.value === node.key);
|
516
|
+
console.assert(node.value.type === 'Identifier');
|
517
|
+
this.#addVariable((node.value as Acorn.ESTree.Identifier).name, node.value.start, definitionKind, true);
|
518
|
+
} else {
|
519
|
+
if (node.computed) {
|
520
|
+
this.processNode(node.key);
|
521
|
+
}
|
522
|
+
this.#processNodeAsDefinition(definitionKind, node.value);
|
523
|
+
}
|
524
|
+
break;
|
525
|
+
case 'RestElement':
|
526
|
+
this.#processNodeAsDefinition(definitionKind, node.argument);
|
527
|
+
break;
|
528
|
+
}
|
529
|
+
}
|
530
|
+
|
531
|
+
#processVariableDeclarator(
|
532
|
+
definitionKind: DefinitionKind.Let|DefinitionKind.Var, decl: Acorn.ESTree.VariableDeclarator): void {
|
533
|
+
this.#processNodeAsDefinition(definitionKind, decl.id);
|
534
|
+
this.processNode(decl.init ?? null);
|
535
|
+
}
|
536
|
+
}
|
@@ -16,6 +16,7 @@ import * as HTMLOutline from './HTMLOutline.js';
|
|
16
16
|
import * as JavaScriptFormatter from './JavaScriptFormatter.js';
|
17
17
|
import * as JavaScriptOutline from './JavaScriptOutline.js';
|
18
18
|
import * as JSONFormatter from './JSONFormatter.js';
|
19
|
+
import * as Substitute from './Substitute.js';
|
19
20
|
|
20
21
|
export {
|
21
22
|
CSSFormatter,
|
@@ -27,4 +28,5 @@ export {
|
|
27
28
|
JavaScriptFormatter,
|
28
29
|
JavaScriptOutline,
|
29
30
|
JSONFormatter,
|
31
|
+
Substitute,
|
30
32
|
};
|
@@ -6,6 +6,7 @@ import type * as Common from '../../core/common/common.js';
|
|
6
6
|
import * as Host from '../../core/host/host.js';
|
7
7
|
import * as i18n from '../../core/i18n/i18n.js';
|
8
8
|
import * as Components from '../../ui/legacy/components/utils/utils.js';
|
9
|
+
import type * as Platform from '../../core/platform/platform.js';
|
9
10
|
import type * as ProtocolProxyApi from '../../generated/protocol-proxy-api.js';
|
10
11
|
import type * as Protocol from '../../generated/protocol.js';
|
11
12
|
|
@@ -40,7 +41,7 @@ export class NodeMainImpl implements Common.Runnable.Runnable {
|
|
40
41
|
void SDK.Connections.initMainConnection(async () => {
|
41
42
|
const target = SDK.TargetManager.TargetManager.instance().createTarget(
|
42
43
|
'main', i18nString(UIStrings.main), SDK.Target.Type.Browser, null);
|
43
|
-
target.setInspectedURL('Node.js');
|
44
|
+
target.setInspectedURL('Node.js' as Platform.DevToolsPath.UrlString);
|
44
45
|
}, Components.TargetDetachedDialog.TargetDetachedDialog.webSocketConnectionLost);
|
45
46
|
}
|
46
47
|
}
|
@@ -113,11 +113,7 @@ export function registerCommands(inspectorBackend) {
|
|
113
113
|
['nodes']);
|
114
114
|
inspectorBackend.registerCommand(
|
115
115
|
'Accessibility.getFullAXTree',
|
116
|
-
[
|
117
|
-
{'name': 'depth', 'type': 'number', 'optional': true},
|
118
|
-
{'name': 'max_depth', 'type': 'number', 'optional': true},
|
119
|
-
{'name': 'frameId', 'type': 'string', 'optional': true}
|
120
|
-
],
|
116
|
+
[{'name': 'depth', 'type': 'number', 'optional': true}, {'name': 'frameId', 'type': 'string', 'optional': true}],
|
121
117
|
['nodes']);
|
122
118
|
inspectorBackend.registerCommand(
|
123
119
|
'Accessibility.getRootAXNode', [{'name': 'frameId', 'type': 'string', 'optional': true}], ['node']);
|
@@ -211,6 +207,7 @@ export function registerCommands(inspectorBackend) {
|
|
211
207
|
MixedContentWarning: 'MixedContentWarning'
|
212
208
|
});
|
213
209
|
inspectorBackend.registerEnum('Audits.MixedContentResourceType', {
|
210
|
+
AttributionSrc: 'AttributionSrc',
|
214
211
|
Audio: 'Audio',
|
215
212
|
Beacon: 'Beacon',
|
216
213
|
CSPReport: 'CSPReport',
|
@@ -520,6 +517,8 @@ export function registerCommands(inspectorBackend) {
|
|
520
517
|
'CSS.getPlatformFontsForNode', [{'name': 'nodeId', 'type': 'number', 'optional': false}], ['fonts']);
|
521
518
|
inspectorBackend.registerCommand(
|
522
519
|
'CSS.getStyleSheetText', [{'name': 'styleSheetId', 'type': 'string', 'optional': false}], ['text']);
|
520
|
+
inspectorBackend.registerCommand(
|
521
|
+
'CSS.getLayersForNode', [{'name': 'nodeId', 'type': 'number', 'optional': false}], ['rootLayer']);
|
523
522
|
inspectorBackend.registerCommand(
|
524
523
|
'CSS.trackComputedStyleUpdates', [{'name': 'propertiesToTrack', 'type': 'object', 'optional': false}], []);
|
525
524
|
inspectorBackend.registerCommand('CSS.takeComputedStyleUpdates', [], ['nodeIds']);
|
@@ -656,10 +655,11 @@ export function registerCommands(inspectorBackend) {
|
|
656
655
|
ScrollbarCorner: 'scrollbar-corner',
|
657
656
|
Resizer: 'resizer',
|
658
657
|
InputListButton: 'input-list-button',
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
658
|
+
PageTransition: 'page-transition',
|
659
|
+
PageTransitionContainer: 'page-transition-container',
|
660
|
+
PageTransitionImageWrapper: 'page-transition-image-wrapper',
|
661
|
+
PageTransitionOutgoingImage: 'page-transition-outgoing-image',
|
662
|
+
PageTransitionIncomingImage: 'page-transition-incoming-image'
|
663
663
|
});
|
664
664
|
inspectorBackend.registerEnum('DOM.ShadowRootType', {UserAgent: 'user-agent', Open: 'open', Closed: 'closed'});
|
665
665
|
inspectorBackend.registerEnum(
|
@@ -1153,6 +1153,8 @@ export function registerCommands(inspectorBackend) {
|
|
1153
1153
|
{'name': 'userAgentMetadata', 'type': 'object', 'optional': true}
|
1154
1154
|
],
|
1155
1155
|
[]);
|
1156
|
+
inspectorBackend.registerCommand(
|
1157
|
+
'Emulation.setAutomationOverride', [{'name': 'enabled', 'type': 'boolean', 'optional': false}], []);
|
1156
1158
|
|
1157
1159
|
// HeadlessExperimental.
|
1158
1160
|
inspectorBackend.registerEnum('HeadlessExperimental.ScreenshotParamsFormat', {Jpeg: 'jpeg', Png: 'png'});
|
@@ -976,6 +976,14 @@ export namespace ProtocolMapping {
|
|
976
976
|
*/
|
977
977
|
'CSS.getStyleSheetText':
|
978
978
|
{paramsType: [Protocol.CSS.GetStyleSheetTextRequest]; returnType: Protocol.CSS.GetStyleSheetTextResponse;};
|
979
|
+
/**
|
980
|
+
* Returns all layers parsed by the rendering engine for the tree scope of a node.
|
981
|
+
* Given a DOM element identified by nodeId, getLayersForNode returns the root
|
982
|
+
* layer for the nearest ancestor document or shadow root. The layer root contains
|
983
|
+
* the full layer tree for the tree scope and their ordering.
|
984
|
+
*/
|
985
|
+
'CSS.getLayersForNode':
|
986
|
+
{paramsType: [Protocol.CSS.GetLayersForNodeRequest]; returnType: Protocol.CSS.GetLayersForNodeResponse;};
|
979
987
|
/**
|
980
988
|
* Starts tracking the given computed styles for updates. The specified array of properties
|
981
989
|
* replaces the one previously specified. Pass empty array to disable tracking.
|
@@ -1593,6 +1601,11 @@ export namespace ProtocolMapping {
|
|
1593
1601
|
* Allows overriding user agent with the given string.
|
1594
1602
|
*/
|
1595
1603
|
'Emulation.setUserAgentOverride': {paramsType: [Protocol.Emulation.SetUserAgentOverrideRequest]; returnType: void;};
|
1604
|
+
/**
|
1605
|
+
* Allows overriding the automation flag.
|
1606
|
+
*/
|
1607
|
+
'Emulation.setAutomationOverride':
|
1608
|
+
{paramsType: [Protocol.Emulation.SetAutomationOverrideRequest]; returnType: void;};
|
1596
1609
|
/**
|
1597
1610
|
* Sends a BeginFrame to the target and returns when the frame was completed. Optionally captures a
|
1598
1611
|
* screenshot from the resulting frame. Requires that the target was created with enabled
|
@@ -592,6 +592,15 @@ declare namespace ProtocolProxyApi {
|
|
592
592
|
invoke_getStyleSheetText(params: Protocol.CSS.GetStyleSheetTextRequest):
|
593
593
|
Promise<Protocol.CSS.GetStyleSheetTextResponse>;
|
594
594
|
|
595
|
+
/**
|
596
|
+
* Returns all layers parsed by the rendering engine for the tree scope of a node.
|
597
|
+
* Given a DOM element identified by nodeId, getLayersForNode returns the root
|
598
|
+
* layer for the nearest ancestor document or shadow root. The layer root contains
|
599
|
+
* the full layer tree for the tree scope and their ordering.
|
600
|
+
*/
|
601
|
+
invoke_getLayersForNode(params: Protocol.CSS.GetLayersForNodeRequest):
|
602
|
+
Promise<Protocol.CSS.GetLayersForNodeResponse>;
|
603
|
+
|
595
604
|
/**
|
596
605
|
* Starts tracking the given computed styles for updates. The specified array of properties
|
597
606
|
* replaces the one previously specified. Pass empty array to disable tracking.
|
@@ -1468,6 +1477,12 @@ declare namespace ProtocolProxyApi {
|
|
1468
1477
|
*/
|
1469
1478
|
invoke_setUserAgentOverride(params: Protocol.Emulation.SetUserAgentOverrideRequest):
|
1470
1479
|
Promise<Protocol.ProtocolResponseWithError>;
|
1480
|
+
|
1481
|
+
/**
|
1482
|
+
* Allows overriding the automation flag.
|
1483
|
+
*/
|
1484
|
+
invoke_setAutomationOverride(params: Protocol.Emulation.SetAutomationOverrideRequest):
|
1485
|
+
Promise<Protocol.ProtocolResponseWithError>;
|
1471
1486
|
}
|
1472
1487
|
export interface EmulationDispatcher {
|
1473
1488
|
/**
|