Closed
Bug 949242
Opened 12 years ago
Closed 12 years ago
[inter-app-comm-api] Wrongly filters out messages when the page has a hash
Categories
(Core :: DOM: Device Interfaces, defect)
Core
DOM: Device Interfaces
Tracking
()
RESOLVED
FIXED
mozilla29
People
(Reporter: kgrandon, Assigned: kgrandon)
References
Details
(Whiteboard: [c= p=2 s=2014.01.17 u=])
Attachments
(1 file, 3 obsolete files)
|
904 bytes,
patch
|
Details | Diff | Splinter Review |
See: http://mxr.mozilla.org/mozilla-central/source/dom/apps/src/InterAppMessagePort.js#192
When a page changes its hash value, it should still receive messages.
| Assignee | ||
Comment 1•12 years ago
|
||
There's probably a better way of doing this. Feel free to take this patch over if you'd like. Thanks.
Attachment #8346252 -
Flags: feedback?(gene.lian)
Comment 2•12 years ago
|
||
Thanks Kevin for catching this. So, If we have two pages URL:
app://pubApp.gaiamobile.org/handler.html?aaa
app://pubApp.gaiamobile.org/handler.html?bbb
and each of them hold a port waiting to receive message. Under this circumstance, the page ?aaa will receive the message that is supposed to be sent to ?bbb. It doesn't sound reasonable to me.
Or these two pages ?aaa and ?bbb actually represent the *same* page in reality? If yes, I think I can then pass the review. :)
Updated•12 years ago
|
Flags: needinfo?(kgrandon)
Comment 3•12 years ago
|
||
Hi Fabrice, I'd like to ask one quick question: do we have any existing utility functions to remove the suffix of |?...| or |#...|? For example,
app://pubApp.gaiamobile.org/handler.html?aaa -> app://pubApp.gaiamobile.org/handler.html
app://pubApp.gaiamobile.org/handler.html#aaa -> app://pubApp.gaiamobile.org/handler.html
Flags: needinfo?(fabrice)
| Assignee | ||
Comment 4•12 years ago
|
||
(In reply to Gene Lian [:gene] (needinfo? encouraged) from comment #2)
> Or these two pages ?aaa and ?bbb actually represent the *same* page in
> reality? If yes, I think I can then pass the review. :)
Honestly I suppose it would be up to each application as to whether or not it would consider them a "page". After thinking about it, I suppose my recommendation here would be to actually stop using a string and use a regex pattern instead. This patch would be a larger change, and I'm not sure how to go about proposing it or making it.
This is similar to how we filter in web activities, and may end up being more flexible. E.g.:
"connections": {
"my-connection": {
"pattern": "/(foo|bar)\.html.*",
"rules": {}
}
}
Flags: needinfo?(kgrandon)
Comment 5•12 years ago
|
||
(In reply to Gene Lian [:gene] (needinfo? encouraged) from comment #3)
> Hi Fabrice, I'd like to ask one quick question: do we have any existing
> utility functions to remove the suffix of |?...| or |#...|? For example,
>
> app://pubApp.gaiamobile.org/handler.html?aaa ->
> app://pubApp.gaiamobile.org/handler.html
> app://pubApp.gaiamobile.org/handler.html#aaa ->
> app://pubApp.gaiamobile.org/handler.html
Try nsIURI.ref http://mxr.mozilla.org/mozilla-central/source/netwerk/base/public/nsIURI.idl#225
Comment 6•12 years ago
|
||
Yes, you can use URI.specIgnoringRef for the #, and probably just string search for "?". Another way may be to resolve "." against the current url, that should strip query parameters and ref.
Flags: needinfo?(fabrice)
| Assignee | ||
Comment 7•12 years ago
|
||
Gene, Fabrice -
What are your thoughts on using a pattern here instead (or in addition) to allow maximum flexibility for developers?
Flags: needinfo?(gene.lian)
Flags: needinfo?(fabrice)
Comment 8•12 years ago
|
||
(In reply to Kevin Grandon :kgrandon from comment #7)
> Gene, Fabrice -
>
> What are your thoughts on using a pattern here instead (or in addition) to
> allow maximum flexibility for developers?
If you don't have a concrete use case that needs pattern, I'm very tempted to say "no"!
Flags: needinfo?(fabrice)
| Assignee | ||
Comment 9•12 years ago
|
||
(In reply to Fabrice Desré [:fabrice] from comment #8)
> (In reply to Kevin Grandon :kgrandon from comment #7)
> If you don't have a concrete use case that needs pattern, I'm very tempted
> to say "no"!
Ok, then I suppose I would be happy if we just strip querystrings and hashes for now.
Flags: needinfo?(gene.lian)
| Assignee | ||
Comment 10•12 years ago
|
||
Comment on attachment 8346252 [details] [diff] [review]
naive-patch.patch
Review of attachment 8346252 [details] [diff] [review]:
-----------------------------------------------------------------
Hi Gene - Swapping this over to a review if you think this is good enough. I'm not really sure how to utilize specIgnoringRef, and I think that this is a pretty clean way of solving the problem. If you think that it would be better to explore using some other utility, we can certainly try.
Attachment #8346252 -
Flags: feedback?(gene.lian) → review?(gene.lian)
Updated•12 years ago
|
No longer blocks: inter-app-comm-api
Depends on: inter-app-comm-api
Comment 11•12 years ago
|
||
Hi Kevin, could you please try uri.specIgnoringRef first to ignore the ref? I guess it's something like:
uri = Services.io.newURI(pageURL, null, null);
pageURL = uri.specIgnoringRef;
Updated•12 years ago
|
Attachment #8346252 -
Flags: review?(gene.lian)
| Assignee | ||
Comment 12•12 years ago
|
||
Potential new patch, testing it.
Assignee: nobody → kgrandon
Attachment #8346252 -
Attachment is obsolete: true
Status: NEW → ASSIGNED
| Assignee | ||
Updated•12 years ago
|
Whiteboard: [c= p=2 s= u=]
| Assignee | ||
Comment 13•12 years ago
|
||
Comment on attachment 8355237 [details] [diff] [review]
Bug-949242-inter-app-comm-api-Wrongly-filters-out-me.patch
Fabrice - maybe you could also review this one since Gene is out till the 7th?
Attachment #8355237 -
Flags: review?(gene.lian)
Attachment #8355237 -
Flags: review?(fabrice)
Comment 14•12 years ago
|
||
Comment on attachment 8355237 [details] [diff] [review]
Bug-949242-inter-app-comm-api-Wrongly-filters-out-me.patch
Review of attachment 8355237 [details] [diff] [review]:
-----------------------------------------------------------------
lgtm, but I'm not very familiar with this api design. Fernando, can you take over Gene review?
::: dom/apps/src/InterAppMessagePort.js
@@ +60,5 @@
> this._manifestURL = appsService.getManifestURLByLocalId(principal.appId);
> + this._pageURL = principal.URI.specIgnoringRef;
> +
> + // Remove querystrings
> + this._pageURL = this._pageURL.split('?')[0];
nit: strings use double quotes in this file.
Attachment #8355237 -
Flags: review?(gene.lian)
Attachment #8355237 -
Flags: review?(ferjmoreno)
Attachment #8355237 -
Flags: review?(fabrice)
Attachment #8355237 -
Flags: review+
| Assignee | ||
Comment 15•12 years ago
|
||
Updating quote style.
Attachment #8355237 -
Attachment is obsolete: true
Attachment #8355237 -
Flags: review?(ferjmoreno)
Attachment #8355450 -
Flags: review?(ferjmoreno)
Comment 16•12 years ago
|
||
Comment on attachment 8355450 [details] [diff] [review]
Bug-949242-inter-app-comm-api-Wrongly-filters-out-me.patch
Review of attachment 8355450 [details] [diff] [review]:
-----------------------------------------------------------------
Thanks Kevin for the update and Fabrice for the first review.
r=gene
::: dom/apps/src/InterAppMessagePort.js
@@ +59,5 @@
> let principal = aWindow.document.nodePrincipal;
> this._manifestURL = appsService.getManifestURLByLocalId(principal.appId);
> + this._pageURL = principal.URI.specIgnoringRef;
> +
> + // Remove querystrings
nit: comment format should be:
//[one_space][upper_case_letter]...[one_period]
so, this comment should be:
// Remove query string.
Note that I added one space between "query" and "string" as well because it's supposed to be separate in a formal definition [1].
[1] http://en.wikipedia.org/wiki/Query_string
Attachment #8355450 -
Flags: review?(ferjmoreno) → review+
| Assignee | ||
Comment 17•12 years ago
|
||
| Assignee | ||
Updated•12 years ago
|
Attachment #8355450 -
Attachment is obsolete: true
| Assignee | ||
Comment 18•12 years ago
|
||
| Assignee | ||
Comment 19•12 years ago
|
||
Adding checkin-needed for: https://bugzilla.mozilla.org/attachment.cgi?id=8356084
Keywords: checkin-needed
Comment 20•12 years ago
|
||
Keywords: checkin-needed
Comment 21•12 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla29
Updated•12 years ago
|
Whiteboard: [c= p=2 s= u=] → [c= p=2 s=2013.01.17 u=]
| Assignee | ||
Comment 22•12 years ago
|
||
Gene - I also think it would be very important to follow-up with some unit test for this. I'm not too familiar with the best way to test gecko code - or what the best testing strategy here would be. Could you give me any pointers for looking at this?
Flags: needinfo?(gene.lian)
Updated•12 years ago
|
Whiteboard: [c= p=2 s=2013.01.17 u=] → [c= p=2 s=2014.01.17 u=]
Comment 23•12 years ago
|
||
(In reply to Kevin Grandon :kgrandon from comment #22)
> Gene - I also think it would be very important to follow-up with some unit
> test for this. I'm not too familiar with the best way to test gecko code -
> or what the best testing strategy here would be. Could you give me any
> pointers for looking at this?
Yes. Bug 915884, which is almost done. Sorry that I'm too busy to keep working on that. Hope I can finish that this week.
Flags: needinfo?(gene.lian)
Updated•11 years ago
|
Blocks: inter-app-comm-api
No longer depends on: inter-app-comm-api
You need to log in
before you can comment on or make changes to this bug.
Description
•