Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract tab lifecycle events #2123

Merged
merged 5 commits into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Rename 'features' to 'components'.
  • Loading branch information
sammacbeth committed Aug 31, 2023
commit a7fd9ed07781d188757bc67c829c115bd514bb54
2 changes: 1 addition & 1 deletion integration-test/fire-button.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ async function requestBrowsingDataPermissions (backgroundPage) {
* @returns {Promise<import('@playwright/test').JSHandle>}
*/
function getFireButtonHandle (backgroundPage) {
return backgroundPage.evaluateHandle(() => globalThis.features.fireButton)
return backgroundPage.evaluateHandle(() => globalThis.components.fireButton)
}

async function waitForAllResults (page) {
Expand Down
10 changes: 5 additions & 5 deletions shared/js/background/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
/* global DEBUG, RELOADER, BUILD_TARGET */

import { onStartup } from './startup'
import FireButton from './features/fire-button'
import FireButton from './components/fire-button'
import initDebugBuild from './devbuild'
import initReloader from './devbuild-reloader'
import tabManager from './tab-manager'
Expand All @@ -38,14 +38,14 @@ settings.ready().then(() => {
* fireButton?: FireButton;
* }}
*/
const features = {}
const components = {}

if (BUILD_TARGET === 'chrome' || BUILD_TARGET === 'chrome-mv3') {
features.fireButton = new FireButton({ settings, tabManager })
components.fireButton = new FireButton({ settings, tabManager })
}
console.log('Loaded features:', features)
console.log('Loaded components:', components)
// @ts-ignore
self.features = features
self.components = components

// Optional features controlled by build flags.
// If these flags are set to false, the whole function is tree-shaked from the build.
Expand Down
2 changes: 1 addition & 1 deletion shared/js/background/message-handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { isFeatureEnabled, reloadCurrentTab } from './utils'
import { ensureClickToLoadRuleActionDisabled } from './dnr-click-to-load'
import tdsStorage from './storage/tds'
import { getArgumentsObject } from './helpers/arguments-object'
import { isFireButtonEnabled } from './features/fire-button'
import { isFireButtonEnabled } from './components/fire-button'
const { getDomain } = require('tldts')
const utils = require('./utils')
const settings = require('./settings')
Expand Down