Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 7 additions & 88 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
"get-stdin": "^9.0.0",
"json5": "^2.2.0",
"mri": "^1.2.0",
"node-fetch": "^3.0.0",
"semver": "^7.3.5",
"tar-stream": "^2.2.0",
"tmp": "^0.2.1",
Expand Down
16 changes: 11 additions & 5 deletions tools/lib/chrome-source.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import tar from 'tar-stream';
import * as stream from 'stream';
import * as path from 'path';
import { promises as fsPromises } from 'fs';
import fetch from 'node-fetch';


/**
Expand Down Expand Up @@ -54,15 +53,22 @@ export async function fetchAllTo(targetPath, chromePaths, revision) {
// have (because the compressed version of a higher folder was fetched).
chromePaths.sort();

return Promise.all(chromePaths.map(async (chromePath, i) => {
const requests = [];

for (const [i, chromePath] of chromePaths.entries()) {
const isSatisfied = chromePaths.slice(0, i).some(previous => {
return chromePath.startsWith(previous + '/');
});
if (isSatisfied) {
return null; // we'll already have something for this
continue; // we'll already have something for this
}
return fetchTo(targetPath, chromePath, revision);
}));
requests.push(fetchTo(targetPath, chromePath, revision));

// Small wait to attempt to avoid rate limiting.
await new Promise((resolve) => setTimeout(resolve, 1000));
}

return Promise.all(requests);
}


Expand Down
126 changes: 126 additions & 0 deletions tools/lib/known-namespaces.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
accessibilityFeatures
action
alarms
app
app.runtime
app.window
appviewTag
audio
bluetooth
bluetoothLowEnergy
bluetoothSocket
bookmarks
browser
browserAction
browsingData
certificateProvider
chrome_url_overrides
clipboard
commands
contentScripts
contentSettings
contextMenus
cookies
crossOriginIsolation
debugger
declarativeContent
declarativeNetRequest
declarativeWebRequest
desktopCapture
devtools.inspectedWindow
devtools.network
devtools.panels
devtools.performance
devtools.recorder
diagnostics
dns
documentScan
dom
downloads
enterprise.deviceAttributes
enterprise.hardwarePlatform
enterprise.kioskInput
enterprise.login
enterprise.networkingAttributes
enterprise.platformKeys
enterprise.remoteApps
events
extension
extensionsManifestTypes
extensionTypes
fileBrowserHandler
fileHandlers
fileSystem
fileSystemProvider
fontSettings
gcm
hid
history
i18n
identity
idle
incognito
input.ime
instanceID
login
loginState
management
manifestTypes
mdns
mediaGalleries
networking.onc
notifications
oauth2
offscreen
omnibox
pageAction
pageCapture
permissions
platformKeys
power
printerProvider
printing
printingMetrics
privacy
processes
protocolHandlers
proxy
readingList
runtime
scripting
search
serial
sessions
sharedModule
sidePanel
socket
sockets.tcp
sockets.tcpServer
sockets.udp
storage
syncFileSystem
system.cpu
system.display
system.memory
system.network
system.storage
systemLog
tabCapture
tabGroups
tabs
topSites
tts
ttsEngine
types
usb
userScripts
virtualKeyboard
vpnProvider
wallpaper
webAccessibleResources
webAuthenticationProxy
webNavigation
webRequest
webViewRequest
webviewTag
windows
11 changes: 11 additions & 0 deletions tools/lib/render-context.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,17 @@ import * as overrideTypes from '../../types/override.js';
import { RenderBuffer } from './buffer.js';
import { isValidToken } from './js-internals.js';
import { last, TraverseContext } from './traverse.js';
import { readFileSync } from 'fs';
import log from 'fancy-log';


export class RenderContext {
#override;
#t;

/** @type {string[]} */
#knownNamespaces;

/** @type {chromeTypes.SpecCallback[]} */
#callbacks = [];

Expand Down Expand Up @@ -53,6 +58,7 @@ export class RenderContext {

const isVisible = override.isVisible.bind(override);
this.#t = new TraverseContext(isVisible);
this.#knownNamespaces = readFileSync("tools/lib/known-namespaces.txt").toString("utf8").split("\n");
}

/**
Expand Down Expand Up @@ -97,6 +103,11 @@ export class RenderContext {
return '';
}

if (!this.#knownNamespaces.includes(namespace.namespace)) {
log.warn('Skipping unknown namespace:', namespace.namespace);
return '';
}

const content = this.renderInnerNamespace(namespace, toplevel);
if (!content) {
return '';
Expand Down
Loading
Loading