Skip to content

Commit

Permalink
extension: import webextension-polyfill directly
Browse files Browse the repository at this point in the history
  • Loading branch information
karlicoss committed May 20, 2024
1 parent 4e67d71 commit c279ca4
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 20 deletions.
2 changes: 1 addition & 1 deletion extension/src/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

// provided by the manifest
// import * as browser from "webextension-polyfill"
import browser from "webextension-polyfill"

import type {Url, SearchPageParams} from './common';
import {Visit, Visits, Blacklisted, unwrap, Methods, uuid} from './common'
Expand Down Expand Up @@ -143,7 +144,6 @@ async function updateState(tab: TabUrl): Promise<void> {
await browser.tabs.insertCSS (tabId, {file: 'sidebar-outer.css'})
await browser.tabs.insertCSS (tabId, {file: 'sidebar.css' })
await browser.tabs.insertCSS (tabId, {code: opts.position_css })
await browser.tabs.executeScript(tabId, {file: 'browser-polyfill.js'})
await browser.tabs.executeScript(tabId, {file: 'webext-options-sync.js'})
await browser.tabs.executeScript(tabId, {file: 'anchorme.js'})
if (opts.sidebar_detect_urls) {
Expand Down
1 change: 0 additions & 1 deletion extension/src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"background": {
"scripts": [
"browser-polyfill.js",
"webext-options-sync.js",
"background.js"
],
Expand Down
2 changes: 2 additions & 0 deletions extension/src/notifications.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/* @flow */
import browser from "webextension-polyfill"

import type {Url} from './common';
import {Blacklisted} from './common';
import {getOptions} from './options';
Expand Down
3 changes: 3 additions & 0 deletions extension/src/options.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
/* @flow */

import browser from "webextension-polyfill"

import {getBrowser, Methods} from './common'

/* NOTE: options can only be renamed in-between store releases */
Expand Down
1 change: 0 additions & 1 deletion extension/src/options_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Options</title>
<script src='browser-polyfill.js' ></script>
<script src='webext-options-sync.js'></script>
<link rel="stylesheet" type="text/css" href="options_page.css">
</head>
Expand Down
1 change: 0 additions & 1 deletion extension/src/search.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<meta charset="UTF-8">
<title>Search</title>
<link rel="stylesheet" type="text/css" href="sidebar.css">
<script src='browser-polyfill.js' ></script>
<script src='webext-options-sync.js'></script>
<script src='anchorme.js' ></script>
</head>
Expand Down
2 changes: 2 additions & 0 deletions extension/src/sidebar.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/* @flow */
import browser from "webextension-polyfill"

import {Visits, Visit, unwrap, format_duration, Methods, addStyle, Ids, uuid, getOrDefault} from './common'
import type {Second, Src} from './common'
import {getOptions, USE_ORIGINAL_TZ, GROUP_CONSECUTIVE_SECONDS} from './options';
Expand Down
1 change: 1 addition & 0 deletions extension/src/sources.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* @flow */
import browser from "webextension-polyfill"

/*
* In addition to sources indexed on the backend, some stuff lives inside the browser, e.g. local history + bookmarks
Expand Down
1 change: 0 additions & 1 deletion extension/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,6 @@ const options = {
// not sure if it's the right way, but I guess webpack can't guess otherwise
{ context: 'src', from: 'toastify.js' }, // TODO my version is tweaked, right?
{ context: 'src', from: 'selenium_bridge.js' },
{ from: 'node_modules/webextension-polyfill/dist/browser-polyfill.js' },
]
}),
new WebpackExtensionManifestPlugin({
Expand Down
30 changes: 15 additions & 15 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -74,21 +74,21 @@ commands =
{envpython} -m pip install --use-pep517 -e .[HPI,org]
# todo install from HPI[all] or something?

{envpython} -m my.core module install my.github.ghexport
{envpython} -m my.core module install my.hypothesis
{envpython} -m my.core module install my.instapaper
{envpython} -m my.core module install my.pocket
{envpython} -m my.core module install my.reddit
{envpython} -m my.core module install my.fbmessenger
{envpython} -m my.core module install my.google.takeout.parser
{envpython} -m my.core module install my.browser.export

{envpython} -m mypy --install-types --non-interactive \
-p {[testenv]package_name}.sources \
# txt report is a bit more convenient to view on CI
--txt-report .coverage.mypy-misc \
--html-report .coverage.mypy-misc \
{posargs}
# {envpython} -m my.core module install my.github.ghexport
# {envpython} -m my.core module install my.hypothesis
# {envpython} -m my.core module install my.instapaper
# {envpython} -m my.core module install my.pocket
# {envpython} -m my.core module install my.reddit
# {envpython} -m my.core module install my.fbmessenger
# {envpython} -m my.core module install my.google.takeout.parser
# {envpython} -m my.core module install my.browser.export

#{envpython} -m mypy --install-types --non-interactive \
# -p {[testenv]package_name}.sources \
# # txt report is a bit more convenient to view on CI
# --txt-report .coverage.mypy-misc \
# --html-report .coverage.mypy-misc \
# {posargs}

{envpython} -m pip install --use-pep517 -e .[testing]
# ugh. a bit crap to run it separately
Expand Down

0 comments on commit c279ca4

Please sign in to comment.