Closed Bug 967414 Opened 11 years ago Closed 11 years ago

[Datastore] navigator.getDataStores is undefined

Categories

(Core :: DOM: Device Interfaces, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla30
blocking-b2g 1.3+
Tracking Status
firefox28 --- wontfix
firefox29 --- wontfix
firefox30 --- fixed
b2g-v1.3 --- fixed
b2g-v1.3T --- fixed
b2g-v1.4 --- fixed

People

(Reporter: gtorodelvalle, Assigned: baku)

References

Details

(Keywords: regression, smoketest, Whiteboard: [status:on inbound])

Attachments

(1 file, 1 obsolete file)

Hi guys, I just found trying to solve bug 967412 that in v1.3 (Gecko-2905062.Gaia-bb36b41) we are getting navigator.getDataStores as undefined:
E/GeckoConsole(  808): [JavaScript Error: "TypeError: navigator.getDataStores is not a function" {file: "app://communications.gaiamobile.org/shared/js/fb/fb_data_reader.js" line: 352}]

Any clue about this? Thanks!
Blocks: 967412
blocking-b2g: --- → 1.3?
Need-infoing Andrea about the issue :-) If you need further information, please do not hesitate to ask me about it ;-) Thanks!
Flags: needinfo?(amarchesini)
Component: DOM → DOM: Device Interfaces
Hardware: x86 → ARM
navigator.getDeviceStores() is exposed just to certified apps. is this the case?
Flags: needinfo?(amarchesini)
Hi Andrea, thank you very much for your quick reply ;-)

Yeah, this code runs in the Communications app (more concretely in the Contacts sub-app, so to call it). As you can see in the logs, the concrete JavaScript file is located in the shared folder although I guess this has nothing to do with the issue ;-)
Is Communications app a certified app? This is the only valid reason why getDataStores() is not exposed.
Or there is a bug in gecko :)
Ups, sorry, I took that for granted. Yeah, the Communications app is a certified app: https://github.com/mozilla-b2g/gaia/blob/v1.3/apps/communications/manifest.webapp#L4

So I guess the bug in Gecko option is getting stronger... :-p
Blocks: 966448
So just to make sure about the other conditions Gecko is checking here:

1)  "dom.datastore.enabled" is true in the builds in question?  Note that for b2g it's false ifdef RELEASE_BUILD; the question is whether the builds in question are RELEASE_BUILD.

2)  The access is being done from content code, not via an Xray?
Since this seems likely to block Facebook contact importing, marking a 1.3 blocker.
Assignee: nobody → amarchesini
blocking-b2g: 1.3? → 1.3+
(In reply to Boris Zbarsky [:bz] from comment #6)
> So just to make sure about the other conditions Gecko is checking here:
> 
> 1)  "dom.datastore.enabled" is true in the builds in question?  Note that
> for b2g it's false ifdef RELEASE_BUILD; the question is whether the builds
> in question are RELEASE_BUILD.

Why is it only enabled for RELEASE_BUILD?  I don't remember exactly.  We should probably lift that restriction.
It's _disabled_ for RELEASE_BUILD.  As for why, see bug 923417 comment 2, where you asked for this behavior?  ;)
Can we get ETA to fix this bug? Thank you.
Can you answer my questions from comment 6?  Right now the bug is blocked on that information.
Flags: needinfo?(khu)
I don't have the answer for comment 6. I checked the codes. Yes, in b2g.js, the value of dom.datastore.enabled depends on RELEASE_BUILD. But, I don't know what the value was when reporting this issue. gtorodelvalle@gmail.com, can you help? Thank you.
Flags: needinfo?(khu) → needinfo?(gtorodelvalle)
No longer blocks: 967412
Blocks: 966076
Hi guys, sorry but I do not have the answers to comment 6. Right now Marcos (the person in charge of our builds here in Telefónica) is having a look at it and he will probably be able to answer them. Thanks!
Flags: needinfo?(gtorodelvalle)
We've been checking, and effectively the problem is that RELEASE_BUILD is defined even for engineering builds (and so we get:

pref("dom.datastore.enabled", false);

on the build b2g.js file).

There's an easy workaround for fixing the bugs this one block, which is to add

pref("dom.datastore.enabled", true);

to Gaia's custom-prefs.js file.

That allows fixing the other bugs, but before 1.3 is closed there should be a definite fix to enable the datastores on release builds (because otherwise there will be a lot of Gaia that will just not work).
Flags: needinfo?(bzbarsky)
Ehsan, what's the state of that API?
Flags: needinfo?(bzbarsky)
Flags: needinfo?(ehsan)
This isn't a build issue. We're seeing this on the Moz side as well, so I'm inclined to think the regression is in gecko.
Broken:

