Skip to content

Commit 9844499

Browse files
Merge pull request #1267 from gemini-testing/TRIVIAL.selectivity_ignore_chrome_error_webdata
fix(selectivity): ignore "chrome-error://" and "<no source>"
2 parents 9f3eaa3 + 19e2bf7 commit 9844499

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

src/browser/cdp/selectivity/css-selectivity.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export class CSSSelectivity {
6262
return;
6363
}
6464

65-
if (!sourceURL || !sourceMapURL) {
65+
if (!sourceURL || !sourceMapURL || sourceURL.startsWith("chrome-error://")) {
6666
this._stylesSourceMap[styleSheetId] ||= null;
6767
return;
6868
}
@@ -350,6 +350,12 @@ export class CSSSelectivity {
350350
// But we dont, because if stylesheet was not used, it could be used after change
351351
// So its safe to think "if stylesheet was loaded, it was used"
352352
rawSourceMap.sources.forEach(sourceFilePath => {
353+
// Ignore generated postcss styles:
354+
// https://github.com/postcss/postcss/blob/eae46db765d752cf8f40c4fa2b0b85030079c43d/lib/map-generator.js#L122
355+
if (sourceFilePath === "<no source>") {
356+
return;
357+
}
358+
353359
// "Each entry is either a string that is a (potentially relative) URL", so we are using posix.jojn
354360
// https://tc39.es/ecma426/#sec-source-map-format
355361
// Except for file path with protocol ("turbopack://", "file://")

src/browser/cdp/selectivity/js-selectivity.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export class JSSelectivity {
5252

5353
this._scriptIdToSourceUrl[scriptId] ||= url;
5454

55-
if (!url || !sourceMapURL) {
55+
if (!url || !sourceMapURL || url.startsWith("chrome-error://")) {
5656
this._scriptsSource[scriptId] ||= null;
5757
this._scriptsSourceMap[scriptId] ||= null;
5858
return;

0 commit comments

Comments
 (0)