Closed
Bug 889185
Opened 11 years ago
Closed 11 years ago
Send OrderedBroadcast.js token to Java and distinguish between null and default permissions
Categories
(Firefox for Android Graveyard :: General, defect)
Tracking
(firefox24 wontfix, firefox25 fixed)
RESOLVED
FIXED
Firefox 25
People
(Reporter: cpeterson, Assigned: cpeterson)
References
Details
Attachments
(2 files)
(deleted),
patch
|
rnewman
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
rnewman
:
review+
nalexander
:
feedback+
|
Details | Diff | Splinter Review |
Patch 1 was written by nalexander.
Attachment #769986 -
Flags: review?(rnewman)
Assignee | ||
Comment 1•11 years ago
|
||
Part 2: Distinguish between OrderedBroadcasts with null and default/undefined permissions.
Attachment #769989 -
Flags: review?(rnewman)
Attachment #769989 -
Flags: feedback?(nalexander)
Comment 2•11 years ago
|
||
Comment on attachment 769989 [details] [diff] [review]
part-2-OrderedBroadcast-permissions.patch
Review of attachment 769989 [details] [diff] [review]:
-----------------------------------------------------------------
Address tests, r=nalexander.
::: mobile/android/base/OrderedBroadcastHelper.java
@@ +78,5 @@
>
> + // A missing (undefined) permission means the intent will be limited
> + // to the current package. A null means no permission, so any
> + // package can receive the intent.
> + final String permission = message.has("permission")
Does this look better with isNull ? optString(..., PER_ANDROID_PACKAGE_PERMISSION)?
::: mobile/android/modules/OrderedBroadcast.jsm
@@ +79,5 @@
> type: "OrderedBroadcast:Send",
> action: action,
> responseEvent: responseEvent,
> token: { callbackId: callbackId, data: token || null },
> + permission: permission,
This should break the tests. If it doesn't, something is seriously wrong. Please verify and update the tests.
Attachment #769989 -
Flags: feedback?(nalexander) → feedback+
Assignee | ||
Comment 3•11 years ago
|
||
Green try tests:
https://tbpl.mozilla.org/?tree=Try&rev=23111a39ccd9
Comment 4•11 years ago
|
||
(In reply to Chris Peterson (:cpeterson) from comment #3)
> Green try tests:
> https://tbpl.mozilla.org/?tree=Try&rev=23111a39ccd9
Fair enough. Looking at the tests again, I see how this happens. Bonus points for testing the new functionality, but you'd need to add an additional permission protected test receiver and I'm not that concerned about it. This is mostly for calling Fennec receivers anyway, and JS callers will quickly find out if their permissions are incorrect.
Assignee | ||
Comment 5•11 years ago
|
||
(In reply to Nick Alexander :nalexander from comment #2)
> Does this look better with isNull ? optString(..., PER_ANDROID_PACKAGE_PERMISSION)?
I don't think this code can be simplified with optString(). If a permission value exists and is null, optString() will return the string "null" instead of null. isNull() will return null if a value exists and is null or if a value does not exist (undefined), so we still need to check has("permission") to differentiate between null and undefined values.
Comment 6•11 years ago
|
||
Comment on attachment 769989 [details] [diff] [review]
part-2-OrderedBroadcast-permissions.patch
Review of attachment 769989 [details] [diff] [review]:
-----------------------------------------------------------------
::: mobile/android/base/OrderedBroadcastHelper.java
@@ +80,5 @@
> + // to the current package. A null means no permission, so any
> + // package can receive the intent.
> + final String permission = message.has("permission")
> + ? (message.isNull("permission") ? null : message.getString("permission"))
> + : GlobalConstants.PER_ANDROID_PACKAGE_PERMISSION;
Nit: prefer operators at end of line, like the rest of the file.
::: mobile/android/modules/OrderedBroadcast.jsm
@@ +84,1 @@
> });
For the record, this direct attributing works because of rule JO#8 in <http://es5.github.io/#x15.12.3>, which specifies that undefined-valued attributes aren't serialized... because JSONObject will parse them as the string "undefined", which would get treated as a permission.
Glad I checked that :P
Attachment #769989 -
Flags: review?(rnewman) → review+
Updated•11 years ago
|
Attachment #769986 -
Flags: review?(rnewman) → review+
Assignee | ||
Comment 7•11 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/f43a6971bb1b
https://hg.mozilla.org/integration/mozilla-inbound/rev/b6bf318e6a90
Fixed operators at end of line noted in comment 6.
status-firefox24:
--- → wontfix
status-firefox25:
--- → fixed
Comment 8•11 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/f43a6971bb1b
https://hg.mozilla.org/mozilla-central/rev/b6bf318e6a90
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 25
Updated•4 years ago
|
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•