Gecko: 9731b0b7fa78

Working:

Gecko: 3d9d920ca43b
Busted:

Gecko: 9731b0b7fa78
Gaia: bb36b4164d3e51ca04b612e507e1178f80bf240d

Working:

Gecko: 3d9d920ca43b 
Gaia: f9a37c77efb4621a1f57e4695b497d18601fe134
Weird. Absolutely nothing suspicious in the regression range. What's causing this then?
> What's causing this then?

What's causing RELEASE_BUILD to be defined?
Well, 1.3 is based on Gecko 28, right?  Gecko 28 went to beta on 2014-02-03 (the day before this bug was filed) and RELEASE_BUILD is defined on beta.  So I'm guessing that's the "regression": code depending on an API that is explicitly marked as "do not ship in a final release" and us approaching a final release...
There are only no Gecko csets in the range because of the way pushlog works.  Your last good cset was in the same push as http://hg.mozilla.org/releases/mozilla-b2g28_v1_3/rev/a7e600f732f7 which is what "caused" the regression.
It seems clear to me that we rely so much on datastore in gaia now that we should just turn it on unconditionally on b2g. Any objections?
By "unconditionally" do you include all web pages?
Oh, just certified apps.  I personally suspect that's fine, but Ehsan should weigh in.
(In reply to Boris Zbarsky [:bz] from comment #29)
> Oh, just certified apps.  I personally suspect that's fine, but Ehsan should
> weigh in.

Yep, all builds, certified apps. I don't see how that could be an issue.
Making this depend on RELEASE_BUILD was a decision made before gaia started to depend on it.  I was under the impression that we lifted that restriction a while ago but it seems to not be the case.  Here is what we should do now:

Make the API available to certified apps only on all builds in b2g, and nowhere else.
Flags: needinfo?(ehsan)
Attached patch ds.patch (obsolete) — Splinter Review
https://tbpl.mozilla.org/?tree=Try&rev=4995a973aac6

I want to see how B2G emulator reacts to this patch.
Attachment #8370883 - Flags: review?(ehsan)
Comment on attachment 8370883 [details] [diff] [review]
ds.patch

Review of attachment 8370883 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good with the comment below addressed.  Over to Boris for the test_interfaces.html change.

::: dom/webidl/DataStore.webidl
@@ +5,5 @@
>   */
>  
>  typedef (DOMString or unsigned long) DataStoreKey;
>  
> +[Func="Navigator::HasDataStoreSupport",

You want this for DataStoreCursor as well.  Also please modify the tests to check that interface too.
Attachment #8370883 - Flags: review?(ehsan) → review?(bzbarsky)
Comment on attachment 8370883 [details] [diff] [review]
ds.patch

r=me
Attachment #8370883 - Flags: review?(bzbarsky) → review+
Whiteboard: [status:Waiting on Andrea to get tests green to land]
Attached patch ds.patchSplinter Review
bz, I need another quick review. I changed 2 things:

1. HasDataStoreSupport enables DataStore if the callee is Chrome. This is needed because otherwise DataStoreService.js can not do: window.DataStore._create

2. interfaces.html has DataStore for b2g only. The previous patch removed these entries.
Attachment #8370883 - Attachment is obsolete: true
Attachment #8371566 - Flags: review?(bzbarsky)
Comment on attachment 8371566 [details] [diff] [review]
ds.patch

>+  // DataStore is enabled by default for chrome code.

I believe this is not needed on trunk, since we fixed bug 965094.  I'm OK with you landing this as-is with a followup to remove on trunk, or with this landing on trunk without this bit but with this bit on branches.

And tests, of course, to make sure that it really does work.

r=me
Attachment #8371566 - Flags: review?(bzbarsky) → review+
> I believe this is not needed on trunk, since we fixed bug 965094.  I'm OK
> with you landing this as-is with a followup to remove on trunk, or with this
> landing on trunk without this bit but with this bit on branches.

I file a follow up for this.

https://hg.mozilla.org/integration/mozilla-inbound/rev/f81160e35839
Blocks: 968919
Whiteboard: [status:Waiting on Andrea to get tests green to land] → [status:on inbound]
https://hg.mozilla.org/mozilla-central/rev/f81160e35839
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla30
Since I did not include an STR, let me add that if you are able to synchronise with Facebook from the Contacts app and include some Facebook friends in the contact list. This bug can be considered solved and verified ;-)
Tested (02/11/2014)
1.3
Gecko 06f88fa
Gaia 00cd1a

I have imported contacts from Facebook to device, and this is working
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: