John,

I'll take a stab at a sanity check:

Comparing line 35,

var samples = navigator.mozNetworkStats.getSamples(networks.network, start,
end);

with lines 25-27,

networks.onsuccess = function() {
  var network = this.result[0];
}

Was your intention to write "this.network = this.result[0]"?

Also, unless one of the property accesses off mozNetworkStats is spinning
the event loop there after line 27, I'm not sure that networks.network
would be available by the time you get to line 35. I wonder if you're
actually sending an undefined into getSamples, and possibly getting a weird
error from that.

Seems like all the rest of the code really depends on being in
networks.onsuccess(), a la a promise chain, similar to how you handled the
getSamples request.

Geo

On Fri, Feb 20, 2015 at 5:06 PM, John Zeller <[email protected]> wrote:

> Hello!
>
> I am attempting to get network stats on B2G device from certified app via
> WebIDE.
>
> I built a new blank privileged app with WebIDE, then I set the following
> in the manifest:
>
>   "type": "certified",
>   "permissions": {
>     "networkstats-manage": {}
>   },
>
> Now, I'm stuck getting 'uncaught exception: 2147942487', on line 35 of my
> js.
> https://zeller.pastebin.mozilla.org/8822668
>
> When I catch the exception, it's just '2147942487', which is not helpful.
> Googling tells me it seems to be related to a messed up parameter, but
> everything seems to be what is expected, afaik.
>
> Does anyone know what I am missing here?
>
> Best,
> John Zeller
> Website <http://www.johnzeller.com> | Github
> <http://www.github.com/JohnLZeller> | FB
> <http://facebook.com/JohnLukeZeller> | Twitter
> <http://twitter.com/JohnLukeZeller> | G+
> <https://plus.google.com/109697196852908178819/posts> | Resume
> <http://www.johnzeller.com/ZellerJohnResume.pdf>
> [email protected]
> (503) 896-4679 (Text/Call Okay)
>
> _______________________________________________
> dev-b2g mailing list
> [email protected]
> https://lists.mozilla.org/listinfo/dev-b2g
>
>
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g

Reply via email to