Commit 70472dcf authored by Erik Luo's avatar Erik Luo Committed by Commit Bot

DevTools: fix geolocation toSetting() serialization

The Geolocation struct used to hold a string-type error property,
but was changed into a boolean here:
https://codereview.chromium.org/1917543002

There was a mistake in that CL, where it was still expecting a
string-type error, causing serialization to always return an
empty string.

This CL fixes the serializer, allowing the last applied
geolocation to be saved.

Bug: 649657
Change-Id: I7f65f7844dca9ee2e182970602c6810a3c776973
Reviewed-on: https://chromium-review.googlesource.com/778044
Commit-Queue: Erik Luo <luoe@chromium.org>
Reviewed-by: default avatarDmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#519953}
parent 5cd222d7
......@@ -175,7 +175,7 @@ SDK.EmulationModel.Geolocation = class {
var splitPosition = splitError[0].split('@');
if (splitPosition.length === 2) {
return new SDK.EmulationModel.Geolocation(
parseFloat(splitPosition[0]), parseFloat(splitPosition[1]), splitError[1]);
parseFloat(splitPosition[0]), parseFloat(splitPosition[1]), !!splitError[1]);
}
}
}
......@@ -225,9 +225,7 @@ SDK.EmulationModel.Geolocation = class {
* @return {string}
*/
toSetting() {
return (typeof this.latitude === 'number' && typeof this.longitude === 'number' && typeof this.error === 'string') ?
this.latitude + '@' + this.longitude + ':' + this.error :
'';
return this.latitude + '@' + this.longitude + ':' + (this.error || '');
}
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment