-
Notifications
You must be signed in to change notification settings - Fork 331
fix(mv3): webpack configs #1178
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
Changes from all commits
e1015d7
e079301
4589cf6
5f4422b
96d9044
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,15 +1,16 @@ | ||
| { | ||
| "minimum_chrome_version": "72", | ||
| "permissions": [ | ||
| "clipboardWrite", | ||
| "contextMenus", | ||
| "idle", | ||
| "tabs", | ||
| "notifications", | ||
| "storage", | ||
| "tabs", | ||
| "unlimitedStorage", | ||
| "contextMenus", | ||
| "clipboardWrite", | ||
| "webNavigation", | ||
| "webRequest" | ||
| ], | ||
| "host_permissions": ["<all_urls>"], | ||
| "incognito": "not_allowed" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,24 +2,15 @@ | |
| /* eslint-env browser, webextensions */ | ||
|
|
||
| import browser from 'webextension-polyfill' | ||
| import createIpfsCompanion from '../lib/ipfs-companion.js' | ||
| import { onInstalled } from '../lib/on-installed.js' | ||
| import { getUninstallURL } from '../lib/on-uninstalled.js' | ||
| import { optionDefaults } from '../lib/options.js' | ||
| import createIpfsCompanion from '../lib/ipfs-companion.js' | ||
|
|
||
| // register lifecycle hooks early, otherwise we miss first install event | ||
| browser.runtime.onInstalled.addListener(onInstalled) | ||
| browser.runtime.setUninstallURL(getUninstallURL(browser)) | ||
|
|
||
| // init add-on after all libs are loaded | ||
| document.addEventListener('DOMContentLoaded', async () => { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. are we still listening for domcontentloaded somewhere else or is this no longer needed at all? I know the background is ran in service worker now, so maybe we don't need it at all
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will still be needed in popup and other pages with windowed context. |
||
| // setting debug namespaces require page reload to get applied | ||
| const debugNs = (await browser.storage.local.get({ logNamespaces: optionDefaults.logNamespaces })).logNamespaces | ||
| if (debugNs !== localStorage.debug) { | ||
| localStorage.debug = debugNs | ||
| window.location.reload() | ||
| } | ||
| // init inlined to read updated localStorage.debug | ||
| // @ts-expect-error - TS does not know about window.ipfsCompanion | ||
| window.ipfsCompanion = await createIpfsCompanion() | ||
| }) | ||
| const init = async () => { | ||
| await createIpfsCompanion() | ||
| } | ||
| init(); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| diff --git a/node_modules/debug/src/browser.js b/node_modules/debug/src/browser.js | ||
| index cd0fc35..794db58 100644 | ||
| --- a/node_modules/debug/src/browser.js | ||
| +++ b/node_modules/debug/src/browser.js | ||
|
Comment on lines
+1
to
+4
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we have a PR out for this patch?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nope this is the PR. |
||
| @@ -116,7 +116,7 @@ function useColors() { | ||
| // NB: In an Electron preload script, document will be defined but not fully | ||
| // initialized. Since we know we're in Chrome, we'll just detect this case | ||
| // explicitly | ||
| - if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { | ||
| + if (typeof globalThis !== 'undefined' && globalThis.process && (globalThis.process.type === 'renderer' || globalThis.process.__nwjs)) { | ||
| return true; | ||
| } | ||
|
|
||
| @@ -129,7 +129,7 @@ function useColors() { | ||
| // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 | ||
| return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || | ||
| // Is firebug? http://stackoverflow.com/a/398120/376773 | ||
| - (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || | ||
| + (typeof globalThis !== 'undefined' && globalThis.console && (globalThis.console.firebug || (globalThis.console.exception && globalThis.console.table))) || | ||
| // Is firefox >= v31? | ||
| // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages | ||
| (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || | ||
| @@ -245,6 +245,9 @@ function localstorage() { | ||
| try { | ||
| // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context | ||
| // The Browser also has localStorage in the global context. | ||
| + if (chrome?.storage?.local) { | ||
| + return chrome.storage.local; | ||
| + } | ||
| return localStorage; | ||
| } catch (error) { | ||
| // Swallow | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no module type?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add this back later, this seems to break things for now.