Closed Bug 1098470 Opened 10 years ago Closed 10 years ago

navigator.hasFeature() returns undefined for manifest.*

Categories

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

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla37
blocking-b2g 2.1+
Tracking Status
firefox35 --- wontfix
firefox36 --- wontfix
firefox37 --- fixed
b2g-v2.1 --- fixed
b2g-v2.2 --- fixed

People

(Reporter: mat, Assigned: reuben)

References

Details

(Whiteboard: [dependency: marketplace])

Attachments

(2 files)

According to https://wiki.mozilla.org/WebAPI/Navigator.hasFeature, from a privileged app with the 'feature-detection' permission, I should be able to use hasFeature() to detect 'manifest.precompile' support. It doesn't work. Try:

navigator.hasFeature('manifest.precompile').then(function(data) { console.log(data); });

Expected result:
true

Actual result:
undefined

Attaching a small privileged app exhibiting the issue. Pushing and running it with WebIDE should display a green table, but all the manifest.* rows are red instead.

Interestingly, through hasFeature() fails, getFeature() works for manifest.*, but then the table results are inverted: all api.* return undefined for getFeature(), manifest.* return true.
[Blocking Requested - why for this release]:

Ehsan, can you confirm that the implementation [1] differs from the design?

Reuben, would you have time to take a look at this, as you did the initial work?

[1]: http://dxr.mozilla.org/mozilla-central/source/dom/base/test/test_getFeature_with_perm.html#98
Flags: needinfo?(reuben.bmo)
Flags: needinfo?(ehsan.akhgari)
[Blocking Requested - why for this release]: The getFeature implementation differs from its original design, which needs to be fixed.
blocking-b2g: --- → 2.1?
Blocks: 1097429
The documentation is kind of confusing on this one. GetFeature and HasFeature were split up, and so far HasFeature only covers the api.* namespace. For manifest.*, you need to use GetFeature. I'm pretty sure this is INVALID.
Flags: needinfo?(reuben.bmo)
(See bug 1009645 comment 76 and the comments after that.)
Oh, I see. _That's_ the bug. The wiki makes more sense than the code. Sorry for the noise.
Attachment #8523302 - Flags: review?(ehsan.akhgari)
Assignee: nobody → reuben.bmo
blocking-b2g: 2.1? → 2.1+
Flags: needinfo?(ehsan.akhgari)
Attachment #8523302 - Flags: review?(ehsan.akhgari) → review+
Reuben, can you please add tests for this?  Thanks!
https://hg.mozilla.org/mozilla-central/rev/24b10dc8139d
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla37
Please request b2g34 approval on this patch when you get a chance.
Flags: needinfo?(reuben.bmo)
Flags: in-testsuite?
Comment on attachment 8523302 [details] [diff] [review]
Move manifest.* scope from navigator.getFeature to navigator.hasFeature

[Approval Request Comment]
Bug caused by (feature/regressing bug #): Bug 900241
User impact if declined: Throws app developers a curve ball, implementation doesn't match API in weird ways.
Testing completed: Automated tests, patch has been in central for a week.
Risk to taking this patch (and alternatives if risky): None.
String or UUID changes made by this patch: None.
Flags: needinfo?(reuben.bmo)
Attachment #8523302 - Flags: approval-mozilla-b2g34?
Attachment #8523302 - Flags: approval-mozilla-b2g34? → approval-mozilla-b2g34+
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: