Closed Bug 879605 Opened 11 years ago Closed 11 years ago

hasOwnProperty always returns false

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: abba000, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.94 Safari/537.36

Steps to reproduce:

Me? What did YOU do?!

for (k in navigator) {
   console.log(k + ':' + navigator[k] + ':' + Object.prototype.hasOwnProperty.call(navigator, k));
}


Actual results:

[03:03:11.012] appCodeName:Mozilla:false
[03:03:11.012] appName:Netscape:false
[03:03:11.012] appVersion:5.0 (Windows):false
[03:03:11.012] language:pl:false
[03:03:11.012] mimeTypes:[object MimeTypeArray]:false
[03:03:11.012] platform:Win32:false
[03:03:11.012] oscpu:Windows NT 6.1; WOW64:false
[03:03:11.012] vendor::false
[03:03:11.012] vendorSub::false
[03:03:11.012] product:Gecko:false
[03:03:11.012] productSub:20100101:false
[03:03:11.012] plugins:[object PluginArray]:false
[03:03:11.013] userAgent:Mozilla/5.0 (Windows NT 6.1; WOW64; rv:21.0) Gecko/20100101 Firefox/21.0:false
[03:03:11.013] cookieEnabled:true:false
[03:03:11.013] onLine:true:false
[03:03:11.013] buildID:20130511120803:false
[03:03:11.013] doNotTrack:unspecified:false
[03:03:11.013] mozPower:null:false

etc...


Expected results:

[03:03:11.012] appCodeName:Mozilla:true
[03:03:11.012] appName:Netscape:true
[03:03:11.012] appVersion:5.0 (Windows):true
[03:03:11.012] language:pl:true
[03:03:11.012] mimeTypes:[object MimeTypeArray]:true
[03:03:11.012] platform:Win32:true
[03:03:11.012] oscpu:Windows NT 6.1; WOW64:true
[03:03:11.012] vendor::true
[03:03:11.012] vendorSub::true
[03:03:11.012] product:Gecko:true
[03:03:11.012] productSub:20100101:true
[03:03:11.012] plugins:[object PluginArray]:true
[03:03:11.013] userAgent:Mozilla/5.0 (Windows NT 6.1; WOW64; rv:21.0) Gecko/20100101 Firefox/21.0:true
[03:03:11.013] cookieEnabled:true:true
[03:03:11.013] onLine:true:true
[03:03:11.013] buildID:20130511120803:true
[03:03:11.013] doNotTrack:unspecified:true
[03:03:11.013] mozPower:null:true

etc...
Severity: normal → critical
Priority: -- → P1
Component: Untriaged → General
Summary: Object.prototype.hasOwnProperty.call() always returns false → hasOwnProperty always returns false
Assignee: nobody → general
Component: General → JavaScript Engine
Product: Firefox → Core
Maybe bug 383420 is related, dunno. Looks more like a DOM thing, in any case.

@Flash Thunder: thanks for the report. Please note that the priority/severity fields don't work that way. Something that has been behaving a certain way for several releases at least can't be as critical as, say, a security bug discovered shortly before releasing a new final version. If we set all things to P1/critical, we wouldn't have an escalation path for the *really* critical stuff.
Assignee: general → nobody
Severity: critical → normal
Component: JavaScript Engine → DOM
OS: Windows 7 → All
Priority: P1 → --
Hardware: x86_64 → All
Version: 21 Branch → Trunk
This is the right behavior per spec: property getters and setters are on Navigator.prototype, not on the object itself.
Status: UNCONFIRMED → RESOLVED
Closed: 11 years ago
Resolution: --- → INVALID
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.