Files
shaka-player/support.html
T
Joey Parrish 82357486a6 Replace buggy Promise polyfill
A bug in our Promise polyfill caused issues with the recently-added
AbortableOperation class on IE11.  Since external polyfills for this
are smaller, it is easier to remove ours in favor of a third-party
polyfill.  Applications that wish to support IE11 must now load this
additional polyfill.

We are using the "es6-promise-polyfill" module from npm, but any
compliant polyfill should suffice.

One feature our own polyfill offered was the ability to flush all
Promises, which allowed us to write synchronous unit tests that
simulated async processes.  To get this ability back, we are now
using the "promise-mock" module in our tests.

Getting "promise-mock" to load correctly involved switching from
"requirejs" to "cajon", which builds on requirejs and supports
AMD modules more directly.

Closes #1260

Change-Id: I5de48e88a910736ae5c1897a7a509bc5641acb70
2018-01-30 23:10:04 +00:00

72 lines
2.2 KiB
HTML

<!DOCTYPE html>
<!--
Copyright 2016 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html lang="en">
<head>
<meta charset="utf-8">
<title>Shaka Player Browser Support Test</title>
<script src="node_modules/es6-promise-polyfill/promise.min.js"></script>
<script src="dist/shaka-player.compiled.js"></script>
<script>
function whenLoaded(fn) {
// IE 9 fires DOMContentLoaded, and enters the "interactive"
// readyState, before document.body has been initialized, so wait
// for window.load
if (document.readyState == 'loading' ||
document.readyState == 'interactive') {
if (window.attachEvent) {
// IE8
window.attachEvent('onload', fn);
} else {
window.addEventListener('load', fn);
}
} else {
fn();
}
}
function printSupport(support) {
var userAgent = navigator.userAgent;
var formatted = userAgent + '\n' + shaka.Player.version + '\n\n';
formatted += support;
var output = document.getElementById('output');
if (output.textContent === undefined) {
// IE8 and other very old browsers don't have textContent.
output.innerText = formatted;
} else {
output.textContent = formatted;
}
}
function doTest() {
shaka.polyfill.installAll();
if (shaka.Player.isBrowserSupported()) {
shaka.Player.probeSupport().then(function(support) {
printSupport(JSON.stringify(support, null, ' '));
});
} else {
printSupport('This browser is not supported.');
}
}
whenLoaded(doTest);
</script>
</head>
<body><pre id="output"></pre></body>
</html>