Closed
Bug 532535
Opened 16 years ago
Closed 15 years ago
The value of the property of the greater part of "Geolocation.position.address interface" is null.
Categories
(Core :: DOM: Geolocation, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 531008
People
(Reporter: mitsugu.oyama, Unassigned)
Details
Attachments
(3 files)
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2b5pre) Gecko/20091202 Namoroka/3.6b5pre
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2b5pre) Gecko/20091202 Namoroka/3.6b5pre
A correct address is'nt set by the property of "position.address interface".
Reproducible: Always
Steps to Reproduce:
1.The following code is executed.
[test code]
var geolocation=Components.classes["@mozilla.org/geolocation;1"].
getService(Components.interfaces.nsIDOMGeoGeolocation);
geolocation.getCurrentPosition(function(position){
Application.console.log('Firefox XPCOM API:\n'+
'latitude:'+position.coords.latitude+'\n'+
'longitude:'+position.coords.longitude+'\n'+
'position.address.postalCode:'+position.address.postalCode+'\n'+
'position.address.countryCode:'+position.address.countryCode+'\n'+
'position.address.country:'+position.address.country+'\n'+
'position.address.region:'+position.address.region+'\n'+
'position.address.county'+position.address.county+'\n'+
'position.address.city:'+position.address.city+'\n'+
'position.address.premises:'+position.address.premises+'\n'+
'position.address.street:'+position.address.street+'\n'+
'position.address.streetNumber:'+position.address.streetNumber
);
var url='http://maps.google.com/maps/geo?ll='+position.coords.latitude+','+
position.coords.longitude+'&output=xml&hl=ja&oe=UTF8';
var req=new XMLHttpRequest();
req.open('GET',url,false);
req.overrideMimeType('text/xml');
req.send(null);
if(req.status==200){
this.prefecture=req.responseXML.getElementsByTagName('AdministrativeAreaName')
.item(0).childNodes.item(0).nodeValue;
this.region=req.responseXML.getElementsByTagName('LocalityName')
.item(0).childNodes.item(0).nodeValue;
this.dependentLocality=req.responseXML.getElementsByTagName('DependentLocalityName')
.item(0).childNodes.item(0).nodeValue;
Application.console.log(url+' Google API:\n'+
'PostalCodeNumber:'+
req.responseXML.getElementsByTagName('PostalCodeNumber')
.item(0).childNodes.item(0).nodeValue+'\n'+
'CountryNameCode:'+
req.responseXML.getElementsByTagName('CountryNameCode')
.item(0).childNodes.item(0).nodeValue+'\n'+
'CountryName:'+
req.responseXML.getElementsByTagName('CountryName')
.item(0).childNodes.item(0).nodeValue+'\n'+
'AdministrativeAreaName:'+this.prefecture+'\n'+
'LocalityName:'+this.region+'\n'+
'DependentLocalityName:'+this.dependentLocality+'\n'+
'ThoroughfareName:'+
req.responseXML.getElementsByTagName('ThoroughfareName')
.item(0).childNodes.item(0).nodeValue
);
}
});
Actual Results:
Only "JP" and "日本" are included in result.
Expected Results:
All components of the address are enumerated.
I report on the bug of "geolocation XPCOM interface".
[abstract]
A correct address is'nt set by the property of "position.address interface".
[Environment]
Ubuntu 9.10 Karmic Koala
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2b5pre) Gecko/20091202 Namoroka/3.6b5pre
[test code]
var geolocation=Components.classes["@mozilla.org/geolocation;1"].
getService(Components.interfaces.nsIDOMGeoGeolocation);
geolocation.getCurrentPosition(function(position){
Application.console.log('Firefox XPCOM API:\n'+
'latitude:'+position.coords.latitude+'\n'+
'longitude:'+position.coords.longitude+'\n'+
'position.address.postalCode:'+position.address.postalCode+'\n'+
'position.address.countryCode:'+position.address.countryCode+'\n'+
'position.address.country:'+position.address.country+'\n'+
'position.address.region:'+position.address.region+'\n'+
'position.address.county'+position.address.county+'\n'+
'position.address.city:'+position.address.city+'\n'+
'position.address.premises:'+position.address.premises+'\n'+
'position.address.street:'+position.address.street+'\n'+
'position.address.streetNumber:'+position.address.streetNumber
);
var url='http://maps.google.com/maps/geo?ll='+position.coords.latitude+','+
position.coords.longitude+'&output=xml&hl=ja&oe=UTF8';
var req=new XMLHttpRequest();
req.open('GET',url,false);
req.overrideMimeType('text/xml');
req.send(null);
if(req.status==200){
this.prefecture=req.responseXML.getElementsByTagName('AdministrativeAreaName')
.item(0).childNodes.item(0).nodeValue;
this.region=req.responseXML.getElementsByTagName('LocalityName')
.item(0).childNodes.item(0).nodeValue;
this.dependentLocality=req.responseXML.getElementsByTagName('DependentLocalityName')
.item(0).childNodes.item(0).nodeValue;
Application.console.log(url+' Google API:\n'+
'PostalCodeNumber:'+
req.responseXML.getElementsByTagName('PostalCodeNumber')
.item(0).childNodes.item(0).nodeValue+'\n'+
'CountryNameCode:'+
req.responseXML.getElementsByTagName('CountryNameCode')
.item(0).childNodes.item(0).nodeValue+'\n'+
'CountryName:'+
req.responseXML.getElementsByTagName('CountryName')
.item(0).childNodes.item(0).nodeValue+'\n'+
'AdministrativeAreaName:'+this.prefecture+'\n'+
'LocalityName:'+this.region+'\n'+
'DependentLocalityName:'+this.dependentLocality+'\n'+
'ThoroughfareName:'+
req.responseXML.getElementsByTagName('ThoroughfareName')
.item(0).childNodes.item(0).nodeValue
);
}
});
[result (2009/12/03 6:20JST +900)]
Firefox XPCOM API:
latitude:34.817
longitude:135.567
position.address.postalCode:null
position.address.countryCode:JP
position.address.country:Japan
position.address.region:null
position.address.countynull
position.address.city:null
position.address.premises:null
position.address.street:null
position.address.streetNumber:null
http://maps.google.com/maps/geo?ll=34.817,135.567&output=xml&hl=ja&oe=UTF8 Google API:
PostalCodeNumber:567-0031
CountryNameCode:JP
CountryName:日本
AdministrativeAreaName:大阪府
LocalityName:茨木市
DependentLocalityName:駅前
ThoroughfareName:府道139号線
[about result (2009/12/03 6:20JST +900)]
A correct value is set in latitude and the longitude.It was confirmed that this value was requested from Internet Protocol address of the default route by the experiment.However, the value of the property of all almost "Position.address interface" is "Null.
[result (2009/12/02 JST +900)]
Firefox XPCOM API:
latitude:34.75
longitude:135.533
position.address.postalCode:null
position.address.countryCode:JP
position.address.country:日本
position.address.region:大阪府
position.address.countynull
position.address.city:大阪市
position.address.premises:null
position.address.street:2丁目
position.address.streetNumber:23
http://maps.google.com/maps/geo?ll=34.75,135.533&output=xml&hl=ja&oe=UTF8 Google API:
PostalCodeNumber:533-0004
CountryNameCode:JP
CountryName:日本
AdministrativeAreaName:大阪府
LocalityName:大阪市東淀川区
DependentLocalityName:上新庄
ThoroughfareName:2丁目23−8
[about result (2009/12/02 JST +900)]
The element of the following addresses is missed.
・東淀川区
・上新庄
・2丁目
・23
・8
| Reporter | ||
Comment 1•16 years ago
|
||
[Additional Report]
I tested the addition. As a result, this bug is thought that Google leads at present.I adjusted and tested the following patches to Namoroka.
[Patches]
diff -r 6e590843b831 dom/src/geolocation/NetworkGeolocationProvider.js
--- a/dom/src/geolocation/NetworkGeolocationProvider.js Tue Dec 15 19:03:52 2009 -0800
+++ b/dom/src/geolocation/NetworkGeolocationProvider.js Wed Dec 16 22:17:54 2009 +0900
@@ -257,6 +257,9 @@
LOG("service returned: " + req.target.responseText);
+ // by mitsugu
+ Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService).logStringMessage("service first returned: "+req.target.responseText+"by mitsugu");
+
// if we get a bad response, we will throw and never report a location
var response = JSON.parse(req.target.responseText);
@@ -289,6 +292,19 @@
}
LOG("sending update to geolocation.");
+ // for mitsugu
+ Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService).logStringMessage(
+ address.postal_code+
+ address.country_code+
+ address.country+
+ address.region+
+ address.county+
+ address.city+
+ address.premises+
+ address.street+
+ address.street_number+
+ " : for mitsugu"
+ );
var newLocation = new WifiGeoPositionObject(response.location, address);
[Result 1]
service first returned: {"location":{"latitude":34.817,"longitude":135.567,"address":{"country":"日本","country_code":"JP"},"accuracy":25000.0},"access_token":"2:NcdViq4yeinfyxbs:xZbZIHh6Ja15uKz7"}by mitsugu
[Result 2]
undefinedJP日本undefinedundefinedundefinedundefinedundefinedundefined : for mitsugu
P.S.
Does this bug occur only in my environment?
Comment 2•16 years ago
|
||
mitsugu - I think you are correct, this is a dup of 531008. Can you verify this?
| Reporter | ||
Comment 3•16 years ago
|
||
When My extension (Weather Japan) was tested, I noticed Bug 532535.
In addition, I added the patch of #2 to Namoroka of the Mercurial repository. And, I made Namoroka. In addition, I tested. The result is #2.
The reproduction of the problem is easy.
1.hg clone http://hg.mozilla.org/releases/mozilla-1.9.2/ test
2.add patch of #2.
3.build Namoroka.
4.install my extension call Weather Japan 1.3.0.
5.add "extensions.extensions.weather.geo" to prefs.js.Value is "true".
6.started Weather Japan.
7.Push "現在位置取得" button.
8.Confirmed error console.
If it is necessary, "Weather Japan" that has not been registered in AMO yet is appended.If it is necessary, I am ready to added Weather Japan that has not been registered in AMO yet.The source code has been opened to the public to guthub.
http://github.com/mitsugu/fx-ex-jweather
The relating file is geolocation.js.
Moreover, I can add the screen shot if necessary.
| Reporter | ||
Comment 4•16 years ago
|
||
Sorry, when it was inefficiency to use and to test "Weather Japan", I renewed the idea. I'll write a simpler test code. Can you give me the short amount time?
| Reporter | ||
Comment 5•16 years ago
|
||
| Reporter | ||
Comment 6•16 years ago
|
||
This extension uses the http protocol. You should confirm the source code.
| Reporter | ||
Comment 7•16 years ago
|
||
| Reporter | ||
Comment 8•16 years ago
|
||
Comment on attachment 418419 [details]
Change for reproduction test
NetworkGeolocationProvider.js
Updated•15 years ago
|
Status: UNCONFIRMED → RESOLVED
Closed: 15 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•