mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Merge pull request #12889 from dannon/fix-polyfills
Polyfill overhaul, fixes.
This commit is contained in:
@@ -10,7 +10,7 @@ concurrency:
|
||||
group: client-${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
jobs:
|
||||
jest:
|
||||
client-unit-test:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
|
||||
+2
-1
@@ -15,7 +15,6 @@
|
||||
"**/ua-parser-js": "0.7.30"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/polyfill": "^7.10.1",
|
||||
"@fortawesome/fontawesome-free": "^5.15.4",
|
||||
"@fortawesome/fontawesome-svg-core": "^1.2.36",
|
||||
"@fortawesome/free-brands-svg-icons": "^5.15.4",
|
||||
@@ -32,6 +31,7 @@
|
||||
"bootstrap": "4.5.0",
|
||||
"bootstrap-vue": "^2.21.2",
|
||||
"citation-js": "^0.5.1",
|
||||
"core-js": "^3.19.1",
|
||||
"d3": "3",
|
||||
"date-fns": "^2.24.0",
|
||||
"decode-uri-component": "^0.2.0",
|
||||
@@ -70,6 +70,7 @@
|
||||
"pretty-bytes": "^5.6.0",
|
||||
"proper-skip-list": "^4.0.2",
|
||||
"pyre-to-regexp": "^0.0.5",
|
||||
"regenerator-runtime": "^0.13.9",
|
||||
"regression": "^2.0.1",
|
||||
"requirejs": "2.3.6",
|
||||
"rxjs": "^7.4.0",
|
||||
|
||||
+2
-85
@@ -3,88 +3,5 @@
|
||||
and polyfill for non-standard features.
|
||||
*/
|
||||
|
||||
import "@babel/polyfill";
|
||||
import _ from "underscore";
|
||||
|
||||
(() => {
|
||||
/* TODO: move to modernizr or something besides us doing this...
|
||||
* These are across all of our apps (reports, tool shed), but:
|
||||
* these should be configurable via options because they all need different things.
|
||||
* So, analysis-polyfills.js, reports-polyfills.js (or analysis/polyfills)
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
// ------------------------------------------------------------------ polyfills
|
||||
// console protection needed in some versions of IE (at this point (IE>=9), shouldn't be needed)
|
||||
window.console = window.console || {
|
||||
log: function () {},
|
||||
debug: function () {},
|
||||
info: function () {},
|
||||
warn: function () {},
|
||||
error: function () {},
|
||||
assert: function () {},
|
||||
};
|
||||
|
||||
console.debug("Polyfills are running");
|
||||
|
||||
// phantomjs: does not have the native extend fn assign
|
||||
Object.assign = Object.assign || _.extend;
|
||||
|
||||
// requestAnimationFrame polyfill
|
||||
var lastTime = 0;
|
||||
var vendors = ["ms", "moz", "webkit", "o"];
|
||||
for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
|
||||
window.requestAnimationFrame = window[`${vendors[x]}RequestAnimationFrame`];
|
||||
window.cancelRequestAnimationFrame = window[`${vendors[x]}CancelRequestAnimationFrame`];
|
||||
}
|
||||
|
||||
if (!window.requestAnimationFrame) {
|
||||
window.requestAnimationFrame = (callback, element) => {
|
||||
var currTime = new Date().getTime();
|
||||
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
|
||||
var id = window.setTimeout(() => {
|
||||
callback(currTime + timeToCall);
|
||||
}, timeToCall);
|
||||
lastTime = currTime + timeToCall;
|
||||
return id;
|
||||
};
|
||||
}
|
||||
|
||||
if (!window.cancelAnimationFrame) {
|
||||
window.cancelAnimationFrame = (id) => {
|
||||
window.clearTimeout(id);
|
||||
};
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------ can't/won't polyfill
|
||||
var features = [
|
||||
{
|
||||
name: "canvas",
|
||||
compatible: function () {
|
||||
return window.CanvasRenderingContext2D;
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "sessionStorage",
|
||||
compatible: function () {
|
||||
try {
|
||||
return window.sessionStorage.length >= 0;
|
||||
} catch (err) {
|
||||
console.debug(err);
|
||||
}
|
||||
return false;
|
||||
},
|
||||
},
|
||||
];
|
||||
// build a list of feature names for features that were not found
|
||||
var incompatibilities = features.filter((feature) => !feature.compatible()).map((feature) => feature.name);
|
||||
|
||||
// if there are needed features missing, follow the index link to the static incompat warning
|
||||
if (incompatibilities.length) {
|
||||
var root = document.querySelectorAll('link[rel="index"]').item(0);
|
||||
if (root) {
|
||||
window.location = `${root.href}static/incompatible-browser.html`;
|
||||
}
|
||||
console.log(`incompatible browser:\n${incompatibilities.join("\n")}`);
|
||||
}
|
||||
})();
|
||||
import "core-js/stable";
|
||||
import "regenerator-runtime/runtime";
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
*/
|
||||
|
||||
const baseKarmaConfig = require("./karma.config.base");
|
||||
const testFiles = ["../node_modules/@babel/polyfill/dist/polyfill.js", "../tests/qunit/testBundle.js"];
|
||||
const testFiles = ["polyfills.js", "../tests/qunit/testBundle.js"];
|
||||
const preprocessors = testFiles.reduce((result, path) => {
|
||||
result[path] = ["webpack"];
|
||||
return result;
|
||||
|
||||
+5
-13
@@ -791,14 +791,6 @@
|
||||
"@babel/helper-create-regexp-features-plugin" "^7.14.5"
|
||||
"@babel/helper-plugin-utils" "^7.14.5"
|
||||
|
||||
"@babel/polyfill@^7.10.1":
|
||||
version "7.12.1"
|
||||
resolved "https://registry.yarnpkg.com/@babel/polyfill/-/polyfill-7.12.1.tgz#1f2d6371d1261bbd961f3c5d5909150e12d0bd96"
|
||||
integrity sha512-X0pi0V6gxLi6lFZpGmeNa4zxtwEmCs42isWLNjZZDE0Y8yVfgu0T2OAHlzBbdYlqbW/YXVvoBHpATEM+goCj8g==
|
||||
dependencies:
|
||||
core-js "^2.6.5"
|
||||
regenerator-runtime "^0.13.4"
|
||||
|
||||
"@babel/preset-env@^7.15.8":
|
||||
version "7.15.8"
|
||||
resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.15.8.tgz#f527ce5bcb121cd199f6b502bf23e420b3ff8dba"
|
||||
@@ -3839,10 +3831,10 @@ core-js-pure@^3.0.0:
|
||||
resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.18.3.tgz#7eed77dcce1445ab68fd68715856633e2fb3b90c"
|
||||
integrity sha512-qfskyO/KjtbYn09bn1IPkuhHl5PlJ6IzJ9s9sraJ1EqcuGyLGKzhSM1cY0zgyL9hx42eulQLZ6WaeK5ycJCkqw==
|
||||
|
||||
core-js@^2.6.5:
|
||||
version "2.6.12"
|
||||
resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.12.tgz#d9333dfa7b065e347cc5682219d6f690859cc2ec"
|
||||
integrity sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ==
|
||||
core-js@^3.19.1:
|
||||
version "3.19.1"
|
||||
resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.19.1.tgz#f6f173cae23e73a7d88fa23b6e9da329276c6641"
|
||||
integrity sha512-Tnc7E9iKd/b/ff7GFbhwPVzJzPztGrChB8X8GLqoYGdEOG8IpLnK1xPyo3ZoO3HsK6TodJS58VGPOxA+hLHQMg==
|
||||
|
||||
core-js@^3.6.0, core-js@^3.8.3:
|
||||
version "3.18.3"
|
||||
@@ -10744,7 +10736,7 @@ regenerate@^1.4.0, regenerate@^1.4.2:
|
||||
resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.4.2.tgz#b9346d8827e8f5a32f7ba29637d398b69014848a"
|
||||
integrity sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==
|
||||
|
||||
regenerator-runtime@^0.13.4, regenerator-runtime@^0.13.7:
|
||||
regenerator-runtime@^0.13.4, regenerator-runtime@^0.13.7, regenerator-runtime@^0.13.9:
|
||||
version "0.13.9"
|
||||
resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz#8925742a98ffd90814988d7566ad30ca3b263b52"
|
||||
integrity sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==
|
||||
|
||||
Reference in New Issue
Block a user