aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarvNC <rotrobmin@gmail.com>2023-11-03 11:59:21 -0700
committerMarvNC <rotrobmin@gmail.com>2023-11-03 11:59:21 -0700
commitec62375c017f124570cf922647c530829714eee2 (patch)
treeaccb3968e083f6e59a243b840d7859d61b3fae9e
parent5e10b67c500b7af9d5af6d98caae9734ebdf984d (diff)
parentb64f51c3b13a46af4dd7f1e43048ac19c781ca7b (diff)
Merge remote-tracking branch 'upstream/master' into update-dictionaries
-rw-r--r--.eslintrc.json2
-rw-r--r--.github/workflows/ci.yml2
-rw-r--r--.github/workflows/create-prerelease-on-tag.yml2
-rw-r--r--.github/workflows/playwright.yml6
-rw-r--r--.github/workflows/publish-firefox-development.yml2
-rw-r--r--.github/workflows/scorecard.yml2
-rw-r--r--.node-version2
-rw-r--r--.vscode/settings.json5
-rw-r--r--README.md10
-rw-r--r--dev/data/manifest-variants.json67
-rw-r--r--docs/permissions.md23
-rw-r--r--ext/js/background/request-builder.js294
-rw-r--r--ext/js/extension/environment.js16
-rw-r--r--ext/permissions.html47
-rw-r--r--ext/settings.html2
-rw-r--r--package-lock.json603
-rw-r--r--package.json12
-rw-r--r--playwright.config.js12
-rw-r--r--test/playwright/global.setup.js32
-rw-r--r--test/playwright/global.teardown.js28
-rw-r--r--test/playwright/integration.spec.js94
-rw-r--r--test/playwright/playwright-util.js109
-rw-r--r--test/playwright/visual.spec.js38
23 files changed, 684 insertions, 726 deletions
diff --git a/.eslintrc.json b/.eslintrc.json
index 06a2be34..56bbcf09 100644
--- a/.eslintrc.json
+++ b/.eslintrc.json
@@ -461,6 +461,8 @@
},
{
"files": [
+ "integration.spec.js",
+ "playwright-util.js",
"visual.spec.js"
],
"env": {
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 0254cbaa..fc70925f 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -14,7 +14,7 @@ jobs:
uses: actions/checkout@v4
- name: Setup node
- uses: actions/setup-node@v3
+ uses: actions/setup-node@v4
with:
node-version-file: ".node-version"
diff --git a/.github/workflows/create-prerelease-on-tag.yml b/.github/workflows/create-prerelease-on-tag.yml
index 90700f42..97eab1fd 100644
--- a/.github/workflows/create-prerelease-on-tag.yml
+++ b/.github/workflows/create-prerelease-on-tag.yml
@@ -18,7 +18,7 @@ jobs:
- uses: actions/checkout@v4
- name: Setup node
- uses: actions/setup-node@v3
+ uses: actions/setup-node@v4
with:
node-version-file: ".node-version"
diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml
index 8d4adca8..3cd8c3b2 100644
--- a/.github/workflows/playwright.yml
+++ b/.github/workflows/playwright.yml
@@ -9,6 +9,8 @@ jobs:
playwright:
timeout-minutes: 60
runs-on: ubuntu-latest
+ env:
+ PW_EXPERIMENTAL_SERVICE_WORKER_NETWORK_EVENTS: 1
steps:
- name: Remove all fonts
run: rm -rf /usr/share/fonts
@@ -16,12 +18,12 @@ jobs:
- uses: actions/checkout@v4
- name: Install CJK fonts
- uses: awalsh128/cache-apt-pkgs-action@1850ee53f6e706525805321a3f2f863dcf73c962 # v1.3.0
+ uses: awalsh128/cache-apt-pkgs-action@44c33b32f808cdddd5ac0366d70595ed63661ed8 # v1.3.1
with:
packages: fonts-ipafont-mincho
execute_install_scripts: true
- - uses: actions/setup-node@v3
+ - uses: actions/setup-node@v4
with:
cache: "npm"
node-version-file: ".node-version"
diff --git a/.github/workflows/publish-firefox-development.yml b/.github/workflows/publish-firefox-development.yml
index 7312bd56..1181277a 100644
--- a/.github/workflows/publish-firefox-development.yml
+++ b/.github/workflows/publish-firefox-development.yml
@@ -91,7 +91,7 @@ jobs:
git commit -a -m "${{ github.ref_name }}"
- name: Push changes
- uses: ad-m/github-push-action@29f05e01bb17e6f28228b47437e03a7b69e1f9ef # pin@master
+ uses: ad-m/github-push-action@d91a481090679876dfc4178fef17f286781251df # pin@master
with:
branch: metadata
diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml
index 4db56a60..da73b593 100644
--- a/.github/workflows/scorecard.yml
+++ b/.github/workflows/scorecard.yml
@@ -34,7 +34,7 @@ jobs:
persist-credentials: false
- name: "Run analysis"
- uses: ossf/scorecard-action@08b4669551908b1024bb425080c797723083c031 # v2.2.0
+ uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1
with:
results_file: results.sarif
results_format: sarif
diff --git a/.node-version b/.node-version
index 6f7f377b..9a2a0e21 100644
--- a/.node-version
+++ b/.node-version
@@ -1 +1 @@
-v16
+v20
diff --git a/.vscode/settings.json b/.vscode/settings.json
index d3738141..9318d9f6 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -3,5 +3,8 @@
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
- "eslint.format.enable": true
+ "eslint.format.enable": true,
+ "playwright.env": {
+ "PW_EXPERIMENTAL_SERVICE_WORKER_NETWORK_EVENTS": 1
+ }
}
diff --git a/README.md b/README.md
index 7fe89b09..7e94de02 100644
--- a/README.md
+++ b/README.md
@@ -26,7 +26,7 @@ Yomitan provides advanced features not available in other browser-based dictiona
- On-demand audio playback for select dictionary definitions.
- Kanji stroke order diagrams are just a click away for most characters.
- Custom search page for easily executing custom search queries.
-- Support for multiple dictionary formats including [EPWING](https://ja.wikipedia.org/wiki/EPWING) via the [Yomichan Import](https://foosoft.net/projects/yomichan-import) tool.
+- Support for multiple dictionary formats including [EPWING](https://ja.wikipedia.org/wiki/EPWING) via the [Yomitan Import](https://github.com/themoeway/yomitan-import) tool.
- Automatic note creation for the [Anki](https://apps.ankiweb.net/) flashcard program via the [AnkiConnect](https://foosoft.net/projects/anki-connect) plugin.
- Clean, modern code makes it easy for developers to [contribute](https://github.com/themoeway/yomitan/blob/master/CONTRIBUTING.md) new features.
@@ -111,8 +111,8 @@ form (e.g. `{{set "key" "value"}}`). The default templates and helper documentat
There are several free Japanese dictionaries available for Yomitan, with two of them having glossaries available in
different languages. You must download and import the dictionaries you wish to use in order to enable Yomitan
-definition lookups. If you have proprietary EPWING dictionaries that you would like to use, check the [Yomichan
-Import](https://foosoft.net/projects/yomichan-import) page to learn how to convert and import them into Yomitan.
+definition lookups. If you have proprietary EPWING dictionaries that you would like to use, check the [Yomitan
+Import](https://github.com/themoeway/yomitan-import) page to learn how to convert and import them into Yomitan.
Be aware that non-English dictionaries contain fewer entries than their English counterparts. Even if your primary
language is not English, you may consider also importing the English version for better coverage.
@@ -188,8 +188,8 @@ similar to the ones pictured below. These dictionaries are often sought after by
and excellent coverage of the Japanese language.
Unfortunately, as most of the dictionaries released in this format are proprietary, they are unable to be bundled with
-Yomitan. Instead, you will need to procure these dictionaries yourself and import them using [Yomichan
-Import](https://foosoft.net/projects/yomichan-import). Check the project page for additional details.
+Yomitan. Instead, you will need to procure these dictionaries yourself and import them using [Yomitan
+Import](https://github.com/themoeway/yomitan-import). Check the project page for additional details.
![Pocket EPWING dictionaries](img/epwing-devices.jpg)
diff --git a/dev/data/manifest-variants.json b/dev/data/manifest-variants.json
index c9e7cd03..1eae2112 100644
--- a/dev/data/manifest-variants.json
+++ b/dev/data/manifest-variants.json
@@ -81,7 +81,6 @@
"clipboardWrite",
"unlimitedStorage",
"declarativeNetRequest",
- "webRequest",
"scripting",
"offscreen"
],
@@ -172,6 +171,27 @@
]
},
{
+ "name": "chrome-playwright",
+ "inherit": "chrome-dev",
+ "fileName": "yomitan-chrome-playwright.zip",
+ "modifications": [
+ {
+ "action": "remove",
+ "path": [
+ "optional_permissions"
+ ],
+ "item": "clipboardRead"
+ },
+ {
+ "action": "add",
+ "path": [
+ "permissions"
+ ],
+ "items": ["clipboardRead"]
+ }
+ ]
+ },
+ {
"name": "firefox",
"inherit": "base",
"fileName": "yomitan-firefox.zip",
@@ -230,44 +250,15 @@
"gecko": {
"id": "{cb7c0bec-7085-4f84-8422-7b55a7c4467c}",
"strict_min_version": "115.0"
+ },
+ "gecko_android": {
+ "strict_min_version": "115.0"
}
}
},
{
"action": "remove",
"path": [
- "optional_permissions"
- ],
- "item": "nativeMessaging"
- },
- {
- "action": "add",
- "path": [
- "permissions"
- ],
- "items": [
- "nativeMessaging"
- ]
- },
- {
- "action": "add",
- "path": [
- "permissions"
- ],
- "items": [
- "webRequestBlocking"
- ]
- },
- {
- "action": "remove",
- "path": [
- "permissions"
- ],
- "item": "declarativeNetRequest"
- },
- {
- "action": "remove",
- "path": [
"permissions"
],
"item": "offscreen"
@@ -349,13 +340,6 @@
"path": [
"permissions"
],
- "item": "webRequestBlocking"
- },
- {
- "action": "remove",
- "path": [
- "permissions"
- ],
"item": "offscreen"
},
{
@@ -382,6 +366,9 @@
],
"excludeFiles": [
"sw.js",
+ "offscreen.html",
+ "js/background/offscreen.js",
+ "js/background/offscreen-main.js",
"js/dom/simple-dom-parser.js",
"lib/parse5.js"
]
diff --git a/docs/permissions.md b/docs/permissions.md
index 57f9f0b2..b2b1a34c 100644
--- a/docs/permissions.md
+++ b/docs/permissions.md
@@ -9,26 +9,16 @@
`unlimitedStorage` is used to help prevent web browsers from unexpectedly
deleting dictionary data.
-* `webRequest` <br>
- Yomichan uses this permission to collect audio or create Anki notes using
- [AnkiConnect](https://ankiweb.net/shared/info/2055492159).
- It is also required to surface error information from failed requests.
-
-* `webRequestBlocking` _(Firefox only)_ <br>
- Yomichan uses this permission to ensure certain requests have valid and secure headers.
- This sometimes involves removing or changing the `Origin` request header,
- as this can be used to fingerprint browser configuration.
-
-* `declarativeNetRequest` _(Chrome only)_ <br>
+* `declarativeNetRequest` <br>
Yomichan uses this permission to ensure certain requests have valid and secure headers.
This sometimes involves removing or changing the `Origin` request header,
as this can be used to fingerprint browser configuration.
-* `scripting` _(Manifest V3 only)_ <br>
- Yomichan will sometimes need to inject stylesheets into webpages in order to
+* `scripting` <br>
+ Yomichan needs to inject content scripts and stylesheets into webpages in order to
properly display the search popup.
-* `offscreen` __(Chrome only)_ <br>
+* `offscreen` _(Chrome only)_ <br>
Yomitan uses this permission to create a secondary backend document that has DOM access, given that Manifest v3
service workers do not. Service workers can then reach out to out to this document in order to complete
actions that require access to DOM APIs, such as any that require clipboard access.
@@ -37,15 +27,14 @@
Yomichan supports simulating the `Ctrl+C` (copy to clipboard) keyboard shortcut
when a definitions popup is open and focused.
-* `clipboardRead` (optional) <br>
+* `clipboardRead` _(optional)_ <br>
Yomichan supports automatically opening a search window when Japanese text is copied to the clipboard
while the browser is running, depending on how certain settings are configured.
This allows Yomichan to support scanning text from external applications, provided there is a way
to copy text from those applications to the clipboard.
-* `nativeMessaging` (optional on Chrome) <br>
+* `nativeMessaging` _(optional, unavailable on Firefox for Android)_ <br>
Yomichan has the ability to communicate with an optional native messaging component in order to support
parsing large blocks of Japanese text using
[MeCab](https://en.wikipedia.org/wiki/MeCab).
The installation of this component is optional and is not included by default.
- This permission is optional on Chrome, but required on Firefox, because Firefox does not permit it to be optional.
diff --git a/ext/js/background/request-builder.js b/ext/js/background/request-builder.js
index 663e242b..7ee89539 100644
--- a/ext/js/background/request-builder.js
+++ b/ext/js/background/request-builder.js
@@ -31,7 +31,6 @@ class RequestBuilder {
* Creates a new instance.
*/
constructor() {
- this._onBeforeSendHeadersExtraInfoSpec = ['blocking', 'requestHeaders', 'extraHeaders'];
this._textEncoder = new TextEncoder();
this._ruleIds = new Set();
}
@@ -42,6 +41,7 @@ class RequestBuilder {
async prepare() {
try {
await this._clearDynamicRules();
+ await this._clearSessionRules();
} catch (e) {
// NOP
}
@@ -54,15 +54,50 @@ class RequestBuilder {
* @returns {Promise<Response>} The response of the `fetch` call.
*/
async fetchAnonymous(url, init) {
- if (isObject(chrome.declarativeNetRequest)) {
- return await this._fetchAnonymousDeclarative(url, init);
+ const id = this._getNewRuleId();
+ const originUrl = this._getOriginURL(url);
+ url = encodeURI(decodeURI(url));
+
+ this._ruleIds.add(id);
+ try {
+ const addRules = [{
+ id,
+ priority: 1,
+ condition: {
+ urlFilter: `|${this._escapeDnrUrl(url)}|`,
+ resourceTypes: ['xmlhttprequest']
+ },
+ action: {
+ type: 'modifyHeaders',
+ requestHeaders: [
+ {
+ operation: 'remove',
+ header: 'Cookie'
+ },
+ {
+ operation: 'set',
+ header: 'Origin',
+ value: originUrl
+ }
+ ],
+ responseHeaders: [
+ {
+ operation: 'remove',
+ header: 'Set-Cookie'
+ }
+ ]
+ }
+ }];
+
+ await this._updateSessionRules({addRules});
+ try {
+ return await fetch(url, init);
+ } finally {
+ await this._tryUpdateSessionRules({removeRuleIds: [id]});
+ }
+ } finally {
+ this._ruleIds.delete(id);
}
- const originURL = this._getOriginURL(url);
- const headerModifications = [
- ['cookie', null],
- ['origin', {name: 'Origin', value: originURL}]
- ];
- return await this._fetchInternal(url, init, headerModifications);
}
/**
@@ -125,145 +160,56 @@ class RequestBuilder {
// Private
- async _fetchInternal(url, init, headerModifications) {
- const filter = {
- urls: [this._getMatchURL(url)],
- types: ['xmlhttprequest']
- };
-
- let requestId = null;
- const onBeforeSendHeadersCallback = (details) => {
- if (requestId !== null || details.url !== url) { return {}; }
- ({requestId} = details);
-
- if (headerModifications === null) { return {}; }
-
- const requestHeaders = details.requestHeaders;
- this._modifyHeaders(requestHeaders, headerModifications);
- return {requestHeaders};
- };
-
- let errorDetailsTimer = null;
- let {promise: errorDetailsPromise, resolve: errorDetailsResolve} = deferPromise();
- const onErrorOccurredCallback = (details) => {
- if (errorDetailsResolve === null || details.requestId !== requestId) { return; }
- if (errorDetailsTimer !== null) {
- clearTimeout(errorDetailsTimer);
- errorDetailsTimer = null;
- }
- errorDetailsResolve(details);
- errorDetailsResolve = null;
- };
-
- const eventListeners = [];
- const onBeforeSendHeadersExtraInfoSpec = (headerModifications !== null ? this._onBeforeSendHeadersExtraInfoSpec : []);
- this._addWebRequestEventListener(chrome.webRequest.onBeforeSendHeaders, onBeforeSendHeadersCallback, filter, onBeforeSendHeadersExtraInfoSpec, eventListeners);
- this._addWebRequestEventListener(chrome.webRequest.onErrorOccurred, onErrorOccurredCallback, filter, void 0, eventListeners);
+ async _clearSessionRules() {
+ const rules = await this._getSessionRules();
- try {
- return await fetch(url, init);
- } catch (e) {
- // onErrorOccurred is not always invoked by this point, so a delay is needed
- if (errorDetailsResolve !== null) {
- errorDetailsTimer = setTimeout(() => {
- errorDetailsTimer = null;
- if (errorDetailsResolve === null) { return; }
- errorDetailsResolve(null);
- errorDetailsResolve = null;
- }, 100);
- }
- const details = await errorDetailsPromise;
- if (details !== null) {
- const data = {details};
- this._assignErrorData(e, data);
- }
- throw e;
- } finally {
- this._removeWebRequestEventListeners(eventListeners);
- }
- }
+ if (rules.length === 0) { return; }
- _addWebRequestEventListener(target, callback, filter, extraInfoSpec, eventListeners) {
- try {
- for (let i = 0; i < 2; ++i) {
- try {
- if (typeof extraInfoSpec === 'undefined') {
- target.addListener(callback, filter);
- } else {
- target.addListener(callback, filter, extraInfoSpec);
- }
- break;
- } catch (e) {
- // Firefox doesn't support the 'extraHeaders' option and will throw the following error:
- // Type error for parameter extraInfoSpec (Error processing 2: Invalid enumeration value "extraHeaders") for [target].
- if (i === 0 && `${e.message}`.includes('extraHeaders') && Array.isArray(extraInfoSpec)) {
- const index = extraInfoSpec.indexOf('extraHeaders');
- if (index >= 0) {
- extraInfoSpec.splice(index, 1);
- continue;
- }
- }
- throw e;
- }
- }
- } catch (e) {
- console.log(e);
- return;
+ const removeRuleIds = [];
+ for (const {id} of rules) {
+ removeRuleIds.push(id);
}
- eventListeners.push({target, callback});
- }
- _removeWebRequestEventListeners(eventListeners) {
- for (const {target, callback} of eventListeners) {
- try {
- target.removeListener(callback);
- } catch (e) {
- console.log(e);
- }
- }
+ await this._updateSessionRules({removeRuleIds});
}
- _getMatchURL(url) {
- const url2 = new URL(url);
- return `${url2.protocol}//${url2.host}${url2.pathname}${url2.search}`.replace(/\*/g, '%2a');
+ _getSessionRules() {
+ return new Promise((resolve, reject) => {
+ chrome.declarativeNetRequest.getSessionRules((result) => {
+ const e = chrome.runtime.lastError;
+ if (e) {
+ reject(new Error(e.message));
+ } else {
+ resolve(result);
+ }
+ });
+ });
}
- _getOriginURL(url) {
- const url2 = new URL(url);
- return `${url2.protocol}//${url2.host}`;
+ _updateSessionRules(options) {
+ return new Promise((resolve, reject) => {
+ chrome.declarativeNetRequest.updateSessionRules(options, () => {
+ const e = chrome.runtime.lastError;
+ if (e) {
+ reject(new Error(e.message));
+ } else {
+ resolve();
+ }
+ });
+ });
}
- _modifyHeaders(headers, modifications) {
- modifications = new Map(modifications);
-
- for (let i = 0, ii = headers.length; i < ii; ++i) {
- const header = headers[i];
- const name = header.name.toLowerCase();
- const modification = modifications.get(name);
- if (typeof modification === 'undefined') { continue; }
-
- modifications.delete(name);
-
- if (modification === null) {
- headers.splice(i, 1);
- --i;
- --ii;
- } else {
- headers[i] = modification;
- }
- }
-
- for (const header of modifications.values()) {
- if (header !== null) {
- headers.push(header);
- }
+ async _tryUpdateSessionRules(options) {
+ try {
+ await this._updateSessionRules(options);
+ return true;
+ } catch (e) {
+ return false;
}
}
async _clearDynamicRules() {
- if (!isObject(chrome.declarativeNetRequest)) { return; }
-
- const rules = this._getDynamicRules();
+ const rules = await this._getDynamicRules();
if (rules.length === 0) { return; }
@@ -275,53 +221,6 @@ class RequestBuilder {
await this._updateDynamicRules({removeRuleIds});
}
- async _fetchAnonymousDeclarative(url, init) {
- const id = this._getNewRuleId();
- const originUrl = this._getOriginURL(url);
- url = encodeURI(decodeURI(url));
-
- this._ruleIds.add(id);
- try {
- const addRules = [{
- id,
- priority: 1,
- condition: {
- urlFilter: `|${this._escapeDnrUrl(url)}|`,
- resourceTypes: ['xmlhttprequest']
- },
- action: {
- type: 'modifyHeaders',
- requestHeaders: [
- {
- operation: 'remove',
- header: 'Cookie'
- },
- {
- operation: 'set',
- header: 'Origin',
- value: originUrl
- }
- ],
- responseHeaders: [
- {
- operation: 'remove',
- header: 'Set-Cookie'
- }
- ]
- }
- }];
-
- await this._updateDynamicRules({addRules});
- try {
- return await this._fetchInternal(url, init, null);
- } finally {
- await this._tryUpdateDynamicRules({removeRuleIds: [id]});
- }
- } finally {
- this._ruleIds.delete(id);
- }
- }
-
_getDynamicRules() {
return new Promise((resolve, reject) => {
chrome.declarativeNetRequest.getDynamicRules((result) => {
@@ -348,15 +247,6 @@ class RequestBuilder {
});
}
- async _tryUpdateDynamicRules(options) {
- try {
- await this._updateDynamicRules(options);
- return true;
- } catch (e) {
- return false;
- }
- }
-
_getNewRuleId() {
let id = 1;
while (this._ruleIds.has(id)) {
@@ -367,6 +257,11 @@ class RequestBuilder {
return id;
}
+ _getOriginURL(url) {
+ const url2 = new URL(url);
+ return `${url2.protocol}//${url2.host}`;
+ }
+
_escapeDnrUrl(url) {
return url.replace(/[|*^]/g, (char) => this._urlEncodeUtf8(char));
}
@@ -380,25 +275,6 @@ class RequestBuilder {
return result;
}
- _assignErrorData(error, data) {
- try {
- error.data = data;
- } catch (e) {
- // On Firefox, assigning DOMException.data can fail in certain contexts.
- // https://bugzilla.mozilla.org/show_bug.cgi?id=1776555
- try {
- Object.defineProperty(error, 'data', {
- configurable: true,
- enumerable: true,
- writable: true,
- value: data
- });
- } catch (e2) {
- // NOP
- }
- }
- }
-
static _joinUint8Arrays(items, totalLength) {
if (items.length === 1) {
const {array, length} = items[0];
diff --git a/ext/js/extension/environment.js b/ext/js/extension/environment.js
index ec1e8612..ad5a19ae 100644
--- a/ext/js/extension/environment.js
+++ b/ext/js/extension/environment.js
@@ -31,8 +31,9 @@ class Environment {
}
async _loadEnvironmentInfo() {
- const browser = await this._getBrowser();
const os = await this._getOperatingSystem();
+ const browser = await this._getBrowser(os);
+
return {
browser,
platform: {os}
@@ -64,7 +65,7 @@ class Environment {
});
}
- async _getBrowser() {
+ async _getBrowser(os) {
try {
if (chrome.runtime.getURL('/').startsWith('ms-browser-extension://')) {
return 'edge-legacy';
@@ -76,17 +77,12 @@ class Environment {
// NOP
}
if (typeof browser !== 'undefined') {
- try {
- const info = await browser.runtime.getBrowserInfo();
- if (info.name === 'Fennec') {
- return 'firefox-mobile';
- }
- } catch (e) {
- // NOP
- }
if (this._isSafari()) {
return 'safari';
}
+ if (os === 'android') {
+ return 'firefox-mobile';
+ }
return 'firefox';
} else {
return 'chrome';
diff --git a/ext/permissions.html b/ext/permissions.html
index 9ede7d27..376a9de5 100644
--- a/ext/permissions.html
+++ b/ext/permissions.html
@@ -49,33 +49,6 @@
</div></div>
<div class="settings-item"><div class="settings-item-inner">
<div class="settings-item-left">
- <div class="settings-item-label"><code>webRequest</code></div>
- <div class="settings-item-description">
- <p>
- Yomitan uses this permission to collect audio or create Anki notes using
- <a href="https://ankiweb.net/shared/info/2055492159" target="_blank" rel="noopener noreferrer">AnkiConnect</a>.
- It is also required to surface error information from failed requests.
- </p>
- </div>
- </div>
- </div></div>
- <div class="settings-item" data-show-for-browser="firefox firefox-mobile"><div class="settings-item-inner">
- <div class="settings-item-left">
- <div class="settings-item-label"><code>webRequestBlocking</code></div>
- <div class="settings-item-description">
- <p>
- Yomitan uses this permission to ensure certain requests have valid and secure headers.
- This sometimes involves removing or changing the <code>Origin</code> request header,
- as this can be used to fingerprint browser configuration.
- </p>
- <p>
- Example: <code class="overflow-wrap">Origin: <span class="extension-id-example"></span></code>
- </p>
- </div>
- </div>
- </div></div>
- <div class="settings-item" data-show-for-browser="chrome edge"><div class="settings-item-inner">
- <div class="settings-item-left">
<div class="settings-item-label"><code>declarativeNetRequest</code></div>
<div class="settings-item-description">
<p>
@@ -89,11 +62,11 @@
</div>
</div>
</div></div>
- <div class="settings-item" data-show-for-manifest-version="3"><div class="settings-item-inner">
+ <div class="settings-item"><div class="settings-item-inner">
<div class="settings-item-left">
<div class="settings-item-label"><code>scripting</code></div>
<div class="settings-item-description">
- Yomitan will sometimes need to inject stylesheets into webpages in order to
+ Yomitan needs to inject content scripts and stylesheets into webpages in order to
properly display the search popup.
</div>
</div>
@@ -121,9 +94,9 @@
<label class="toggle"><input type="checkbox" class="permissions-toggle" data-required-permissions="clipboardRead"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label>
</div>
</div></div>
- <div class="settings-item"><div class="settings-item-inner">
+ <div class="settings-item" data-hide-for-browser="firefox-mobile"><div class="settings-item-inner">
<div class="settings-item-left">
- <div class="settings-item-label"><code>nativeMessaging</code> <span class="light" data-show-for-browser="chrome edge">(optional)</span></div>
+ <div class="settings-item-label"><code>nativeMessaging</code> <span class="light">(optional)</span></div>
<div class="settings-item-description">
Yomitan has the ability to communicate with an optional native messaging component in order to support
parsing large blocks of Japanese text using
@@ -135,18 +108,6 @@
<label class="toggle"><input type="checkbox" class="permissions-toggle" data-required-permissions="nativeMessaging"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label>
</div>
</div></div>
- <div class="settings-item" data-hide-for-manifest-version="3"><div class="settings-item-inner">
- <div class="settings-item-left">
- <div class="settings-item-label"><code>webNavigation</code> <span class="light">(optional)</span></div>
- <div class="settings-item-description">
- Yomitan may require this permission to inject content scripts for certain browsers
- if Google Docs accessibility mode is enabled.
- </div>
- </div>
- <div class="settings-item-right">
- <label class="toggle"><input type="checkbox" class="permissions-toggle" data-required-permissions="webNavigation"><span class="toggle-body"><span class="toggle-track"></span><span class="toggle-knob"></span></span></label>
- </div>
- </div></div>
<div class="settings-item"><div class="settings-item-inner">
<div class="settings-item-left">
<div class="settings-item-label">Allow in private windows <span class="light">(optional)</span></div>
diff --git a/ext/settings.html b/ext/settings.html
index f1001f90..8d5f0a76 100644
--- a/ext/settings.html
+++ b/ext/settings.html
@@ -1372,7 +1372,7 @@
</p>
</div>
</div>
- <div class="settings-item advanced-only">
+ <div class="settings-item advanced-only" data-hide-for-browser="firefox-mobile">
<div class="settings-item-inner">
<div class="settings-item-left">
<div class="settings-item-invalid-indicator"></div>
diff --git a/package-lock.json b/package-lock.json
index 61b77b09..24e49c86 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -10,20 +10,20 @@
"hasInstallScript": true,
"license": "GPL-3.0-or-later",
"devDependencies": {
- "@playwright/test": "^1.38.1",
+ "@playwright/test": "^1.39.0",
"ajv": "^8.11.0",
"browserify": "^17.0.0",
"css": "^3.0.0",
- "eslint": "^8.50.0",
+ "eslint": "^8.52.0",
"eslint-plugin-header": "^3.1.1",
"eslint-plugin-jsdoc": "^46.8.2",
- "eslint-plugin-jsonc": "^2.9.0",
+ "eslint-plugin-jsonc": "^2.10.0",
"eslint-plugin-no-unsanitized": "^4.0.1",
- "fake-indexeddb": "^4.0.2",
- "html-validate": "^8.5.0",
+ "fake-indexeddb": "^5.0.1",
+ "html-validate": "^8.7.0",
"jsdom": "^22.1.0",
"parse5": "^7.1.2",
- "stylelint": "^15.10.3",
+ "stylelint": "^15.11.0",
"stylelint-config-recommended": "^13.0.0"
}
},
@@ -312,9 +312,9 @@
"dev": true
},
"node_modules/@eslint/js": {
- "version": "8.50.0",
- "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.50.0.tgz",
- "integrity": "sha512-NCC3zz2+nvYd+Ckfh87rA47zfu2QsQpvc6k1yzTk+b9KzRj0wkGa8LSoGOXN6Zv4lRf/EIoZ80biDh9HOI+RNQ==",
+ "version": "8.52.0",
+ "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.52.0.tgz",
+ "integrity": "sha512-mjZVbpaeMZludF2fsWLD0Z9gCref1Tk4i9+wddjRvpUNqqcndPkBD09N/Mapey0b3jaXbLm2kICwFv2E64QinA==",
"dev": true,
"engines": {
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
@@ -333,12 +333,12 @@
}
},
"node_modules/@humanwhocodes/config-array": {
- "version": "0.11.11",
- "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.11.tgz",
- "integrity": "sha512-N2brEuAadi0CcdeMXUkhbZB84eskAc8MEX1By6qEchoVywSgXPIjou4rYsl0V3Hj0ZnuGycGCjdNgockbzeWNA==",
+ "version": "0.11.13",
+ "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.13.tgz",
+ "integrity": "sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==",
"dev": true,
"dependencies": {
- "@humanwhocodes/object-schema": "^1.2.1",
+ "@humanwhocodes/object-schema": "^2.0.1",
"debug": "^4.1.1",
"minimatch": "^3.0.5"
},
@@ -360,9 +360,9 @@
}
},
"node_modules/@humanwhocodes/object-schema": {
- "version": "1.2.1",
- "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz",
- "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==",
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz",
+ "integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==",
"dev": true
},
"node_modules/@isaacs/cliui": {
@@ -478,12 +478,12 @@
}
},
"node_modules/@playwright/test": {
- "version": "1.38.1",
- "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.38.1.tgz",
- "integrity": "sha512-NqRp8XMwj3AK+zKLbZShl0r/9wKgzqI/527bkptKXomtuo+dOjU9NdMASQ8DNC9z9zLOMbG53T4eihYr3XR+BQ==",
+ "version": "1.39.0",
+ "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.39.0.tgz",
+ "integrity": "sha512-3u1iFqgzl7zr004bGPYiN/5EZpRUSFddQBra8Rqll5N0/vfpqlP9I9EXqAoGacuAbX6c9Ulg/Cjqglp5VkK6UQ==",
"dev": true,
"dependencies": {
- "playwright": "1.38.1"
+ "playwright": "1.39.0"
},
"bin": {
"playwright": "cli.js"
@@ -529,6 +529,12 @@
"integrity": "sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==",
"dev": true
},
+ "node_modules/@ungap/structured-clone": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz",
+ "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==",
+ "dev": true
+ },
"node_modules/abab": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz",
@@ -761,15 +767,6 @@
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
"dev": true
},
- "node_modules/base64-arraybuffer-es6": {
- "version": "0.7.0",
- "resolved": "https://registry.npmjs.org/base64-arraybuffer-es6/-/base64-arraybuffer-es6-0.7.0.tgz",
- "integrity": "sha512-ESyU/U1CFZDJUdr+neHRhNozeCv72Y7Vm0m1DCbjX3KBjT6eYocvAJlSk6+8+HkVwXlT1FNxhGW6q3UKAlCvvw==",
- "dev": true,
- "engines": {
- "node": ">=6.0.0"
- }
- },
"node_modules/base64-js": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
@@ -791,9 +788,9 @@
]
},
"node_modules/bn.js": {
- "version": "5.2.0",
- "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz",
- "integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==",
+ "version": "5.2.1",
+ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz",
+ "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==",
"dev": true
},
"node_modules/brace-expansion": {
@@ -960,26 +957,29 @@
}
},
"node_modules/browserify-sign": {
- "version": "4.2.1",
- "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.1.tgz",
- "integrity": "sha512-/vrA5fguVAKKAVTNJjgSm1tRQDHUU6DbwO9IROu/0WAzC8PKhucDSh18J0RMvVeHAn5puMd+QHC2erPRNf8lmg==",
+ "version": "4.2.2",
+ "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.2.tgz",
+ "integrity": "sha512-1rudGyeYY42Dk6texmv7c4VcQ0EsvVbLwZkA+AQB7SxvXxmcD93jcHie8bzecJ+ChDlmAm2Qyu0+Ccg5uhZXCg==",
"dev": true,
"dependencies": {
- "bn.js": "^5.1.1",
- "browserify-rsa": "^4.0.1",
+ "bn.js": "^5.2.1",
+ "browserify-rsa": "^4.1.0",
"create-hash": "^1.2.0",
"create-hmac": "^1.1.7",
- "elliptic": "^6.5.3",
+ "elliptic": "^6.5.4",
"inherits": "^2.0.4",
- "parse-asn1": "^5.1.5",
- "readable-stream": "^3.6.0",
- "safe-buffer": "^5.2.0"
+ "parse-asn1": "^5.1.6",
+ "readable-stream": "^3.6.2",
+ "safe-buffer": "^5.2.1"
+ },
+ "engines": {
+ "node": ">= 4"
}
},
"node_modules/browserify-sign/node_modules/readable-stream": {
- "version": "3.6.0",
- "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
- "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
+ "version": "3.6.2",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
+ "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
"dev": true,
"dependencies": {
"inherits": "^2.0.3",
@@ -1346,12 +1346,12 @@
}
},
"node_modules/css-functions-list": {
- "version": "3.2.0",
- "resolved": "https://registry.npmjs.org/css-functions-list/-/css-functions-list-3.2.0.tgz",
- "integrity": "sha512-d/jBMPyYybkkLVypgtGv12R+pIFw4/f/IHtCTxWpZc8ofTYOPigIgmA6vu5rMHartZC+WuXhBUHfnyNUIQSYrg==",
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/css-functions-list/-/css-functions-list-3.2.1.tgz",
+ "integrity": "sha512-Nj5YcaGgBtuUmn1D7oHqPW0c9iui7xsTsj5lIX8ZgevdfhmjFfKB3r8moHJtNJnctnYXJyYX5I1pp90HM4TPgQ==",
"dev": true,
"engines": {
- "node": ">=12.22"
+ "node": ">=12 || >=16"
}
},
"node_modules/css-tree": {
@@ -1772,18 +1772,19 @@
}
},
"node_modules/eslint": {
- "version": "8.50.0",
- "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.50.0.tgz",
- "integrity": "sha512-FOnOGSuFuFLv/Sa+FDVRZl4GGVAAFFi8LecRsI5a1tMO5HIE8nCm4ivAlzt4dT3ol/PaaGC0rJEEXQmHJBGoOg==",
+ "version": "8.52.0",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.52.0.tgz",
+ "integrity": "sha512-zh/JHnaixqHZsolRB/w9/02akBk9EPrOs9JwcTP2ek7yL5bVvXuRariiaAjjoJ5DvuwQ1WAE/HsMz+w17YgBCg==",
"dev": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.2.0",
"@eslint-community/regexpp": "^4.6.1",
"@eslint/eslintrc": "^2.1.2",
- "@eslint/js": "8.50.0",
- "@humanwhocodes/config-array": "^0.11.11",
+ "@eslint/js": "8.52.0",
+ "@humanwhocodes/config-array": "^0.11.13",
"@humanwhocodes/module-importer": "^1.0.1",
"@nodelib/fs.walk": "^1.2.8",
+ "@ungap/structured-clone": "^1.2.0",
"ajv": "^6.12.4",
"chalk": "^4.0.0",
"cross-spawn": "^7.0.2",
@@ -1825,6 +1826,18 @@
"url": "https://opencollective.com/eslint"
}
},
+ "node_modules/eslint-compat-utils": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/eslint-compat-utils/-/eslint-compat-utils-0.1.2.tgz",
+ "integrity": "sha512-Jia4JDldWnFNIru1Ehx1H5s9/yxiRHY/TimCuUc0jNexew3cF1gI6CYZil1ociakfWO3rRqFjl1mskBblB3RYg==",
+ "dev": true,
+ "engines": {
+ "node": ">=12"
+ },
+ "peerDependencies": {
+ "eslint": ">=6.0.0"
+ }
+ },
"node_modules/eslint-plugin-header": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-header/-/eslint-plugin-header-3.1.1.tgz",
@@ -1858,12 +1871,13 @@
}
},
"node_modules/eslint-plugin-jsonc": {
- "version": "2.9.0",
- "resolved": "https://registry.npmjs.org/eslint-plugin-jsonc/-/eslint-plugin-jsonc-2.9.0.tgz",
- "integrity": "sha512-RK+LeONVukbLwT2+t7/OY54NJRccTXh/QbnXzPuTLpFMVZhPuq1C9E07+qWenGx7rrQl0kAalAWl7EmB+RjpGA==",
+ "version": "2.10.0",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-jsonc/-/eslint-plugin-jsonc-2.10.0.tgz",
+ "integrity": "sha512-9d//o6Jyh4s1RxC9fNSt1+MMaFN2ruFdXPG9XZcb/mR2KkfjADYiNL/hbU6W0Cyxfg3tS/XSFuhl5LgtMD8hmw==",
"dev": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.2.0",
+ "eslint-compat-utils": "^0.1.2",
"jsonc-eslint-parser": "^2.0.4",
"natural-compare": "^1.4.0"
},
@@ -2015,12 +2029,12 @@
}
},
"node_modules/fake-indexeddb": {
- "version": "4.0.2",
- "resolved": "https://registry.npmjs.org/fake-indexeddb/-/fake-indexeddb-4.0.2.tgz",
- "integrity": "sha512-SdTwEhnakbgazc7W3WUXOJfGmhH0YfG4d+dRPOFoYDRTL6U5t8tvrmkf2W/C3W1jk2ylV7Wrnj44RASqpX/lEw==",
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/fake-indexeddb/-/fake-indexeddb-5.0.1.tgz",
+ "integrity": "sha512-vxybH29Owtc6khV/Usy47B1g+eKwyhFiX8nwpCC4td320jvwrKQDH6vNtcJZgUzVxmfsSIlHzLKQzT76JMCO7A==",
"dev": true,
- "dependencies": {
- "realistic-structured-clone": "^3.0.0"
+ "engines": {
+ "node": ">=18"
}
},
"node_modules/fast-deep-equal": {
@@ -2134,22 +2148,23 @@
}
},
"node_modules/flat-cache": {
- "version": "3.0.4",
- "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz",
- "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==",
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.1.1.tgz",
+ "integrity": "sha512-/qM2b3LUIaIgviBQovTLvijfyOQXPtSRnRK26ksj2J7rzPIecePUIpJsZ4T02Qg+xiAEKIs5K8dsHEd+VaKa/Q==",
"dev": true,
"dependencies": {
- "flatted": "^3.1.0",
+ "flatted": "^3.2.9",
+ "keyv": "^4.5.3",
"rimraf": "^3.0.2"
},
"engines": {
- "node": "^10.12.0 || >=12.0.0"
+ "node": ">=12.0.0"
}
},
"node_modules/flatted": {
- "version": "3.2.5",
- "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.5.tgz",
- "integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==",
+ "version": "3.2.9",
+ "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.9.tgz",
+ "integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==",
"dev": true
},
"node_modules/foreach": {
@@ -2531,18 +2546,18 @@
}
},
"node_modules/html-validate": {
- "version": "8.5.0",
- "resolved": "https://registry.npmjs.org/html-validate/-/html-validate-8.5.0.tgz",
- "integrity": "sha512-EiRJ7mqRZb68DgxyMlA+5uVheCuNYZiXnoSajcdSTK8IcNuPpyeSI0CZu9wK1jE6jQrWnf8myIa5JkjDByHPuw==",
+ "version": "8.7.0",
+ "resolved": "https://registry.npmjs.org/html-validate/-/html-validate-8.7.0.tgz",
+ "integrity": "sha512-fsDHUxzVNzXzV2KpPOx5GbGRCK0cFs7a8+9jE5QTyYUGAlm1PNGst8Vi0U7hSmootkCBxY3bu7LgQBjjZDeBPw==",
"dev": true,
"dependencies": {
"@babel/code-frame": "^7.10.0",
"@html-validate/stylish": "^4.1.0",
"@sidvind/better-ajv-errors": "^2.0.0",
"ajv": "^8.0.0",
- "deepmerge": "^4.2.0",
+ "deepmerge": "4.3.1",
"glob": "^10.0.0",
- "ignore": "^5.0.0",
+ "ignore": "5.2.4",
"kleur": "^4.1.0",
"minimist": "^1.2.0",
"prompts": "^2.0.0",
@@ -3216,6 +3231,12 @@
}
}
},
+ "node_modules/json-buffer": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz",
+ "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==",
+ "dev": true
+ },
"node_modules/json-parse-even-better-errors": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz",
@@ -3277,6 +3298,15 @@
"node": "*"
}
},
+ "node_modules/keyv": {
+ "version": "4.5.4",
+ "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz",
+ "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==",
+ "dev": true,
+ "dependencies": {
+ "json-buffer": "3.0.1"
+ }
+ },
"node_modules/kind-of": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
@@ -3296,9 +3326,9 @@
}
},
"node_modules/known-css-properties": {
- "version": "0.28.0",
- "resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.28.0.tgz",
- "integrity": "sha512-9pSL5XB4J+ifHP0e0jmmC98OGC1nL8/JjS+fi6mnTlIf//yt/MfVLtKg7S6nCtj/8KTcWX7nRlY0XywoYY1ISQ==",
+ "version": "0.29.0",
+ "resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.29.0.tgz",
+ "integrity": "sha512-Ne7wqW7/9Cz54PDt4I3tcV+hAyat8ypyOGzYRJQfdxnnjeWsTxt1cy8pjvvKeI5kfXuyvULyeeAvwvvtAX3ayQ==",
"dev": true
},
"node_modules/labeled-stream-splicer": {
@@ -3345,12 +3375,6 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
- "node_modules/lodash": {
- "version": "4.17.21",
- "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
- "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
- "dev": true
- },
"node_modules/lodash.memoize": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-3.0.4.tgz",
@@ -3971,12 +3995,12 @@
}
},
"node_modules/playwright": {
- "version": "1.38.1",
- "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.38.1.tgz",
- "integrity": "sha512-oRMSJmZrOu1FP5iu3UrCx8JEFRIMxLDM0c/3o4bpzU5Tz97BypefWf7TuTNPWeCe279TPal5RtPPZ+9lW/Qkow==",
+ "version": "1.39.0",
+ "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.39.0.tgz",
+ "integrity": "sha512-naE5QT11uC/Oiq0BwZ50gDmy8c8WLPRTEWuSSFVG2egBka/1qMoSqYQcROMT9zLwJ86oPofcTH2jBY/5wWOgIw==",
"dev": true,
"dependencies": {
- "playwright-core": "1.38.1"
+ "playwright-core": "1.39.0"
},
"bin": {
"playwright": "cli.js"
@@ -3989,9 +4013,9 @@
}
},
"node_modules/playwright-core": {
- "version": "1.38.1",
- "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.38.1.tgz",
- "integrity": "sha512-tQqNFUKa3OfMf4b2jQ7aGLB8o9bS3bOY0yMEtldtC2+spf8QXG9zvXLTXUeRsoNuxEYMgLYR+NXfAa1rjKRcrg==",
+ "version": "1.39.0",
+ "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.39.0.tgz",
+ "integrity": "sha512-+k4pdZgs1qiM+OUkSjx96YiKsXsmb59evFoqv8SKO067qBA+Z2s/dCzJij/ZhdQcs2zlTAgRKfeiiLm8PQ2qvw==",
"dev": true,
"bin": {
"playwright-core": "cli.js"
@@ -4321,32 +4345,6 @@
"safe-buffer": "~5.1.0"
}
},
- "node_modules/realistic-structured-clone": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/realistic-structured-clone/-/realistic-structured-clone-3.0.0.tgz",
- "integrity": "sha512-rOjh4nuWkAqf9PWu6JVpOWD4ndI+JHfgiZeMmujYcPi+fvILUu7g6l26TC1K5aBIp34nV+jE1cDO75EKOfHC5Q==",
- "dev": true,
- "dependencies": {
- "domexception": "^1.0.1",
- "typeson": "^6.1.0",
- "typeson-registry": "^1.0.0-alpha.20"
- }
- },
- "node_modules/realistic-structured-clone/node_modules/domexception": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/domexception/-/domexception-1.0.1.tgz",
- "integrity": "sha512-raigMkn7CJNNo6Ihro1fzG7wr3fHuYVytzquZKX5n0yizGsTcYgzdIUwj1X9pK0VvjeihV+XiclP+DjwbsSKug==",
- "dev": true,
- "dependencies": {
- "webidl-conversions": "^4.0.2"
- }
- },
- "node_modules/realistic-structured-clone/node_modules/webidl-conversions": {
- "version": "4.0.2",
- "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz",
- "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==",
- "dev": true
- },
"node_modules/redent": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/redent/-/redent-4.0.0.tgz",
@@ -4890,9 +4888,9 @@
"dev": true
},
"node_modules/stylelint": {
- "version": "15.10.3",
- "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-15.10.3.tgz",
- "integrity": "sha512-aBQMMxYvFzJJwkmg+BUUg3YfPyeuCuKo2f+LOw7yYbU8AZMblibwzp9OV4srHVeQldxvSFdz0/Xu8blq2AesiA==",
+ "version": "15.11.0",
+ "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-15.11.0.tgz",
+ "integrity": "sha512-78O4c6IswZ9TzpcIiQJIN49K3qNoXTM8zEJzhaTE/xRTCZswaovSEVIa/uwbOltZrk16X4jAxjaOhzz/hTm1Kw==",
"dev": true,
"dependencies": {
"@csstools/css-parser-algorithms": "^2.3.1",
@@ -4902,12 +4900,12 @@
"balanced-match": "^2.0.0",
"colord": "^2.9.3",
"cosmiconfig": "^8.2.0",
- "css-functions-list": "^3.2.0",
+ "css-functions-list": "^3.2.1",
"css-tree": "^2.3.1",
"debug": "^4.3.4",
"fast-glob": "^3.3.1",
"fastest-levenshtein": "^1.0.16",
- "file-entry-cache": "^6.0.1",
+ "file-entry-cache": "^7.0.0",
"global-modules": "^2.0.0",
"globby": "^11.1.0",
"globjoin": "^0.1.4",
@@ -4916,13 +4914,13 @@
"import-lazy": "^4.0.0",
"imurmurhash": "^0.1.4",
"is-plain-object": "^5.0.0",
- "known-css-properties": "^0.28.0",
+ "known-css-properties": "^0.29.0",
"mathml-tag-names": "^2.1.3",
"meow": "^10.1.5",
"micromatch": "^4.0.5",
"normalize-path": "^3.0.0",
"picocolors": "^1.0.0",
- "postcss": "^8.4.27",
+ "postcss": "^8.4.28",
"postcss-resolve-nested-selector": "^0.1.1",
"postcss-safe-parser": "^6.0.0",
"postcss-selector-parser": "^6.0.13",
@@ -4965,6 +4963,18 @@
"integrity": "sha512-1ugUSr8BHXRnK23KfuYS+gVMC3LB8QGH9W1iGtDPsNWoQbgtXSExkBu2aDR4epiGWZOjZsj6lDl/N/AqqTC3UA==",
"dev": true
},
+ "node_modules/stylelint/node_modules/file-entry-cache": {
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-7.0.1.tgz",
+ "integrity": "sha512-uLfFktPmRetVCbHe5UPuekWrQ6hENufnA46qEGbfACkK5drjTTdQYUragRgMjHldcbYG+nslUerqMPjbBSHXjQ==",
+ "dev": true,
+ "dependencies": {
+ "flat-cache": "^3.1.1"
+ },
+ "engines": {
+ "node": ">=12.0.0"
+ }
+ },
"node_modules/stylelint/node_modules/resolve-from": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz",
@@ -5196,73 +5206,6 @@
"integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=",
"dev": true
},
- "node_modules/typeson": {
- "version": "6.1.0",
- "resolved": "https://registry.npmjs.org/typeson/-/typeson-6.1.0.tgz",
- "integrity": "sha512-6FTtyGr8ldU0pfbvW/eOZrEtEkczHRUtduBnA90Jh9kMPCiFNnXIon3vF41N0S4tV1HHQt4Hk1j4srpESziCaA==",
- "dev": true,
- "engines": {
- "node": ">=0.1.14"
- }
- },
- "node_modules/typeson-registry": {
- "version": "1.0.0-alpha.39",
- "resolved": "https://registry.npmjs.org/typeson-registry/-/typeson-registry-1.0.0-alpha.39.tgz",
- "integrity": "sha512-NeGDEquhw+yfwNhguLPcZ9Oj0fzbADiX4R0WxvoY8nGhy98IbzQy1sezjoEFWOywOboj/DWehI+/aUlRVrJnnw==",
- "dev": true,
- "dependencies": {
- "base64-arraybuffer-es6": "^0.7.0",
- "typeson": "^6.0.0",
- "whatwg-url": "^8.4.0"
- },
- "engines": {
- "node": ">=10.0.0"
- }
- },
- "node_modules/typeson-registry/node_modules/punycode": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
- "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==",
- "dev": true,
- "engines": {
- "node": ">=6"
- }
- },
- "node_modules/typeson-registry/node_modules/tr46": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/tr46/-/tr46-2.1.0.tgz",
- "integrity": "sha512-15Ih7phfcdP5YxqiB+iDtLoaTz4Nd35+IiAv0kQ5FNKHzXgdWqPoTIqEDDJmXceQt4JZk6lVPT8lnDlPpGDppw==",
- "dev": true,
- "dependencies": {
- "punycode": "^2.1.1"
- },
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/typeson-registry/node_modules/webidl-conversions": {
- "version": "6.1.0",
- "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-6.1.0.tgz",
- "integrity": "sha512-qBIvFLGiBpLjfwmYAaHPXsn+ho5xZnGvyGvsarywGNc8VyQJUMHJ8OBKGGrPER0okBeMDaan4mNBlgBROxuI8w==",
- "dev": true,
- "engines": {
- "node": ">=10.4"
- }
- },
- "node_modules/typeson-registry/node_modules/whatwg-url": {
- "version": "8.7.0",
- "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-8.7.0.tgz",
- "integrity": "sha512-gAojqb/m9Q8a5IV96E3fHJM70AzCkgt4uXYX2O7EmuyOnLrViCQlsEBmF9UQIu3/aeAIp2U17rtbpZWNntQqdg==",
- "dev": true,
- "dependencies": {
- "lodash": "^4.7.0",
- "tr46": "^2.1.0",
- "webidl-conversions": "^6.1.0"
- },
- "engines": {
- "node": ">=10"
- }
- },
"node_modules/umd": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/umd/-/umd-3.0.3.tgz",
@@ -5893,9 +5836,9 @@
}
},
"@eslint/js": {
- "version": "8.50.0",
- "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.50.0.tgz",
- "integrity": "sha512-NCC3zz2+nvYd+Ckfh87rA47zfu2QsQpvc6k1yzTk+b9KzRj0wkGa8LSoGOXN6Zv4lRf/EIoZ80biDh9HOI+RNQ==",
+ "version": "8.52.0",
+ "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.52.0.tgz",
+ "integrity": "sha512-mjZVbpaeMZludF2fsWLD0Z9gCref1Tk4i9+wddjRvpUNqqcndPkBD09N/Mapey0b3jaXbLm2kICwFv2E64QinA==",
"dev": true
},
"@html-validate/stylish": {
@@ -5908,12 +5851,12 @@
}
},
"@humanwhocodes/config-array": {
- "version": "0.11.11",
- "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.11.tgz",
- "integrity": "sha512-N2brEuAadi0CcdeMXUkhbZB84eskAc8MEX1By6qEchoVywSgXPIjou4rYsl0V3Hj0ZnuGycGCjdNgockbzeWNA==",
+ "version": "0.11.13",
+ "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.13.tgz",
+ "integrity": "sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==",
"dev": true,
"requires": {
- "@humanwhocodes/object-schema": "^1.2.1",
+ "@humanwhocodes/object-schema": "^2.0.1",
"debug": "^4.1.1",
"minimatch": "^3.0.5"
}
@@ -5925,9 +5868,9 @@
"dev": true
},
"@humanwhocodes/object-schema": {
- "version": "1.2.1",
- "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz",
- "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==",
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz",
+ "integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==",
"dev": true
},
"@isaacs/cliui": {
@@ -6012,12 +5955,12 @@
"optional": true
},
"@playwright/test": {
- "version": "1.38.1",
- "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.38.1.tgz",
- "integrity": "sha512-NqRp8XMwj3AK+zKLbZShl0r/9wKgzqI/527bkptKXomtuo+dOjU9NdMASQ8DNC9z9zLOMbG53T4eihYr3XR+BQ==",
+ "version": "1.39.0",
+ "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.39.0.tgz",
+ "integrity": "sha512-3u1iFqgzl7zr004bGPYiN/5EZpRUSFddQBra8Rqll5N0/vfpqlP9I9EXqAoGacuAbX6c9Ulg/Cjqglp5VkK6UQ==",
"dev": true,
"requires": {
- "playwright": "1.38.1"
+ "playwright": "1.39.0"
}
},
"@sidvind/better-ajv-errors": {
@@ -6048,6 +5991,12 @@
"integrity": "sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==",
"dev": true
},
+ "@ungap/structured-clone": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz",
+ "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==",
+ "dev": true
+ },
"abab": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz",
@@ -6229,12 +6178,6 @@
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
"dev": true
},
- "base64-arraybuffer-es6": {
- "version": "0.7.0",
- "resolved": "https://registry.npmjs.org/base64-arraybuffer-es6/-/base64-arraybuffer-es6-0.7.0.tgz",
- "integrity": "sha512-ESyU/U1CFZDJUdr+neHRhNozeCv72Y7Vm0m1DCbjX3KBjT6eYocvAJlSk6+8+HkVwXlT1FNxhGW6q3UKAlCvvw==",
- "dev": true
- },
"base64-js": {
"version": "1.5.1",
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
@@ -6242,9 +6185,9 @@
"dev": true
},
"bn.js": {
- "version": "5.2.0",
- "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz",
- "integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==",
+ "version": "5.2.1",
+ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz",
+ "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==",
"dev": true
},
"brace-expansion": {
@@ -6399,26 +6342,26 @@
}
},
"browserify-sign": {
- "version": "4.2.1",
- "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.1.tgz",
- "integrity": "sha512-/vrA5fguVAKKAVTNJjgSm1tRQDHUU6DbwO9IROu/0WAzC8PKhucDSh18J0RMvVeHAn5puMd+QHC2erPRNf8lmg==",
+ "version": "4.2.2",
+ "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.2.2.tgz",
+ "integrity": "sha512-1rudGyeYY42Dk6texmv7c4VcQ0EsvVbLwZkA+AQB7SxvXxmcD93jcHie8bzecJ+ChDlmAm2Qyu0+Ccg5uhZXCg==",
"dev": true,
"requires": {
- "bn.js": "^5.1.1",
- "browserify-rsa": "^4.0.1",
+ "bn.js": "^5.2.1",
+ "browserify-rsa": "^4.1.0",
"create-hash": "^1.2.0",
"create-hmac": "^1.1.7",
- "elliptic": "^6.5.3",
+ "elliptic": "^6.5.4",
"inherits": "^2.0.4",
- "parse-asn1": "^5.1.5",
- "readable-stream": "^3.6.0",
- "safe-buffer": "^5.2.0"
+ "parse-asn1": "^5.1.6",
+ "readable-stream": "^3.6.2",
+ "safe-buffer": "^5.2.1"
},
"dependencies": {
"readable-stream": {
- "version": "3.6.0",
- "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
- "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==",
+ "version": "3.6.2",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz",
+ "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==",
"dev": true,
"requires": {
"inherits": "^2.0.3",
@@ -6736,9 +6679,9 @@
}
},
"css-functions-list": {
- "version": "3.2.0",
- "resolved": "https://registry.npmjs.org/css-functions-list/-/css-functions-list-3.2.0.tgz",
- "integrity": "sha512-d/jBMPyYybkkLVypgtGv12R+pIFw4/f/IHtCTxWpZc8ofTYOPigIgmA6vu5rMHartZC+WuXhBUHfnyNUIQSYrg==",
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/css-functions-list/-/css-functions-list-3.2.1.tgz",
+ "integrity": "sha512-Nj5YcaGgBtuUmn1D7oHqPW0c9iui7xsTsj5lIX8ZgevdfhmjFfKB3r8moHJtNJnctnYXJyYX5I1pp90HM4TPgQ==",
"dev": true
},
"css-tree": {
@@ -7057,18 +7000,19 @@
"dev": true
},
"eslint": {
- "version": "8.50.0",
- "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.50.0.tgz",
- "integrity": "sha512-FOnOGSuFuFLv/Sa+FDVRZl4GGVAAFFi8LecRsI5a1tMO5HIE8nCm4ivAlzt4dT3ol/PaaGC0rJEEXQmHJBGoOg==",
+ "version": "8.52.0",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.52.0.tgz",
+ "integrity": "sha512-zh/JHnaixqHZsolRB/w9/02akBk9EPrOs9JwcTP2ek7yL5bVvXuRariiaAjjoJ5DvuwQ1WAE/HsMz+w17YgBCg==",
"dev": true,
"requires": {
"@eslint-community/eslint-utils": "^4.2.0",
"@eslint-community/regexpp": "^4.6.1",
"@eslint/eslintrc": "^2.1.2",
- "@eslint/js": "8.50.0",
- "@humanwhocodes/config-array": "^0.11.11",
+ "@eslint/js": "8.52.0",
+ "@humanwhocodes/config-array": "^0.11.13",
"@humanwhocodes/module-importer": "^1.0.1",
"@nodelib/fs.walk": "^1.2.8",
+ "@ungap/structured-clone": "^1.2.0",
"ajv": "^6.12.4",
"chalk": "^4.0.0",
"cross-spawn": "^7.0.2",
@@ -7121,6 +7065,13 @@
}
}
},
+ "eslint-compat-utils": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/eslint-compat-utils/-/eslint-compat-utils-0.1.2.tgz",
+ "integrity": "sha512-Jia4JDldWnFNIru1Ehx1H5s9/yxiRHY/TimCuUc0jNexew3cF1gI6CYZil1ociakfWO3rRqFjl1mskBblB3RYg==",
+ "dev": true,
+ "requires": {}
+ },
"eslint-plugin-header": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-header/-/eslint-plugin-header-3.1.1.tgz",
@@ -7146,12 +7097,13 @@
}
},
"eslint-plugin-jsonc": {
- "version": "2.9.0",
- "resolved": "https://registry.npmjs.org/eslint-plugin-jsonc/-/eslint-plugin-jsonc-2.9.0.tgz",
- "integrity": "sha512-RK+LeONVukbLwT2+t7/OY54NJRccTXh/QbnXzPuTLpFMVZhPuq1C9E07+qWenGx7rrQl0kAalAWl7EmB+RjpGA==",
+ "version": "2.10.0",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-jsonc/-/eslint-plugin-jsonc-2.10.0.tgz",
+ "integrity": "sha512-9d//o6Jyh4s1RxC9fNSt1+MMaFN2ruFdXPG9XZcb/mR2KkfjADYiNL/hbU6W0Cyxfg3tS/XSFuhl5LgtMD8hmw==",
"dev": true,
"requires": {
"@eslint-community/eslint-utils": "^4.2.0",
+ "eslint-compat-utils": "^0.1.2",
"jsonc-eslint-parser": "^2.0.4",
"natural-compare": "^1.4.0"
}
@@ -7237,13 +7189,10 @@
}
},
"fake-indexeddb": {
- "version": "4.0.2",
- "resolved": "https://registry.npmjs.org/fake-indexeddb/-/fake-indexeddb-4.0.2.tgz",
- "integrity": "sha512-SdTwEhnakbgazc7W3WUXOJfGmhH0YfG4d+dRPOFoYDRTL6U5t8tvrmkf2W/C3W1jk2ylV7Wrnj44RASqpX/lEw==",
- "dev": true,
- "requires": {
- "realistic-structured-clone": "^3.0.0"
- }
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/fake-indexeddb/-/fake-indexeddb-5.0.1.tgz",
+ "integrity": "sha512-vxybH29Owtc6khV/Usy47B1g+eKwyhFiX8nwpCC4td320jvwrKQDH6vNtcJZgUzVxmfsSIlHzLKQzT76JMCO7A==",
+ "dev": true
},
"fast-deep-equal": {
"version": "3.1.3",
@@ -7337,19 +7286,20 @@
}
},
"flat-cache": {
- "version": "3.0.4",
- "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz",
- "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==",
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.1.1.tgz",
+ "integrity": "sha512-/qM2b3LUIaIgviBQovTLvijfyOQXPtSRnRK26ksj2J7rzPIecePUIpJsZ4T02Qg+xiAEKIs5K8dsHEd+VaKa/Q==",
"dev": true,
"requires": {
- "flatted": "^3.1.0",
+ "flatted": "^3.2.9",
+ "keyv": "^4.5.3",
"rimraf": "^3.0.2"
}
},
"flatted": {
- "version": "3.2.5",
- "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.5.tgz",
- "integrity": "sha512-WIWGi2L3DyTUvUrwRKgGi9TwxQMUEqPOPQBVi71R96jZXJdFskXEmf54BoZaS1kknGODoIGASGEzBUYdyMCBJg==",
+ "version": "3.2.9",
+ "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.9.tgz",
+ "integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==",
"dev": true
},
"foreach": {
@@ -7634,18 +7584,18 @@
"dev": true
},
"html-validate": {
- "version": "8.5.0",
- "resolved": "https://registry.npmjs.org/html-validate/-/html-validate-8.5.0.tgz",
- "integrity": "sha512-EiRJ7mqRZb68DgxyMlA+5uVheCuNYZiXnoSajcdSTK8IcNuPpyeSI0CZu9wK1jE6jQrWnf8myIa5JkjDByHPuw==",
+ "version": "8.7.0",
+ "resolved": "https://registry.npmjs.org/html-validate/-/html-validate-8.7.0.tgz",
+ "integrity": "sha512-fsDHUxzVNzXzV2KpPOx5GbGRCK0cFs7a8+9jE5QTyYUGAlm1PNGst8Vi0U7hSmootkCBxY3bu7LgQBjjZDeBPw==",
"dev": true,
"requires": {
"@babel/code-frame": "^7.10.0",
"@html-validate/stylish": "^4.1.0",
"@sidvind/better-ajv-errors": "^2.0.0",
"ajv": "^8.0.0",
- "deepmerge": "^4.2.0",
+ "deepmerge": "4.3.1",
"glob": "^10.0.0",
- "ignore": "^5.0.0",
+ "ignore": "5.2.4",
"kleur": "^4.1.0",
"minimist": "^1.2.0",
"prompts": "^2.0.0",
@@ -8100,6 +8050,12 @@
"xml-name-validator": "^4.0.0"
}
},
+ "json-buffer": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz",
+ "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==",
+ "dev": true
+ },
"json-parse-even-better-errors": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz",
@@ -8146,6 +8102,15 @@
"through": ">=2.2.7 <3"
}
},
+ "keyv": {
+ "version": "4.5.4",
+ "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz",
+ "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==",
+ "dev": true,
+ "requires": {
+ "json-buffer": "3.0.1"
+ }
+ },
"kind-of": {
"version": "6.0.3",
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
@@ -8159,9 +8124,9 @@
"dev": true
},
"known-css-properties": {
- "version": "0.28.0",
- "resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.28.0.tgz",
- "integrity": "sha512-9pSL5XB4J+ifHP0e0jmmC98OGC1nL8/JjS+fi6mnTlIf//yt/MfVLtKg7S6nCtj/8KTcWX7nRlY0XywoYY1ISQ==",
+ "version": "0.29.0",
+ "resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.29.0.tgz",
+ "integrity": "sha512-Ne7wqW7/9Cz54PDt4I3tcV+hAyat8ypyOGzYRJQfdxnnjeWsTxt1cy8pjvvKeI5kfXuyvULyeeAvwvvtAX3ayQ==",
"dev": true
},
"labeled-stream-splicer": {
@@ -8199,12 +8164,6 @@
"p-locate": "^5.0.0"
}
},
- "lodash": {
- "version": "4.17.21",
- "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
- "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==",
- "dev": true
- },
"lodash.memoize": {
"version": "3.0.4",
"resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-3.0.4.tgz",
@@ -8680,19 +8639,19 @@
"dev": true
},
"playwright": {
- "version": "1.38.1",
- "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.38.1.tgz",
- "integrity": "sha512-oRMSJmZrOu1FP5iu3UrCx8JEFRIMxLDM0c/3o4bpzU5Tz97BypefWf7TuTNPWeCe279TPal5RtPPZ+9lW/Qkow==",
+ "version": "1.39.0",
+ "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.39.0.tgz",
+ "integrity": "sha512-naE5QT11uC/Oiq0BwZ50gDmy8c8WLPRTEWuSSFVG2egBka/1qMoSqYQcROMT9zLwJ86oPofcTH2jBY/5wWOgIw==",
"dev": true,
"requires": {
"fsevents": "2.3.2",
- "playwright-core": "1.38.1"
+ "playwright-core": "1.39.0"
}
},
"playwright-core": {
- "version": "1.38.1",
- "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.38.1.tgz",
- "integrity": "sha512-tQqNFUKa3OfMf4b2jQ7aGLB8o9bS3bOY0yMEtldtC2+spf8QXG9zvXLTXUeRsoNuxEYMgLYR+NXfAa1rjKRcrg==",
+ "version": "1.39.0",
+ "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.39.0.tgz",
+ "integrity": "sha512-+k4pdZgs1qiM+OUkSjx96YiKsXsmb59evFoqv8SKO067qBA+Z2s/dCzJij/ZhdQcs2zlTAgRKfeiiLm8PQ2qvw==",
"dev": true
},
"postcss": {
@@ -8934,34 +8893,6 @@
}
}
},
- "realistic-structured-clone": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/realistic-structured-clone/-/realistic-structured-clone-3.0.0.tgz",
- "integrity": "sha512-rOjh4nuWkAqf9PWu6JVpOWD4ndI+JHfgiZeMmujYcPi+fvILUu7g6l26TC1K5aBIp34nV+jE1cDO75EKOfHC5Q==",
- "dev": true,
- "requires": {
- "domexception": "^1.0.1",
- "typeson": "^6.1.0",
- "typeson-registry": "^1.0.0-alpha.20"
- },
- "dependencies": {
- "domexception": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/domexception/-/domexception-1.0.1.tgz",
- "integrity": "sha512-raigMkn7CJNNo6Ihro1fzG7wr3fHuYVytzquZKX5n0yizGsTcYgzdIUwj1X9pK0VvjeihV+XiclP+DjwbsSKug==",
- "dev": true,
- "requires": {
- "webidl-conversions": "^4.0.2"
- }
- },
- "webidl-conversions": {
- "version": "4.0.2",
- "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz",
- "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==",
- "dev": true
- }
- }
- },
"redent": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/redent/-/redent-4.0.0.tgz",
@@ -9364,9 +9295,9 @@
"dev": true
},
"stylelint": {
- "version": "15.10.3",
- "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-15.10.3.tgz",
- "integrity": "sha512-aBQMMxYvFzJJwkmg+BUUg3YfPyeuCuKo2f+LOw7yYbU8AZMblibwzp9OV4srHVeQldxvSFdz0/Xu8blq2AesiA==",
+ "version": "15.11.0",
+ "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-15.11.0.tgz",
+ "integrity": "sha512-78O4c6IswZ9TzpcIiQJIN49K3qNoXTM8zEJzhaTE/xRTCZswaovSEVIa/uwbOltZrk16X4jAxjaOhzz/hTm1Kw==",
"dev": true,
"requires": {
"@csstools/css-parser-algorithms": "^2.3.1",
@@ -9376,12 +9307,12 @@
"balanced-match": "^2.0.0",
"colord": "^2.9.3",
"cosmiconfig": "^8.2.0",
- "css-functions-list": "^3.2.0",
+ "css-functions-list": "^3.2.1",
"css-tree": "^2.3.1",
"debug": "^4.3.4",
"fast-glob": "^3.3.1",
"fastest-levenshtein": "^1.0.16",
- "file-entry-cache": "^6.0.1",
+ "file-entry-cache": "^7.0.0",
"global-modules": "^2.0.0",
"globby": "^11.1.0",
"globjoin": "^0.1.4",
@@ -9390,13 +9321,13 @@
"import-lazy": "^4.0.0",
"imurmurhash": "^0.1.4",
"is-plain-object": "^5.0.0",
- "known-css-properties": "^0.28.0",
+ "known-css-properties": "^0.29.0",
"mathml-tag-names": "^2.1.3",
"meow": "^10.1.5",
"micromatch": "^4.0.5",
"normalize-path": "^3.0.0",
"picocolors": "^1.0.0",
- "postcss": "^8.4.27",
+ "postcss": "^8.4.28",
"postcss-resolve-nested-selector": "^0.1.1",
"postcss-safe-parser": "^6.0.0",
"postcss-selector-parser": "^6.0.13",
@@ -9417,6 +9348,15 @@
"integrity": "sha512-1ugUSr8BHXRnK23KfuYS+gVMC3LB8QGH9W1iGtDPsNWoQbgtXSExkBu2aDR4epiGWZOjZsj6lDl/N/AqqTC3UA==",
"dev": true
},
+ "file-entry-cache": {
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-7.0.1.tgz",
+ "integrity": "sha512-uLfFktPmRetVCbHe5UPuekWrQ6hENufnA46qEGbfACkK5drjTTdQYUragRgMjHldcbYG+nslUerqMPjbBSHXjQ==",
+ "dev": true,
+ "requires": {
+ "flat-cache": "^3.1.1"
+ }
+ },
"resolve-from": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz",
@@ -9610,57 +9550,6 @@
"integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=",
"dev": true
},
- "typeson": {
- "version": "6.1.0",
- "resolved": "https://registry.npmjs.org/typeson/-/typeson-6.1.0.tgz",
- "integrity": "sha512-6FTtyGr8ldU0pfbvW/eOZrEtEkczHRUtduBnA90Jh9kMPCiFNnXIon3vF41N0S4tV1HHQt4Hk1j4srpESziCaA==",
- "dev": true
- },
- "typeson-registry": {
- "version": "1.0.0-alpha.39",
- "resolved": "https://registry.npmjs.org/typeson-registry/-/typeson-registry-1.0.0-alpha.39.tgz",
- "integrity": "sha512-NeGDEquhw+yfwNhguLPcZ9Oj0fzbADiX4R0WxvoY8nGhy98IbzQy1sezjoEFWOywOboj/DWehI+/aUlRVrJnnw==",
- "dev": true,
- "requires": {
- "base64-arraybuffer-es6": "^0.7.0",
- "typeson": "^6.0.0",
- "whatwg-url": "^8.4.0"
- },
- "dependencies": {
- "punycode": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
- "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==",
- "dev": true
- },
- "tr46": {
- "version": "2.1.0",
- "resolved": "https://registry.npmjs.org/tr46/-/tr46-2.1.0.tgz",
- "integrity": "sha512-15Ih7phfcdP5YxqiB+iDtLoaTz4Nd35+IiAv0kQ5FNKHzXgdWqPoTIqEDDJmXceQt4JZk6lVPT8lnDlPpGDppw==",
- "dev": true,
- "requires": {
- "punycode": "^2.1.1"
- }
- },
- "webidl-conversions": {
- "version": "6.1.0",
- "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-6.1.0.tgz",
- "integrity": "sha512-qBIvFLGiBpLjfwmYAaHPXsn+ho5xZnGvyGvsarywGNc8VyQJUMHJ8OBKGGrPER0okBeMDaan4mNBlgBROxuI8w==",
- "dev": true
- },
- "whatwg-url": {
- "version": "8.7.0",
- "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-8.7.0.tgz",
- "integrity": "sha512-gAojqb/m9Q8a5IV96E3fHJM70AzCkgt4uXYX2O7EmuyOnLrViCQlsEBmF9UQIu3/aeAIp2U17rtbpZWNntQqdg==",
- "dev": true,
- "requires": {
- "lodash": "^4.7.0",
- "tr46": "^2.1.0",
- "webidl-conversions": "^6.1.0"
- }
- }
- }
- },
"umd": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/umd/-/umd-3.0.3.tgz",
diff --git a/package.json b/package.json
index ce906797..22f5bd56 100644
--- a/package.json
+++ b/package.json
@@ -35,20 +35,20 @@
"sourceDir": "ext"
},
"devDependencies": {
- "@playwright/test": "^1.38.1",
+ "@playwright/test": "^1.39.0",
"ajv": "^8.11.0",
"browserify": "^17.0.0",
"css": "^3.0.0",
- "eslint": "^8.50.0",
+ "eslint": "^8.52.0",
"eslint-plugin-header": "^3.1.1",
"eslint-plugin-jsdoc": "^46.8.2",
- "eslint-plugin-jsonc": "^2.9.0",
+ "eslint-plugin-jsonc": "^2.10.0",
"eslint-plugin-no-unsanitized": "^4.0.1",
- "fake-indexeddb": "^4.0.2",
- "html-validate": "^8.5.0",
+ "fake-indexeddb": "^5.0.1",
+ "html-validate": "^8.7.0",
"jsdom": "^22.1.0",
"parse5": "^7.1.2",
- "stylelint": "^15.10.3",
+ "stylelint": "^15.11.0",
"stylelint-config-recommended": "^13.0.0"
}
}
diff --git a/playwright.config.js b/playwright.config.js
index 0f15ff59..11d79e72 100644
--- a/playwright.config.js
+++ b/playwright.config.js
@@ -62,8 +62,18 @@ module.exports = defineConfig({
/* Configure projects for major browsers */
projects: [
{
+ name: 'playwright setup',
+ testMatch: /global\.setup\.js/,
+ teardown: 'playwright teardown'
+ },
+ {
+ name: 'playwright teardown',
+ testMatch: /global\.teardown\.js/
+ },
+ {
name: 'chromium',
- use: {...devices['Desktop Chrome']}
+ use: {...devices['Desktop Chrome']},
+ dependencies: ['playwright setup']
}
// {
diff --git a/test/playwright/global.setup.js b/test/playwright/global.setup.js
new file mode 100644
index 00000000..442647f8
--- /dev/null
+++ b/test/playwright/global.setup.js
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2023 Yomitan Authors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+const {test: setup} = require('@playwright/test');
+const {ManifestUtil} = require('../../dev/manifest-util');
+const {root} = require('./playwright-util');
+const path = require('path');
+const fs = require('fs');
+
+const manifestPath = path.join(root, 'ext/manifest.json');
+const copyManifestPath = path.join(root, 'ext/manifest-old.json');
+
+setup('use test manifest', () => {
+ const manifestUtil = new ManifestUtil();
+ const variant = manifestUtil.getManifest('chrome-playwright');
+ fs.renameSync(manifestPath, copyManifestPath);
+ fs.writeFileSync(manifestPath, ManifestUtil.createManifestString(variant).replace('$YOMITAN_VERSION', '0.0.0.0'));
+}); \ No newline at end of file
diff --git a/test/playwright/global.teardown.js b/test/playwright/global.teardown.js
new file mode 100644
index 00000000..2fb29ebe
--- /dev/null
+++ b/test/playwright/global.teardown.js
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2023 Yomitan Authors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+const {test: teardown} = require('@playwright/test');
+const {root} = require('./playwright-util');
+const path = require('path');
+const fs = require('fs');
+
+const manifestPath = path.join(root, 'ext/manifest.json');
+const copyManifestPath = path.join(root, 'ext/manifest-old.json');
+
+teardown('bring back original manifest', () => {
+ fs.renameSync(copyManifestPath, manifestPath);
+}); \ No newline at end of file
diff --git a/test/playwright/integration.spec.js b/test/playwright/integration.spec.js
new file mode 100644
index 00000000..1bfd39ea
--- /dev/null
+++ b/test/playwright/integration.spec.js
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2023 Yomitan Authors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+const path = require('path');
+const {
+ test,
+ expect,
+ root,
+ mockModelFieldNames,
+ mockModelFieldsToAnkiValues,
+ expectedAddNoteBody,
+ mockAnkiRouteHandler,
+ writeToClipboardFromPage
+} = require('./playwright-util');
+const {createDictionaryArchive} = require('../../dev/util');
+
+test.beforeEach(async ({context}) => {
+ // wait for the on-install welcome.html tab to load, which becomes the foreground tab
+ const welcome = await context.waitForEvent('page');
+ await welcome.close(); // close the welcome tab so our main tab becomes the foreground tab -- otherwise, the screenshot can hang
+});
+
+test('search clipboard', async ({page, extensionId}) => {
+ await page.goto(`chrome-extension://${extensionId}/search.html`);
+ await page.locator('#search-option-clipboard-monitor-container > label').click();
+ await page.waitForTimeout(200); // race
+
+ await writeToClipboardFromPage(page, 'あ');
+ await expect(page.locator('#search-textbox')).toHaveValue('あ');
+});
+
+test('anki add', async ({context, page, extensionId}) => {
+ // mock anki routes
+ let resolve;
+ const addNotePromise = new Promise((res) => {
+ resolve = res;
+ });
+ await context.route(/127.0.0.1:8765\/*/, (route) => {
+ mockAnkiRouteHandler(route);
+ const req = route.request();
+ if (req.url().includes('127.0.0.1:8765') && req.postDataJSON().action === 'addNote') {
+ resolve(req.postDataJSON());
+ }
+ });
+
+ // open settings
+ await page.goto(`chrome-extension://${extensionId}/settings.html`);
+
+ // load in test dictionary
+ const dictionary = createDictionaryArchive(path.join(root, 'test/data/dictionaries/valid-dictionary1'), 'valid-dictionary1');
+ const testDictionarySource = await dictionary.generateAsync({type: 'arraybuffer'});
+ await page.locator('input[id="dictionary-import-file-input"]').setInputFiles({name: 'valid-dictionary1.zip', buffer: Buffer.from(testDictionarySource)});
+ await expect(page.locator('id=dictionaries')).toHaveText('Dictionaries (1 installed, 1 enabled)', {timeout: 5 * 60 * 1000});
+
+ // connect to anki
+ await page.locator('.toggle', {has: page.locator('[data-setting="anki.enable"]')}).click();
+ await expect(page.locator('#anki-error-message')).toHaveText('Connected');
+
+ // prep anki deck
+ await page.locator('[data-modal-action="show,anki-cards"]').click();
+ await page.locator('select.anki-card-deck').selectOption('Mock Deck');
+ await page.locator('select.anki-card-model').selectOption('Mock Model');
+ for (const modelField of mockModelFieldNames) {
+ await page.locator(`[data-setting="anki.terms.fields.${modelField}"]`).fill(mockModelFieldsToAnkiValues[modelField]);
+ }
+ await page.locator('#anki-cards-modal > div > div.modal-footer > button:nth-child(2)').click();
+ await writeToClipboardFromPage(page, '読むの例文');
+
+ // add to anki deck
+ await page.goto(`chrome-extension://${extensionId}/search.html`);
+ await expect(async () => {
+ await page.locator('#search-textbox').clear();
+ await page.locator('#search-textbox').fill('読む');
+ await expect(page.locator('#search-textbox')).toHaveValue('読む');
+ }).toPass({timeout: 5000});
+ await page.locator('#search-textbox').press('Enter');
+ await page.locator('[data-mode="term-kanji"]').click();
+ const addNoteReqBody = await addNotePromise;
+ expect(addNoteReqBody).toMatchObject(expectedAddNoteBody);
+}); \ No newline at end of file
diff --git a/test/playwright/playwright-util.js b/test/playwright/playwright-util.js
new file mode 100644
index 00000000..e28f16eb
--- /dev/null
+++ b/test/playwright/playwright-util.js
@@ -0,0 +1,109 @@
+/*
+ * Copyright (C) 2023 Yomitan Authors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+const path = require('path');
+const {test: base, chromium} = require('@playwright/test');
+
+export const root = path.join(__dirname, '..', '..');
+
+export const test = base.extend({
+ context: async ({ }, use) => {
+ const pathToExtension = path.join(root, 'ext');
+ const context = await chromium.launchPersistentContext('', {
+ // headless: false,
+ args: [
+ '--headless=new',
+ `--disable-extensions-except=${pathToExtension}`,
+ `--load-extension=${pathToExtension}`
+ ]
+ });
+ await use(context);
+ await context.close();
+ },
+ extensionId: async ({context}, use) => {
+ let [background] = context.serviceWorkers();
+ if (!background) {
+ background = await context.waitForEvent('serviceworker');
+ }
+
+ const extensionId = background.url().split('/')[2];
+ await use(extensionId);
+ }
+});
+export const expect = test.expect;
+
+export const mockModelFieldNames = [
+ 'Word',
+ 'Reading',
+ 'Audio',
+ 'Sentence'
+];
+
+export const mockModelFieldsToAnkiValues = {
+ 'Word': '{expression}',
+ 'Reading': '{furigana-plain}',
+ 'Sentence': '{clipboard-text}',
+ 'Audio': '{audio}'
+};
+
+export const mockAnkiRouteHandler = (route) => {
+ const reqBody = route.request().postDataJSON();
+ const respBody = ankiRouteResponses[reqBody.action];
+ if (!respBody) {
+ return route.abort();
+ }
+ route.fulfill(respBody);
+};
+
+export const writeToClipboardFromPage = async (page, text) => {
+ await page.evaluate(`navigator.clipboard.writeText('${text}')`);
+};
+
+export const expectedAddNoteBody = {
+ 'action': 'addNote',
+ 'params':
+ {
+ 'note': {
+ 'fields': {
+ 'Word': '読む', 'Reading': '読[よ]む', 'Audio': '[sound:mock_audio.mp3]', 'Sentence': '読むの例文'
+ },
+ 'tags': ['yomitan'],
+ 'deckName': 'Mock Deck',
+ 'modelName': 'Mock Model',
+ 'options': {
+ 'allowDuplicate': false, 'duplicateScope': 'collection', 'duplicateScopeOptions': {
+ 'deckName': null, 'checkChildren': false, 'checkAllModels': false
+ }
+ }
+ }
+ }, 'version': 2
+};
+
+const baseAnkiResp = {
+ status: 200,
+ contentType: 'text/json'
+};
+
+const ankiRouteResponses = {
+ 'version': Object.assign({body: JSON.stringify(6)}, baseAnkiResp),
+ 'deckNames': Object.assign({body: JSON.stringify(['Mock Deck'])}, baseAnkiResp),
+ 'modelNames': Object.assign({body: JSON.stringify(['Mock Model'])}, baseAnkiResp),
+ 'modelFieldNames': Object.assign({body: JSON.stringify(mockModelFieldNames)}, baseAnkiResp),
+ 'canAddNotes': Object.assign({body: JSON.stringify([true, true])}, baseAnkiResp),
+ 'storeMediaFile': Object.assign({body: JSON.stringify('mock_audio.mp3')}, baseAnkiResp),
+ 'addNote': Object.assign({body: JSON.stringify(102312488912)}, baseAnkiResp)
+}; \ No newline at end of file
diff --git a/test/playwright/visual.spec.js b/test/playwright/visual.spec.js
index acb12e97..001f329f 100644
--- a/test/playwright/visual.spec.js
+++ b/test/playwright/visual.spec.js
@@ -16,40 +16,20 @@
*/
const path = require('path');
-const {test: base, chromium} = require('@playwright/test');
-const root = path.join(__dirname, '..', '..');
-
-export const test = base.extend({
- context: async ({ }, use) => {
- const pathToExtension = path.join(root, 'ext');
- const context = await chromium.launchPersistentContext('', {
- // headless: false,
- args: [
- '--headless=new',
- `--disable-extensions-except=${pathToExtension}`,
- `--load-extension=${pathToExtension}`
- ]
- });
- await use(context);
- await context.close();
- },
- extensionId: async ({context}, use) => {
- let [background] = context.serviceWorkers();
- if (!background) {
- background = await context.waitForEvent('serviceworker');
- }
- const extensionId = background.url().split('/')[2];
- await use(extensionId);
- }
-});
-const expect = test.expect;
+const {
+ test,
+ expect,
+ root
+} = require('./playwright-util');
-test('visual', async ({context, page, extensionId}) => {
+test.beforeEach(async ({context}) => {
// wait for the on-install welcome.html tab to load, which becomes the foreground tab
const welcome = await context.waitForEvent('page');
welcome.close(); // close the welcome tab so our main tab becomes the foreground tab -- otherwise, the screenshot can hang
+});
+test('visual', async ({page, extensionId}) => {
// open settings
await page.goto(`chrome-extension://${extensionId}/settings.html`);
@@ -117,4 +97,4 @@ test('visual', async ({context, page, extensionId}) => {
await screenshot(2, i, el, {x: 15, y: 15});
i++;
}
-});
+}); \ No newline at end of file