Closed
Bug 913070
Opened 11 years ago
Closed 11 years ago
[Telemetry] Move TelemetryPing to a .jsm
Categories
(Toolkit :: Telemetry, defect)
Toolkit
Telemetry
Tracking
()
RESOLVED
FIXED
mozilla29
People
(Reporter: Yoric, Assigned: rvitillo)
References
Details
Attachments
(1 file, 7 obsolete files)
62.30 KB,
patch
|
Details | Diff | Splinter Review |
Since nsITelemetryPing is only ever used from JavaScript, we should migrate this to a jsm. This will make our life easier.
Reporter | ||
Comment 1•11 years ago
|
||
This patch does the following:
- move the code of TelemetryPing.js into TelemetryPing.jsm.in;
- expose in TelemetryPing.jsm.in the data that was otherwise obtained by clients by loading TelemetryPing.js using the subscript loader;
- porting clients/tests that used directly TelemetryPing.js to TelemetryPing.jsm;
- porting clients/tests that used the nsITelemetryPing component to TelemetryPing.jsm;
- moving the .jsm files from telemetry to telemetry/modules and from to resource://gre/modules/ to resource://gre/modules/telemetry.
This should simplify the work towards moving some or all of TelemetryPing off the main thread.
Assignee: nobody → dteller
Attachment #804443 -
Flags: review?(nfroyd)
Reporter | ||
Comment 2•11 years ago
|
||
Ooups, TelemetryPing_idle didn't pass. Fixed.
Attachment #804443 -
Attachment is obsolete: true
Attachment #804443 -
Flags: review?(nfroyd)
Attachment #804455 -
Flags: review?(nfroyd)
Comment 3•11 years ago
|
||
Comment on attachment 804455 [details] [diff] [review]
Moving TelemetryPing to a jsm, v2
Review of attachment 804455 [details] [diff] [review]:
-----------------------------------------------------------------
I can't tell through splinter, but please ensure that you |hg cp TelemetryPing.js TelemetryPing.jsm.in|, though I'm not sure that you won't be touching every line anyway...
AIUI, every time somebody imports TelemetryPing.jsm, they get a fresh copy of |Impl|, is that correct? If so, that's not what we want.
I think TelemetryPing.js's observers should still get registered, but you definitely want to double-check.
I'm not entirely clear on how this makes life easier for anybody.
::: toolkit/components/telemetry/moz.build
@@ +5,5 @@
> # file, You can obtain one at http://mozilla.org/MPL/2.0/.
>
> +DIRS += [
> + 'modules',
> +]
You are going to need build peer review for the moz.build changes, though they look sane enough to me.
::: toolkit/components/telemetry/tests/unit/test_TelemetryPing.js
@@ +187,5 @@
> + do_check_true(payload.info.revision.startsWith("http"));
> + } catch(x) {
> + // This check will fail if the repo origin is a local mirror,
> + // so ensure that the failure does not stop the test.
> + }
Please make this a separate bug. This is not the bug to be making changes like this and it's not the right way to fix it.
@@ +348,5 @@
> }
>
> function runInvalidJSONTest() {
> let histogramsFile = getSavedHistogramsFile("invalid-histograms.dat");
> + do_print("histogramsFile: " + histogramsFile.path);
Debugging leftovers.
::: toolkit/components/telemetry/tests/unit/test_ThirdPartyCookieProbe.js
@@ +7,5 @@
>
> Cu.import("resource://gre/modules/Services.jsm");
> Cu.import("resource://gre/modules/XPCOMUtils.jsm");
> +Cu.import("resource://gre/modules/telemetry/TelemetryPing.jsm");
> +Cu.import("resource://gre/modules/telemetry/ThirdPartyCookieProbe.jsm");
Did ThirdPartyCookieProbe.jsm move?
Attachment #804455 -
Flags: review?(nfroyd)
Reporter | ||
Comment 4•11 years ago
|
||
(In reply to Nathan Froyd (:froydnj) (AFK 16-20 September) from comment #3)
> Comment on attachment 804455 [details] [diff] [review]
> Moving TelemetryPing to a jsm, v2
>
> Review of attachment 804455 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> I can't tell through splinter, but please ensure that you |hg cp
> TelemetryPing.js TelemetryPing.jsm.in|, though I'm not sure that you won't
> be touching every line anyway...
Will do.
> AIUI, every time somebody imports TelemetryPing.jsm, they get a fresh copy
> of |Impl|, is that correct? If so, that's not what we want.
As discussed over IRC, that's not what happens.
> I think TelemetryPing.js's observers should still get registered, but you
> definitely want to double-check.
You are right, they remain registered, and we will need to keep (at least of a subset of) the xpcom component for that purpose.
> I'm not entirely clear on how this makes life easier for anybody.
Did I convince you over IRC that xpcom components are the wrong way to provide modularity in JavaScript now that we have js modules?
> ::: toolkit/components/telemetry/tests/unit/test_TelemetryPing.js
> @@ +187,5 @@
> > + do_check_true(payload.info.revision.startsWith("http"));
> > + } catch(x) {
> > + // This check will fail if the repo origin is a local mirror,
> > + // so ensure that the failure does not stop the test.
> > + }
>
> Please make this a separate bug. This is not the bug to be making changes
> like this and it's not the right way to fix it.
Well, it's not meant to be a fix, but sure.
> ::: toolkit/components/telemetry/tests/unit/test_ThirdPartyCookieProbe.js
> @@ +7,5 @@
> >
> > Cu.import("resource://gre/modules/Services.jsm");
> > Cu.import("resource://gre/modules/XPCOMUtils.jsm");
> > +Cu.import("resource://gre/modules/telemetry/TelemetryPing.jsm");
> > +Cu.import("resource://gre/modules/telemetry/ThirdPartyCookieProbe.jsm");
>
> Did ThirdPartyCookieProbe.jsm move?
Yes, I moved the non-public telemetry modules to modules/telemetry.
Reporter | ||
Comment 5•11 years ago
|
||
See above: Nathan, have I managed to convince you that moving to a .jsm is the right thing to do?
Flags: needinfo?(nfroyd)
Comment 6•11 years ago
|
||
(In reply to David Rajchenbach Teller [:Yoric] from comment #5)
> See above: Nathan, have I managed to convince you that moving to a .jsm is
> the right thing to do?
I think so.
Flags: needinfo?(nfroyd)
Assignee | ||
Updated•11 years ago
|
Assignee: dteller → rvitillo
Assignee | ||
Comment 7•11 years ago
|
||
Depends on the patch for bug 742500.
Attachment #804455 -
Attachment is obsolete: true
Attachment #8355251 -
Flags: review?(dteller)
Reporter | ||
Comment 8•11 years ago
|
||
Comment on attachment 8355251 [details] [diff] [review]
913070
Review of attachment 8355251 [details] [diff] [review]:
-----------------------------------------------------------------
Also, I realize that you'll need to create a new XPCOM component (let's call it TelemetryStartup.js) just to watch for profile-after-change and propagate that notification to |TelemetryPing.jsm|. TelemetryStartup should replace TelemetryPing in the .manifest file at the line dealing with profile-before-change. See https://developer.mozilla.org/en-US/docs/XPCOM/Receiving_startup_notifications
Also, please give more meaningful names to your patches when you upload them, e.g. "Moving TelemetryPing to a .jsm, v3".
::: toolkit/components/telemetry/TelemetryPing.js
@@ +12,3 @@
>
> +function TelemetryPing() {
> + Deprecated.warning("nsITelemetryPing is deprecated. Please use TelemetryPing.jsm instead", "FIXME:TODO");
This "FIXME:TODO" should be replaced with the URI of a page documenting TelemetryPing.jsm.
@@ +15,5 @@
> }
>
> +TelemetryPing.prototype = Object.create(JSM.TelemetryPing);
> +TelemetryPing.prototype.classID = Components.ID("{55d6a5fa-130e-4ee6-a158-0133af3b86ba}");
> +TelemetryPing.prototype.QueryInterface = XPCOMUtils.generateQI([Components.interfaces.nsITelemetryPing, Components.interfaces.nsIObserver]);
Let's take the opportunity to remove nsIObserver.
::: toolkit/components/telemetry/TelemetryPing.jsm
@@ +157,5 @@
> + PREF_PREVIOUS_BUILDID: PREF_PREVIOUS_BUILDID,
> + }),
> + /**
> + * Reset TelemetryPing.
> + *
Maybe "only for testing purposes".
::: toolkit/components/telemetry/moz.build
@@ +19,1 @@
> 'ThreadHangStats.h',
For this file, once the rest is complete, you'll need a review from glandium.
::: toolkit/components/telemetry/tests/unit/test_TelemetryPing_idle.js
@@ +1,4 @@
> /* Any copyright is dedicated to the Public Domain.
> http://creativecommons.org/publicdomain/zero/1.0/ */
>
> // Check that TelemetryPing notifies correctly on idle.
Actually, it's idle-daily, could you take the opportunity to update the comment?
::: toolkit/mozapps/extensions/XPIProvider.jsm
@@ +2255,5 @@
> catch (e) { }
>
> + const tmp = {}
> + Cu.import("resource://gre/modules/TelemetryPing.jsm", tmp);
> + tmp.TelemetryPing.setAddOns(data);
Actually, that |tmp| is not very nice.
We can probably do something along the lines of
Cu.import("resource://...", {}).TelemetryPing.setAddons.data
Attachment #8355251 -
Flags: review?(dteller) → feedback+
Assignee | ||
Comment 9•11 years ago
|
||
(In reply to David Rajchenbach Teller [:Yoric] (please use "needinfo?") from comment #8)
> ::: toolkit/components/telemetry/TelemetryPing.jsm
> @@ +157,5 @@
> > + PREF_PREVIOUS_BUILDID: PREF_PREVIOUS_BUILDID,
> > + }),
> > + /**
> > + * Reset TelemetryPing.
> > + *
>
> Maybe "only for testing purposes".
It's already there.
> ::: toolkit/mozapps/extensions/XPIProvider.jsm
> @@ +2255,5 @@
> > catch (e) { }
> >
> > + const tmp = {}
> > + Cu.import("resource://gre/modules/TelemetryPing.jsm", tmp);
> > + tmp.TelemetryPing.setAddOns(data);
>
> Actually, that |tmp| is not very nice.
> We can probably do something along the lines of
> Cu.import("resource://...", {}).TelemetryPing.setAddons.data
The xpcshell testsuite of toolkit/mozapps/extensions hangs if I do that, without showing any particular error.
Assignee | ||
Comment 10•11 years ago
|
||
Attachment #8355251 -
Attachment is obsolete: true
Attachment #8356616 -
Flags: review?(dteller)
Assignee | ||
Comment 11•11 years ago
|
||
Please ignore my last comment.
Attachment #8356616 -
Attachment is obsolete: true
Attachment #8356616 -
Flags: review?(dteller)
Attachment #8357016 -
Flags: review?(dteller)
Reporter | ||
Comment 12•11 years ago
|
||
Comment on attachment 8357016 [details] [diff] [review]
Moving TelemetryPing to a .jsm, v3
Review of attachment 8357016 [details] [diff] [review]:
-----------------------------------------------------------------
r=me with minor stuff below.
Also, don't forget to change your commit message to match our conventions (see e.g. http://blog.bonardo.net/2010/06/22/so-youre-about-to-use-checkin-needed for reference).
::: toolkit/components/telemetry/TelemetryPing.js
@@ +11,4 @@
>
> +function TelemetryPing() {
> + Deprecated.warning("nsITelemetryPing is deprecated. Please use TelemetryPing.jsm instead",
> + "https://bugzilla.mozilla.org/show_bug.cgi?id=913070");
That's ok for the moment, but in a followup, once TelemetryPing.jsm has been cleaned up (i.e. no synchronous APIs), this will need to point rather to a developer.mozilla.org documentation that you'll need to write.
::: toolkit/components/telemetry/TelemetryPing.jsm
@@ +158,5 @@
> + }),
> + /**
> + * Reset TelemetryPing.
> + *
> + * Used for testing purposes.
I meant that you should probably add the word "only" to this documentation.
::: toolkit/components/telemetry/TelemetryStartup.js
@@ +1,5 @@
> +/* -*- js-indent-level: 2; indent-tabs-mode: nil -*- */
> +/* This Source Code Form is subject to the terms of the Mozilla Public
> + * License, v. 2.0. If a copy of the MPL was not distributed with this
> + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
> +
This needs a litte documentation.
Also, "use strict" is generally a good idea.
Attachment #8357016 -
Flags: review?(dteller) → review+
Assignee | ||
Comment 13•11 years ago
|
||
Please review toolkit/components/telemetry/moz.build.
Attachment #8357016 -
Attachment is obsolete: true
Attachment #8357728 -
Flags: review?(mh+mozilla)
Comment 14•11 years ago
|
||
Comment on attachment 8357728 [details] [diff] [review]
913070.diff
Review of attachment 8357728 [details] [diff] [review]:
-----------------------------------------------------------------
Why keep the xpcom component?
Attachment #8357728 -
Flags: review?(mh+mozilla) → review+
Reporter | ||
Comment 15•11 years ago
|
||
(In reply to Mike Hommey [:glandium] from comment #14)
> Why keep the xpcom component?
Backwards compatibility. But it now displays deprecation messages.
Assignee | ||
Updated•11 years ago
|
Keywords: checkin-needed
Comment 16•11 years ago
|
||
(In reply to David Rajchenbach Teller [:Yoric] (please use "needinfo?") from comment #15)
> (In reply to Mike Hommey [:glandium] from comment #14)
> > Why keep the xpcom component?
>
> Backwards compatibility. But it now displays deprecation messages.
Backwards compatibility with what? what would be using that component that isn't in mozilla-central?
Assignee | ||
Updated•11 years ago
|
Keywords: checkin-needed
Comment 17•11 years ago
|
||
Flags: in-testsuite+
Whiteboard: [fixed-in-fx-team]
Comment 18•11 years ago
|
||
Backed out for xpcshell failures. Please run this through Try before requesting checkin again.
https://hg.mozilla.org/integration/fx-team/rev/94e15af5dd4b
https://tbpl.mozilla.org/php/getParsedLog.php?id=32819464&tree=Fx-Team
Comment 19•11 years ago
|
||
The failures seem to be on linux64 only.
Assignee | ||
Comment 20•11 years ago
|
||
Attachment #8357728 -
Attachment is obsolete: true
Assignee | ||
Updated•11 years ago
|
Keywords: checkin-needed
Comment 21•11 years ago
|
||
patching file toolkit/components/telemetry/TelemetryPing.js
Hunk #1 FAILED at 0
1 out of 1 hunks FAILED -- saving rejects to file toolkit/components/telemetry/TelemetryPing.js.rej
Please rebase :(
Keywords: checkin-needed
Whiteboard: [fixed-in-fx-team]
Assignee | ||
Comment 22•11 years ago
|
||
Attachment #8358917 -
Attachment is obsolete: true
Assignee | ||
Updated•11 years ago
|
Keywords: checkin-needed
Comment 23•11 years ago
|
||
Keywords: checkin-needed
Whiteboard: [fixed-in-fx-team]
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Whiteboard: [fixed-in-fx-team]
Target Milestone: --- → mozilla29
You need to log in
before you can comment on or make changes to this bug.
Description
•