Skip to content

Commit

Permalink
Merge branch 'publisher-production' into feedback
Browse files Browse the repository at this point in the history
* publisher-production:
  [docs] fix SDK support for symbol-sort-key (#8501)
  v1.1.1
  fix #8481, unbounded memory growth in IE (#8490)
  fix race condition between caching and aborting (#8472)
  swap map-tiles example to use https (#8482)
  set antialias to true for custom layers and extrusion examples (#8474)
  update examples to use mapbox-gl-geocoder v4.4.1 (#8451)
  manually strip urls for faster cache matching (#8434) (#8449)
  • Loading branch information
Katy DeCorah committed Jul 18, 2019
2 parents ecb4840 + 783ae48 commit 380377f
Show file tree
Hide file tree
Showing 21 changed files with 69 additions and 37 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 1.1.1

## 🐞 Bug fixes

* Fix unbounded memory growth caused by failure to cancel requests to the cache ([#8472](https://github.com/mapbox/mapbox-gl-js/pull/8472))
* Fix unbounded memory growth caused by failure to cancel requests in IE ([#8481](https://github.com/mapbox/mapbox-gl-js/issues/8481))
* Fix performance of getting tiles from the cache ([#8489](https://github.com/mapbox/mapbox-gl-js/pull/8449))

## 1.1.0

## ✨ Minor features and improvements
Expand Down
3 changes: 2 additions & 1 deletion docs/pages/example/3d-buildings.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
zoom: 15.5,
pitch: 45,
bearing: -17.6,
container: 'map'
container: 'map',
antialias: true
});

// The 'building' layer in the mapbox-streets vector source contains building-height
Expand Down
3 changes: 2 additions & 1 deletion docs/pages/example/3d-extrusion-floorplan.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
center: [-87.61694, 41.86625],
zoom: 15.99,
pitch: 40,
bearing: 20
bearing: 20,
antialias: true
});

map.on('load', function() {
Expand Down
10 changes: 6 additions & 4 deletions docs/pages/example/add-3d-model.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<script src='https://unpkg.com/three@0.102.0/build/three.min.js'></script>
<script src="https://unpkg.com/three@0.102.0/examples/js/loaders/GLTFLoader.js"></script>
<script src='https://unpkg.com/three@0.106.2/build/three.min.js'></script>
<script src="https://unpkg.com/three@0.106.2/examples/js/loaders/GLTFLoader.js"></script>
<div id='map'></div>
<script>
var map = window.map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/mapbox/light-v10',
zoom: 17.5,
center: [148.9819, -35.3981],
pitch: 60
pitch: 60,
antialias: true // create the gl context with MSAA antialiasing, so custom layers are antialiased
});

// parameters to ensure the model is georeferenced correctly on the map
Expand Down Expand Up @@ -57,7 +58,8 @@
// use the Mapbox GL JS map canvas for three.js
this.renderer = new THREE.WebGLRenderer({
canvas: map.getCanvas(),
context: gl
context: gl,
antialias: true
});

this.renderer.autoClear = false;
Expand Down
3 changes: 2 additions & 1 deletion docs/pages/example/custom-style-layer.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
container: 'map',
zoom: 3,
center: [7.5, 58],
style: 'mapbox://styles/mapbox/light-v10'
style: 'mapbox://styles/mapbox/light-v10',
antialias: true // create the gl context with MSAA antialiasing, so custom layers are antialiased
});


Expand Down
3 changes: 2 additions & 1 deletion docs/pages/example/dancing-buildings.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
},
zoom: 15,
pitch: 55,
container: 'map'
container: 'map',
antialias: true
});

map.addControl(new mapboxgl.FullscreenControl());
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/example/forward-geocode-custom-data.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script src='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.4.0/mapbox-gl-geocoder.min.js'></script>
<link rel='stylesheet' href='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.4.0/mapbox-gl-geocoder.css' type='text/css' />
<script src='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.4.1/mapbox-gl-geocoder.min.js'></script>
<link rel='stylesheet' href='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.4.1/mapbox-gl-geocoder.css' type='text/css' />
<div id='map'></div>

<script>
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/example/map-tiles.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"sources": {
"raster-tiles": {
"type": "raster",
"tiles": ["http://tile.stamen.com/watercolor/{z}/{x}/{y}.jpg"],
"tiles": ["https://stamen-tiles.a.ssl.fastly.net/watercolor/{z}/{x}/{y}.jpg"],
"tileSize": 256,
"attribution": 'Map tiles by <a target="_top" rel="noopener" href="http://stamen.com">Stamen Design</a>, under <a target="_top" rel="noopener" href="http://creativecommons.org/licenses/by/3.0">CC BY 3.0</a>. Data by <a target="_top" rel="noopener" href="http://openstreetmap.org">OpenStreetMap</a>, under <a target="_top" rel="noopener" href="http://creativecommons.org/licenses/by-sa/3.0">CC BY SA</a>'
}
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/example/mapbox-gl-geocoder-accept-coordinates.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script src='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.4.0/mapbox-gl-geocoder.min.js'></script>
<link rel='stylesheet' href='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.4.0/mapbox-gl-geocoder.css' type='text/css' />
<script src='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.4.1/mapbox-gl-geocoder.min.js'></script>
<link rel='stylesheet' href='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.4.1/mapbox-gl-geocoder.css' type='text/css' />
<div id='map'></div>

<script>
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/example/mapbox-gl-geocoder-custom-render.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script src='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.4.0/mapbox-gl-geocoder.min.js'></script>
<link rel='stylesheet' href='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.4.0/mapbox-gl-geocoder.css' type='text/css' />
<script src='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.4.1/mapbox-gl-geocoder.min.js'></script>
<link rel='stylesheet' href='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.4.1/mapbox-gl-geocoder.css' type='text/css' />
<style>
.geocoder-dropdown-item{
padding: 5px
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/example/mapbox-gl-geocoder-limit-region.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script src='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.4.0/mapbox-gl-geocoder.min.js'></script>
<link rel='stylesheet' href='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.4.0/mapbox-gl-geocoder.css' type='text/css' />
<script src='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.4.1/mapbox-gl-geocoder.min.js'></script>
<link rel='stylesheet' href='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.4.1/mapbox-gl-geocoder.css' type='text/css' />
<div id='map'></div>

<script>
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/example/mapbox-gl-geocoder-outside-the-map.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script src='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.4.0/mapbox-gl-geocoder.min.js'></script>
<link rel='stylesheet' href='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.4.0/mapbox-gl-geocoder.css' type='text/css' />
<script src='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.4.1/mapbox-gl-geocoder.min.js'></script>
<link rel='stylesheet' href='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.4.1/mapbox-gl-geocoder.css' type='text/css' />
<style>
.geocoder {
position:absolute;
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/example/mapbox-gl-geocoder-with-flyto.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script src='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.4.0/mapbox-gl-geocoder.min.js'></script>
<link rel='stylesheet' href='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.4.0/mapbox-gl-geocoder.css' type='text/css' />
<script src='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.4.1/mapbox-gl-geocoder.min.js'></script>
<link rel='stylesheet' href='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.4.1/mapbox-gl-geocoder.css' type='text/css' />
<div id='map'></div>

<script>
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/example/mapbox-gl-geocoder-with-language.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script src='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.4.0/mapbox-gl-geocoder.min.js'></script>
<link rel='stylesheet' href='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.4.0/mapbox-gl-geocoder.css' type='text/css' />
<script src='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.4.1/mapbox-gl-geocoder.min.js'></script>
<link rel='stylesheet' href='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.4.1/mapbox-gl-geocoder.css' type='text/css' />
<div id='map'></div>

<script>
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/example/mapbox-gl-geocoder.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script src='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.4.0/mapbox-gl-geocoder.min.js'></script>
<link rel='stylesheet' href='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.4.0/mapbox-gl-geocoder.css' type='text/css' />
<script src='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.4.1/mapbox-gl-geocoder.min.js'></script>
<link rel='stylesheet' href='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.4.1/mapbox-gl-geocoder.css' type='text/css' />
<div id='map'></div>

<script>
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/example/point-from-geocoder-result.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script src='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.4.0/mapbox-gl-geocoder.min.js'></script>
<link rel='stylesheet' href='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.4.0/mapbox-gl-geocoder.css' type='text/css' />
<script src='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.4.1/mapbox-gl-geocoder.min.js'></script>
<link rel='stylesheet' href='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-geocoder/v4.4.1/mapbox-gl-geocoder.css' type='text/css' />
<style>
#geocoder-container > div {
min-width:50%;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "mapbox-gl",
"description": "A WebGL interactive maps library",
"version": "1.1.0",
"version": "1.1.1",
"main": "dist/mapbox-gl.js",
"style": "dist/mapbox-gl.css",
"license": "SEE LICENSE IN LICENSE.txt",
Expand Down
8 changes: 7 additions & 1 deletion src/style-spec/reference/v8.json
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,13 @@
"type": "number",
"doc": "Sorts features in ascending order based on this value. Features with a higher sort key will appear above features with a lower sort key when they overlap. Features with a lower sort key will have priority over other features when doing placement.",
"sdk-support": {
"js": "0.53.0"
"basic functionality": {
"js": "0.53.0",
"android": "7.4.0",
"ios": "4.11.0",
"macos": "0.14.0"
},
"data-driven styling": {}
},
"expression": {
"interpolated": false,
Expand Down
16 changes: 10 additions & 6 deletions src/util/actor.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,16 @@ class Actor {
}, buffers);
if (callback) {
return {
cancel: () => this.target.postMessage({
targetMapId,
sourceMapId: this.mapId,
type: '<cancel>',
id: String(id)
})
cancel: () => {
// Set the callback to null so that it never fires after the request is aborted.
this.callbacks[id] = null;
this.target.postMessage({
targetMapId,
sourceMapId: this.mapId,
type: '<cancel>',
id: String(id)
});
}
};
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/util/ajax.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ function makeFetchRequest(requestParameters: RequestParameters, callback: Respon
signal: controller.signal
});
let complete = false;
let aborted = false;

const cacheIgnoringSearch = hasCacheDefeatingSku(request.url);

Expand All @@ -110,6 +111,8 @@ function makeFetchRequest(requestParameters: RequestParameters, callback: Respon
}

const validateOrFetch = (err, cachedResponse, responseIsFresh) => {
if (aborted) return;

if (err) {
// Do fetch in case of cache error.
// HTTP pages in Edge trigger a security error that can be ignored.
Expand Down Expand Up @@ -152,6 +155,7 @@ function makeFetchRequest(requestParameters: RequestParameters, callback: Respon
requestParameters.type === 'json' ? response.json() :
response.text()
).then(result => {
if (aborted) return;
if (cacheableResponse && requestTime) {
// The response needs to be inserted into the cache after it has completely loaded.
// Until it is fully loaded there is a chance it will be aborted. Aborting while
Expand All @@ -172,6 +176,7 @@ function makeFetchRequest(requestParameters: RequestParameters, callback: Respon
}

return { cancel: () => {
aborted = true;
if (!complete) controller.abort();
}};
}
Expand Down
7 changes: 5 additions & 2 deletions src/util/tile_request_cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,20 @@ function stripQueryParameters(url: string) {
export function cacheGet(request: Request, callback: (error: ?any, response: ?Response, fresh: ?boolean) => void) {
if (!window.caches) return callback(null);

const strippedURL = stripQueryParameters(request.url);

window.caches.open(CACHE_NAME)
.catch(callback)
.then(cache => {
cache.match(request, { ignoreSearch: true })
// manually strip URL instead of `ignoreSearch: true` because of a known
// performance issue in Chrome https://github.com/mapbox/mapbox-gl-js/issues/8431
cache.match(strippedURL)
.catch(callback)
.then(response => {
const fresh = isFresh(response);

// Reinsert into cache so that order of keys in the cache is the order of access.
// This line makes the cache a LRU instead of a FIFO cache.
const strippedURL = stripQueryParameters(request.url);
cache.delete(strippedURL);
if (fresh) {
cache.put(strippedURL, response.clone());
Expand Down

0 comments on commit 380377f

Please sign in to comment.