Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

fix: Fix fetch plugin with old implementations #5090

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ jobs:
- os: ubuntu-latest
browser: Edge
extra_flags: "--use-xvfb"
- os: ubuntu-latest
browser: Chrome-38
extra_flags: "--use-xvfb --no-drm"

- os: macos-latest
browser: Chrome
Expand Down Expand Up @@ -100,6 +103,17 @@ jobs:
sudo dpkg -i microsoft-edge-stable_108.0.1462.46-1_amd64.deb
fi

- name: Install Chrome 38
if: matrix.os == 'ubuntu-latest' && matrix.browser == 'Chrome-38'
run: |
# sudo apt-get update
# sudo apt-get remove google-chrome-stable
# Chrome 38 it's a old version included in WebOS 3.0
# (the oldest device that we support).
wget "https://storage.googleapis.com/old-browsers/google-chrome-38.deb"
sudo dpkg -i "google-chrome-38.deb"
sudo ln -sf /usr/bin/google-chrome-38 /usr/bin/google-chrome

- name: Checkout code
uses: actions/checkout@v3
with:
Expand Down Expand Up @@ -140,6 +154,10 @@ jobs:
run: |
browser=${{ matrix.browser }}

if [[ "$browser" == "Chrome-38" ]]; then
browser="Chrome"
fi

if [[ "$browser" == "Safari-old" ]]; then
# Replace the browser name with a script that can launch this
# browser from the command line.
Expand Down
10 changes: 10 additions & 0 deletions lib/net/http_fetch_plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,16 @@ shaka.net.HttpFetchPlugin = class {
} else {
return false;
}
// Old fetch implementations hasn't body and ReadableStream implementation
// See: https://github.com/shaka-project/shaka-player/issues/5088
if (window.Response) {
// eslint-disable-next-line no-restricted-syntax, no-prototype-builtins
if (!Response.prototype.hasOwnProperty('body')) {
return false;
}
} else {
return false;
}
return !!(window.fetch && window.AbortController);
}
};
Expand Down