Closed
Bug 1123201
Opened 10 years ago
Closed 10 years ago
B2G RIL: Pull the BufObject out from ril_worker.js
Categories
(Firefox OS Graveyard :: RIL, defect)
Tracking
(firefox38 fixed)
RESOLVED
FIXED
Tracking | Status | |
---|---|---|
firefox38 | --- | fixed |
People
(Reporter: gweng, Assigned: gweng)
References
Details
Attachments
(1 file, 6 obsolete files)
(deleted),
patch
|
Details | Diff | Splinter Review |
+++ This bug was initially created as a clone of Bug #1123066 +++
In this bug I want to pull the BufObject out, and discuss if the coding style is adoptable.
Another issue is that I've found that in Gecko people don't use linter tool for JavaScript. So in another experimental patch I try to make ril_worker.js pass JSHint, as Gaia code does. It's helpful since I even fixed other minor bugs and clarify the dependencies by satisfy the requests the linter ask in the patching progress. I would fire another bug with WIP patch to see if we could adopt that for JS files I pull out from ril_worker.js.
Assignee | ||
Updated•10 years ago
|
Summary: B2G RIL: Pull the BufObject out of ril_worker.js → B2G RIL: Pull the BufObject out from ril_worker.js
Assignee | ||
Comment 1•10 years ago
|
||
Hi, since the Try now is green for the patch, I think it's OK to discuss about the changes I made in this patch:
1. Wrap the definition in an anonymous function to prevent leaking. This is a common pattern to split files from the monolithic JavaScript, since we could include it without worrying about name conflicts, and could hide some internal definitions that would be used only in the scope. For example, the next constructor 'TelephonyRequestEntry' is only for the 'TelephonyRequestQueue', which is unnecessary to expose it.
2. Use 'global' comments clarify the dependencies of the file & component. If we want to include the file rather to use module system to indicate the dependencies semantically, it's helpful to add such comments. It's also good for linting tools like JSHint, which help us to catch many possible errors in Gaia.
3. Since I don't know whether to define it as a module is OK or not, I export the constructor to the 'self', namely the 'global' of the worker. It's still apt to turn to the constructor as a module, if the overhead is acceptable.
Please let me know your concerns, thanks.
Attachment #8553441 -
Flags: feedback?(echen)
Assignee | ||
Updated•10 years ago
|
Assignee: nobody → gweng
Assignee | ||
Comment 2•10 years ago
|
||
And the try result is here:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=0b76df3bc687
Comment 3•10 years ago
|
||
(In reply to Greg Weng [:snowmantw][:gweng][:λ] from comment #1)
> Created attachment 8553441 [details] [diff] [review]
> Patch
>
> Hi, since the Try now is green for the patch, I think it's OK to discuss
> about the changes I made in this patch:
>
> 1. Wrap the definition in an anonymous function to prevent leaking. This is
> a common pattern to split files from the monolithic JavaScript, since we
> could include it without worrying about name conflicts, and could hide some
> internal definitions that would be used only in the scope. For example, the
> next constructor 'TelephonyRequestEntry' is only for the
> 'TelephonyRequestQueue', which is unnecessary to expose it.
>
> 2. Use 'global' comments clarify the dependencies of the file & component.
> If we want to include the file rather to use module system to indicate the
> dependencies semantically, it's helpful to add such comments. It's also good
> for linting tools like JSHint, which help us to catch many possible errors
> in Gaia.
>
> 3. Since I don't know whether to define it as a module is OK or not, I
> export the constructor to the 'self', namely the 'global' of the worker.
> It's still apt to turn to the constructor as a module, if the overhead is
> acceptable.
>
> Please let me know your concerns, thanks.
Hi Greg,
Were you attaching a patch of patch? It doesn't show well by bugzilla's diff function.
Assignee | ||
Comment 4•10 years ago
|
||
Assignee | ||
Comment 5•10 years ago
|
||
Try again.
Attachment #8553441 -
Attachment is obsolete: true
Attachment #8553481 -
Attachment is obsolete: true
Attachment #8553441 -
Flags: feedback?(echen)
Assignee | ||
Updated•10 years ago
|
Attachment #8553493 -
Flags: feedback?(echen)
Comment 6•10 years ago
|
||
Comment on attachment 8553493 [details] [diff] [review]
Patch
Review of attachment 8553493 [details] [diff] [review]:
-----------------------------------------------------------------
I'd like to invite Hsinyi and Aknow to have their opinion. :)
Attachment #8553493 -
Flags: feedback?(szchen)
Attachment #8553493 -
Flags: feedback?(htsai)
Comment 7•10 years ago
|
||
Comment on attachment 8553493 [details] [diff] [review]
Patch
Review of attachment 8553493 [details] [diff] [review]:
-----------------------------------------------------------------
Looks pretty good. Thank you.
::: dom/system/gonk/ril_worker_buf_object.js
@@ +20,5 @@
> + * In the old version it has 'init' method while we have the constructor.
> + * This is unnecessary, and since the use cases this files shows that
> + * people would call 'init' after new the object, it could be merge into
> + * the constructor.
> + */
I don't think we need the comment. The code itself is reasonable and doesn't require any further explanation.
@@ +124,5 @@
> + // Before we make sure to form it as a module would not add extra
> + // overhead of module loading, define it in this way rather than
> + // 'module.exports it as a module component.
> + exports.BufObject = BufObject;
> +})(self); /* in worker self is the global */
I will use single line comment style with two leading spaces.
})(self); // in worker self is the global
Updated•10 years ago
|
Attachment #8553493 -
Flags: feedback?(szchen) → feedback+
Comment 8•10 years ago
|
||
Comment on attachment 8553493 [details] [diff] [review]
Patch
Review of attachment 8553493 [details] [diff] [review]:
-----------------------------------------------------------------
It looks good to me, thank you.
::: dom/system/gonk/ril_worker_buf_object.js
@@ +21,5 @@
> + * This is unnecessary, and since the use cases this files shows that
> + * people would call 'init' after new the object, it could be merge into
> + * the constructor.
> + */
> + var BufObject = function(aContext) {
s/var/let/
@@ +122,5 @@
> + };
> +
> + // Before we make sure to form it as a module would not add extra
> + // overhead of module loading, define it in this way rather than
> + // 'module.exports it as a module component.
nit: a redundant "single-quot" or another quote is missing ?
Attachment #8553493 -
Flags: feedback?(htsai) → feedback+
Assignee | ||
Comment 9•10 years ago
|
||
Hi, I've fixed the issues and update the patch.
I don't know who should review this so if it's wrong please tell me.
Also I don't know whether we need a new test file at this stage, since the old tests are still valid and works well. At least at this stage, I don't want to get into too much troubles, and prefer do changes as small as possible. My plan is first to pull out components and important them in the ril_worker.js to keep things work well, and than we could consider to modify the tests to include only the target file, rather than the ril_worker.js.
(Also I need to ask how to land Gecko patch after this get r+...)
Attachment #8555708 -
Flags: review?(szchen)
Comment 10•10 years ago
|
||
Comment on attachment 8553493 [details] [diff] [review]
Patch
Review of attachment 8553493 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good to me, just one small question. Please see comment below. Thank you.
::: dom/system/gonk/ril_worker_buf_object.js
@@ +11,5 @@
> + */
> +(function(exports) {
> +
> + // Set to true in ril_consts.js to see debug messages
> + let DEBUG = DEBUG_WORKER;
Could we just use the global |DEBUG| in ril_worker.js?
Attachment #8553493 -
Flags: feedback?(echen) → feedback+
Comment 11•10 years ago
|
||
Comment on attachment 8555708 [details] [diff] [review]
Patch rev2
Review of attachment 8555708 [details] [diff] [review]:
-----------------------------------------------------------------
Thank you for your work.
r=me with comments addressed.
To land the patches
1. You need to push the patches to try server [1] and make sure that all the tests (only selecting b2g related platforms) are passed.
2. Make sure the commit message is properly formatted [2]. You have to specify the reviewer by something like => COMMIT-SUMMARY. r=[reviewer]
3. Paste the link to the result of try in the comment and set "checkin-needed" in the keyword field.
[1] https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/How_to_Submit_a_Patch#Getting_the_patch_checked_into_the_tree
[2] https://developer.mozilla.org/en-US/docs/Mercurial_FAQ#Commit_Message_Conventions
::: dom/system/gonk/ril_worker_buf_object.js
@@ +5,5 @@
> +
> +"use strict";
> +
> +/**
> + * This is a specialized worker buffer for the Parcel protocal.
s/protocal/protocol
@@ +7,5 @@
> +
> +/**
> + * This is a specialized worker buffer for the Parcel protocal.
> + *
> + * NOTE: To prevent including/importing twice, this file would be included
s/would/should
@@ +8,5 @@
> +/**
> + * This is a specialized worker buffer for the Parcel protocal.
> + *
> + * NOTE: To prevent including/importing twice, this file would be included
> + * in a file already included 'ril_consts.js' and 'require.js'.
in a file which already includes 'ril_consts.js' and 'require.js'.
Attachment #8555708 -
Flags: review?(szchen) → review+
Assignee | ||
Comment 12•10 years ago
|
||
I Fixed the issues above and I'm waiting the try server.
Assignee | ||
Comment 13•10 years ago
|
||
The result should be here:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=90b967776df4
For Edgar in Comment 10: I don't really understand the relations among these debug flags, so I have no idea how they should be at this time.
Assignee | ||
Comment 14•10 years ago
|
||
The Try is green:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=90b967776df4
Assignee | ||
Comment 15•10 years ago
|
||
The same patch, added the review information at the comment.
Attachment #8556377 -
Attachment is obsolete: true
Assignee | ||
Comment 16•10 years ago
|
||
And since the try is green (Comment 14), I now set the checking-needed.
Assignee | ||
Updated•10 years ago
|
Keywords: checkin-needed
Comment 17•10 years ago
|
||
Hi Greg, this patch failed to apply:
applying bug1123201.patch
patching file dom/system/gonk/ril_worker.js
Hunk #2 FAILED at 76
1 out of 3 hunks FAILED -- saving rejects to file dom/system/gonk/ril_worker.js.rej
patch failed, unable to continue (try -v)
patch failed, rejects left in working dir
errors during apply, please fix and refresh bug1123201.patch
could you take a look? Thanks!
Flags: needinfo?(gweng)
Keywords: checkin-needed
Assignee | ||
Comment 18•10 years ago
|
||
Conflcts resolved. I'll trigger Try again later.
Assignee | ||
Comment 19•10 years ago
|
||
Try is green again:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=7f1b77c2e33d
Flags: needinfo?(gweng)
Keywords: checkin-needed
Updated•10 years ago
|
Attachment #8553493 -
Attachment is obsolete: true
Updated•10 years ago
|
Attachment #8555708 -
Attachment is obsolete: true
Updated•10 years ago
|
Attachment #8558999 -
Attachment is obsolete: true
Comment 20•10 years ago
|
||
Keywords: checkin-needed
Assignee | ||
Comment 21•10 years ago
|
||
Well, since it's landed, I close the bug.
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Comment 22•10 years ago
|
||
Gecko bugs are only closed when the code lands on mozilla-central.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Assignee | ||
Comment 23•10 years ago
|
||
Oh, sorry I've confused it with the process of Gaia. Thanks.
Comment 24•10 years ago
|
||
Already landed in m-c, so close it.
https://hg.mozilla.org/mozilla-central/rev/7fb0e0d67e9b
Status: REOPENED → RESOLVED
Closed: 10 years ago → 10 years ago
status-firefox38:
--- → fixed
Resolution: --- → FIXED
Assignee | ||
Updated•10 years ago
|
You need to log in
before you can comment on or make changes to this bug.
Description
•