Merge pull request #7193 from ahocevar/kml-uris

Fix KML links for documents created locally in Safari
This commit is contained in:
Andreas Hocevar
2017-08-31 21:40:30 +02:00
committed by GitHub
4 changed files with 44 additions and 21 deletions
+2 -2
View File
@@ -15,8 +15,8 @@ branches:
only: only:
- master - master
addons: addons:
sauce_connect: hosts:
username: openlayers - travis.dev
jwt: jwt:
# This is the encrypted SAUCE_ACCESS_KEY # This is the encrypted SAUCE_ACCESS_KEY
secure: bb2Ibzu9RLe6ZlIG7JVcuH7IoLMxa/i3LTM7t8mbsPjVOGs5ycyJ7M9MbvqB/F2EzbeV4XB2c9ufI4TkaLYceY5kdWjfZVN8iasr+GFqKMv1uR4i6bpu8KmHJ+blxwfY1QOQ/cGwEx+fbeycMtpTc3Y3GyXaPlCQLhbZvesMg88= secure: bb2Ibzu9RLe6ZlIG7JVcuH7IoLMxa/i3LTM7t8mbsPjVOGs5ycyJ7M9MbvqB/F2EzbeV4XB2c9ufI4TkaLYceY5kdWjfZVN8iasr+GFqKMv1uR4i6bpu8KmHJ+blxwfY1QOQ/cGwEx+fbeycMtpTc3Y3GyXaPlCQLhbZvesMg88=
+3 -2
View File
@@ -67,8 +67,8 @@
"jquery": "3.2.1", "jquery": "3.2.1",
"jscodeshift": "^0.3.30", "jscodeshift": "^0.3.30",
"karma": "^1.7.0", "karma": "^1.7.0",
"karma-coverage": "^1.1.1",
"karma-chrome-launcher": "^2.1.1", "karma-chrome-launcher": "^2.1.1",
"karma-coverage": "^1.1.1",
"karma-firefox-launcher": "^1.0.1", "karma-firefox-launcher": "^1.0.1",
"karma-mocha": "^1.3.0", "karma-mocha": "^1.3.0",
"karma-sauce-launcher": "^1.1.0", "karma-sauce-launcher": "^1.1.0",
@@ -83,7 +83,8 @@
"proj4": "2.4.4", "proj4": "2.4.4",
"serve-files": "1.0.1", "serve-files": "1.0.1",
"sinon": "3.2.1", "sinon": "3.2.1",
"slimerjs": "0.10.3" "slimerjs": "0.10.3",
"url-polyfill": "^1.0.7"
}, },
"eslintConfig": { "eslintConfig": {
"extends": "openlayers", "extends": "openlayers",
+18 -6
View File
@@ -488,8 +488,12 @@ ol.format.KML.readFlatCoordinates_ = function(node) {
*/ */
ol.format.KML.readURI_ = function(node) { ol.format.KML.readURI_ = function(node) {
var s = ol.xml.getAllTextContent(node, false).trim(); var s = ol.xml.getAllTextContent(node, false).trim();
if (node.baseURI && node.baseURI !== 'about:blank') { var baseURI = node.baseURI;
var url = new URL(s, node.baseURI); if (!baseURI || baseURI == 'about:blank') {
baseURI = window.location.href;
}
if (baseURI) {
var url = new URL(s, baseURI);
return url.href; return url.href;
} else { } else {
return s; return s;
@@ -1744,8 +1748,12 @@ ol.format.KML.prototype.readSharedStyle_ = function(node, objectStack) {
var style = ol.format.KML.readStyle_(node, objectStack); var style = ol.format.KML.readStyle_(node, objectStack);
if (style) { if (style) {
var styleUri; var styleUri;
if (node.baseURI && node.baseURI !== 'about:blank') { var baseURI = node.baseURI;
var url = new URL('#' + id, node.baseURI); if (!baseURI || baseURI == 'about:blank') {
baseURI = window.location.href;
}
if (baseURI) {
var url = new URL('#' + id, baseURI);
styleUri = url.href; styleUri = url.href;
} else { } else {
styleUri = '#' + id; styleUri = '#' + id;
@@ -1771,8 +1779,12 @@ ol.format.KML.prototype.readSharedStyleMap_ = function(node, objectStack) {
return; return;
} }
var styleUri; var styleUri;
if (node.baseURI && node.baseURI !== 'about:blank') { var baseURI = node.baseURI;
var url = new URL('#' + id, node.baseURI); if (!baseURI || baseURI == 'about:blank') {
baseURI = window.location.href;
}
if (baseURI) {
var url = new URL('#' + id, baseURI);
styleUri = url.href; styleUri = url.href;
} else { } else {
styleUri = '#' + id; styleUri = '#' + id;
+21 -11
View File
@@ -15,9 +15,16 @@ module.exports = function(karma) {
karma.set({ karma.set({
frameworks: ['mocha'], frameworks: ['mocha'],
client: { client: {
runInParent: true runInParent: true,
mocha: {
timeout: 2500
}
}, },
files: [ files: [
{
pattern: path.resolve(__dirname, require.resolve('url-polyfill/url-polyfill.js')),
watched: false
},
{ {
pattern: 'module-global.js', pattern: 'module-global.js',
watched: false watched: false
@@ -86,31 +93,34 @@ module.exports = function(karma) {
SL_Firefox: { SL_Firefox: {
base: 'SauceLabs', base: 'SauceLabs',
browserName: 'firefox' browserName: 'firefox'
// }, },
// SL_Edge: { // SL_Edge: {
// base: 'SauceLabs', // base: 'SauceLabs',
// platform: 'Windows 10', // platform: 'Windows 10',
// browserName: 'MicrosoftEdge' // browserName: 'MicrosoftEdge'
// }, // },
// SL_Safari: { SL_Safari: {
// base: 'SauceLabs', base: 'SauceLabs',
// platform: 'macos 10.12', platform: 'macOS 10.12',
// browserName: 'safari' browserName: 'safari'
} }
}; };
karma.set({ karma.set({
sauceLabs: { sauceLabs: {
testName: testName, testName: testName,
recordScreenshots: false, recordScreenshots: false,
connectOptions: { startConnect: true,
port: 5757
},
startConnect: false,
tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER, tunnelIdentifier: process.env.TRAVIS_JOB_NUMBER,
username: 'openlayers', username: 'openlayers',
accessKey: process.env.SAUCE_ACCESS_KEY accessKey: process.env.SAUCE_ACCESS_KEY,
connectOptions: {
noSslBumpDomains: 'all'
}
}, },
hostname: 'travis.dev',
reporters: ['dots', 'saucelabs', 'coverage'], reporters: ['dots', 'saucelabs', 'coverage'],
browserDisconnectTimeout: 10000,
browserDisconnectTolerance: 1,
captureTimeout: 240000, captureTimeout: 240000,
browserNoActivityTimeout: 240000, browserNoActivityTimeout: 240000,
customLaunchers: customLaunchers, customLaunchers: customLaunchers,