Skip to content

Commit bfc9351

Browse files
Release build 4.12.0 [ci release]
1 parent 7bb92c3 commit bfc9351

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+45022
-61885
lines changed

.github/workflows/tests.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ jobs:
5454
${{ runner.os }}-node-
5555
- name: Install dependencies
5656
run: |
57-
sudo apt-get install xvfb
5857
npm install
5958
npm run build
6059
- name: Cache docs output
@@ -65,6 +64,13 @@ jobs:
6564
key: docs-output-${{ github.run_id }}
6665
- name: Install Playwright Browsers
6766
run: npx playwright install --with-deps
67+
- run: npm run playwright
68+
- uses: actions/upload-artifact@v2
69+
if: always()
70+
with:
71+
name: playwright-report
72+
path: playwright-report/
73+
retention-days: 5
6874
- run: npm run test-int-x
6975
- name: Build docs
7076
run: npm run docs

Sources/ContentScopeScripts/dist/contentScope.js

Lines changed: 1488 additions & 7179 deletions
Large diffs are not rendered by default.

build/android/contentScope.js

Lines changed: 1619 additions & 7353 deletions
Large diffs are not rendered by default.

build/chrome-mv3/inject.js

Lines changed: 6509 additions & 9538 deletions
Large diffs are not rendered by default.

build/chrome/inject.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/contentScope.js

Lines changed: 9678 additions & 9507 deletions
Large diffs are not rendered by default.

build/firefox/inject.js

Lines changed: 6588 additions & 9618 deletions
Large diffs are not rendered by default.

build/integration/contentScope.js

Lines changed: 9678 additions & 9507 deletions
Large diffs are not rendered by default.

build/integration/pages/duckplayer/js/index.js

Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@
1818
__publicField(this, "config");
1919
this.messagingContext = messagingContext;
2020
this.config = config;
21+
this.globals = {
22+
window,
23+
JSONparse: window.JSON.parse,
24+
JSONstringify: window.JSON.stringify,
25+
Promise: window.Promise,
26+
Error: window.Error,
27+
String: window.String
28+
};
2129
for (const [methodName, fn] of Object.entries(this.config.methods)) {
2230
if (typeof fn !== "function") {
2331
throw new Error("cannot create WindowsMessagingTransport, missing the method: " + methodName);
@@ -28,7 +36,8 @@
2836
* @param {import('../index.js').NotificationMessage} msg
2937
*/
3038
notify(msg) {
31-
const notification = WindowsNotification.fromNotification(msg);
39+
const data = this.globals.JSONparse(this.globals.JSONstringify(msg.params || {}));
40+
const notification = WindowsNotification.fromNotification(msg, data);
3241
this.config.methods.postMessage(notification);
3342
}
3443
/**
@@ -37,31 +46,32 @@
3746
* @return {Promise<any>}
3847
*/
3948
request(msg, opts = {}) {
40-
const outgoing = WindowsRequestMessage.fromRequest(msg);
49+
const data = this.globals.JSONparse(this.globals.JSONstringify(msg.params || {}));
50+
const outgoing = WindowsRequestMessage.fromRequest(msg, data);
4151
this.config.methods.postMessage(outgoing);
4252
const comparator = (eventData) => {
4353
return eventData.featureName === msg.featureName && eventData.context === msg.context && eventData.id === msg.id;
4454
};
45-
function isMessageResponse(data) {
46-
if ("result" in data)
55+
function isMessageResponse(data2) {
56+
if ("result" in data2)
4757
return true;
48-
if ("error" in data)
58+
if ("error" in data2)
4959
return true;
5060
return false;
5161
}
52-
return new Promise((resolve, reject) => {
62+
return new this.globals.Promise((resolve, reject) => {
5363
try {
5464
this._subscribe(comparator, opts, (value, unsubscribe) => {
5565
unsubscribe();
5666
if (!isMessageResponse(value)) {
5767
console.warn("unknown response type", value);
58-
return reject(new Error("unknown response"));
68+
return reject(new this.globals.Error("unknown response"));
5969
}
6070
if (value.result) {
6171
return resolve(value.result);
6272
}
63-
const message = String(value.error?.message || "unknown error");
64-
reject(new Error(message));
73+
const message = this.globals.String(value.error?.message || "unknown error");
74+
reject(new this.globals.Error(message));
6575
});
6676
} catch (e) {
6777
reject(e);
@@ -158,9 +168,9 @@
158168
* @param {NotificationMessage} notification
159169
* @returns {WindowsNotification}
160170
*/
161-
static fromNotification(notification) {
171+
static fromNotification(notification, data) {
162172
const output = {
163-
Data: JSON.parse(JSON.stringify(notification.params || {})),
173+
Data: data,
164174
Feature: notification.context,
165175
SubFeatureName: notification.featureName,
166176
Name: notification.method
@@ -188,11 +198,12 @@
188198
/**
189199
* Helper to convert a {@link RequestMessage} to a format that Windows can support
190200
* @param {RequestMessage} msg
201+
* @param {Record<string, any>} data
191202
* @returns {WindowsRequestMessage}
192203
*/
193-
static fromRequest(msg) {
204+
static fromRequest(msg, data) {
194205
const output = {
195-
Data: JSON.parse(JSON.stringify(msg.params || {})),
206+
Data: data,
196207
Feature: msg.context,
197208
SubFeatureName: msg.featureName,
198209
Name: msg.method,
@@ -826,15 +837,11 @@
826837
* Sets the tab title to the title of the video once the video title has loaded.
827838
*/
828839
setTabTitle: () => {
829-
let hasGottenValidVideoTitle = false;
830840
VideoPlayer.onIframeLoaded(() => {
831841
VideoPlayer.onIframeTitleChange((title) => {
832-
if (!hasGottenValidVideoTitle) {
833-
const validTitle = VideoPlayer.getValidVideoTitle(title);
834-
if (validTitle) {
835-
document.title = "Duck Player - " + validTitle;
836-
hasGottenValidVideoTitle = true;
837-
}
842+
const validTitle = VideoPlayer.getValidVideoTitle(title);
843+
if (validTitle) {
844+
document.title = "Duck Player - " + validTitle;
838845
}
839846
});
840847
});

build/windows/contentScope.js

Lines changed: 6153 additions & 8856 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)