Closed
Bug 1055960
Opened 11 years ago
Closed 11 years ago
B2G NFC: onpeerlost won't be called if peerready is reset
Categories
(Firefox OS Graveyard :: NFC, defect)
Tracking
(blocking-b2g:2.1+, firefox33 wontfix, firefox34 fixed, firefox35 fixed, b2g-v2.1 fixed, b2g-v2.2 fixed)
People
(Reporter: allstars.chh, Assigned: allstars.chh)
References
Details
(Keywords: regression, Whiteboard: [p=2])
Attachments
(3 files, 2 obsolete files)
12.08 KB,
patch
|
dimi
:
review+
bajaj
:
approval-mozilla-aurora+
|
Details | Diff | Splinter Review |
1.86 KB,
patch
|
dimi
:
review+
bajaj
:
approval-mozilla-aurora+
|
Details | Diff | Splinter Review |
3.61 KB,
patch
|
allstars.chh
:
review+
bajaj
:
approval-mozilla-aurora+
|
Details | Diff | Splinter Review |
By definition onpeerlost should be called when the peer got in the peerready is lost.
So considering following case:
nfc.onpeerready = function () {
...
nfc.onpeeready = null;
};
nfc.onpeerlost = function () {
};
inside onpeerready callback, it reset the handler to null so onpeerlost won't be fired.
Assignee | ||
Updated•11 years ago
|
Whiteboard: [good first bug]
Assignee | ||
Updated•11 years ago
|
Summary: B2G NFC: onpeer lost won't be called if peerready is reset → B2G NFC: onpeerlost won't be called if peerready is reset
Assignee | ||
Comment 1•11 years ago
|
||
[Blocking Requested - why for this release]:
regression from Bug 1043186
blocking-b2g: --- → 2.1?
Assignee | ||
Updated•11 years ago
|
Assignee: nobody → allstars.chh
Whiteboard: [good first bug]
Assignee | ||
Comment 2•11 years ago
|
||
I'll fix three problems in this bug
1. Comment 0
2. only needs notifyUserAcceptedP2P to trigger onpeerready.
3. notifyPeerLost will check IsPeerReadyCalled, however it's buggy for if the 1st time onpeerready/onpeerlost both have been called, in the 2nd tech-discovered, we didn't do the Swipe (not calling notifyUserAcceptedP2P), and in the 2nd tech-lost, onpeerlost will still be called.
Assignee | ||
Comment 3•11 years ago
|
||
Assignee | ||
Updated•11 years ago
|
Attachment #8481231 -
Flags: review?(dlee)
Assignee | ||
Comment 4•11 years ago
|
||
Comment on attachment 8481231 [details] [diff] [review]
Patch
Review of attachment 8481231 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/nfc/gonk/Nfc.js
@@ +226,5 @@
> +
> + // For peerlost, the message is delievered to the target which
> + // onpeerready has been called before.
> + this.notifyPeerEvent(this.currentPeer, NFC.NFC_PEER_EVENT_LOST, sessionToken);
> + this.currentPeer = null;
this.currentPeer should be also set to null if the target is killed.
Assignee | ||
Updated•11 years ago
|
Attachment #8481231 -
Flags: review?(dlee)
Assignee | ||
Comment 5•11 years ago
|
||
- remove this.currentPee in removeTarget
- remove function isPeerReadyTarget
Attachment #8481231 -
Attachment is obsolete: true
Attachment #8482061 -
Flags: review?(dlee)
Comment 6•11 years ago
|
||
Comment on attachment 8482061 [details] [diff] [review]
Part 1: fix onpeerlost.
Review of attachment 8482061 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good, thanks
::: dom/nfc/gonk/Nfc.js
@@ +176,5 @@
> },
>
> + notifyPeerEvent: function notifyPeerEvent(target, event, sessionToken) {
> + if (!target) {
> + dump("invalid target");
debug
Attachment #8482061 -
Flags: review?(dlee) → review+
Assignee | ||
Comment 7•11 years ago
|
||
(In reply to Dimi Lee[:dimi][:dlee] from comment #6)
> > + notifyPeerEvent: function notifyPeerEvent(target, event, sessionToken) {
> > + if (!target) {
> > + dump("invalid target");
>
> debug
It is my intention to use dump since callers have checked 'target' before calling this.
However if target is still null/undefined when this function is called, error will be thrown.
Comment 8•11 years ago
|
||
(In reply to Yoshi Huang[:allstars.chh] from comment #7)
> (In reply to Dimi Lee[:dimi][:dlee] from comment #6)
> > > + notifyPeerEvent: function notifyPeerEvent(target, event, sessionToken) {
> > > + if (!target) {
> > > + dump("invalid target");
> >
> > debug
>
> It is my intention to use dump since callers have checked 'target' before
> calling this.
> However if target is still null/undefined when this function is called,
> error will be thrown.
ok!
Assignee | ||
Updated•11 years ago
|
Attachment #8482061 -
Attachment description: Patch v2. → Part 1: fix onpeerlost.
Assignee | ||
Comment 9•11 years ago
|
||
When fixing removePeerTarget also found targetsByRequestId also has this problem
Attachment #8482102 -
Flags: review?(dlee)
Updated•11 years ago
|
Attachment #8482102 -
Flags: review?(dlee) → review+
Assignee | ||
Comment 10•11 years ago
|
||
Assignee | ||
Comment 11•11 years ago
|
||
add checkin-needed for b2g-inbound is close.
Keywords: checkin-needed
Updated•11 years ago
|
blocking-b2g: 2.1? → 2.1+
Assignee | ||
Updated•11 years ago
|
Keywords: checkin-needed
Assignee | ||
Comment 12•11 years ago
|
||
Attachment #8482653 -
Flags: review?(dlee)
Assignee | ||
Updated•11 years ago
|
Attachment #8482653 -
Flags: review?(dlee)
Assignee | ||
Updated•11 years ago
|
Attachment #8482653 -
Flags: review?(dlee)
Updated•11 years ago
|
Keywords: regression
Comment 13•11 years ago
|
||
Comment on attachment 8482653 [details] [diff] [review]
Part 3: fix tests case.
Review of attachment 8482653 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/nfc/tests/marionette/test_nfc_error_messages.js
@@ +101,5 @@
> nfc.onpeerready = null;
> deferred.resolve();
> };
>
> + nfc.notifyUserAcceptedP2P(MANIFEST_URL);
Just curious about removing checkP2PRegistration here because of |this.currentPeerAppId| is removed
so we don't have to call checkP2PRegistration anymore ?
@@ +106,4 @@
> return deferred.promise;
> }
>
> +function sendNDEFExpectError(peer) {
Nits. remove caller with errorMsg parameter
Attachment #8482653 -
Flags: review?(dlee) → review+
Assignee | ||
Comment 14•11 years ago
|
||
(In reply to Dimi Lee[:dimi][:dlee] from comment #13)
> Comment on attachment 8482653 [details] [diff] [review]
> Part 3: fix tests case.
>
> Review of attachment 8482653 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> ::: dom/nfc/tests/marionette/test_nfc_error_messages.js
> @@ +101,5 @@
> > nfc.onpeerready = null;
> > deferred.resolve();
> > };
> >
> > + nfc.notifyUserAcceptedP2P(MANIFEST_URL);
>
> Just curious about removing checkP2PRegistration here because of
> |this.currentPeerAppId| is removed
> so we don't have to call checkP2PRegistration anymore ?
Yeah, remove checkP2PRegistration since now this.currentPeer is set in notifyUserAcceptedP2P.
In the original code you will find that the onpeerlost will be notified only if checkP2PRegistration is called because this.currentPeerAppId is set in checkP2PRegistration.
In this test file we want onpeeready to be called, checkP2PRegitraion should be tests in the file test_nfc_checkP2PRegistation.js
Assignee | ||
Comment 15•11 years ago
|
||
Attachment #8482653 -
Attachment is obsolete: true
Attachment #8483932 -
Flags: review+
Assignee | ||
Comment 16•11 years ago
|
||
https://hg.mozilla.org/integration/b2g-inbound/rev/d7c70397b4e1
https://hg.mozilla.org/integration/b2g-inbound/rev/864b7828b156
https://hg.mozilla.org/integration/b2g-inbound/rev/a834ac4ed741
Try: https://tbpl.mozilla.org/?tree=Try&rev=31b2e3037045
Whiteboard: [p=2]
Target Milestone: --- → 2.1 S4 (12sep)
https://hg.mozilla.org/mozilla-central/rev/d7c70397b4e1
https://hg.mozilla.org/mozilla-central/rev/864b7828b156
https://hg.mozilla.org/mozilla-central/rev/a834ac4ed741
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Comment 18•11 years ago
|
||
Note that due to recent policy changes, all patches must have approval for uplift regardless of blocking status. Please request aurora approval on these patches when you get a chance. Sorry for the inconvenience :(
status-b2g-v2.1:
--- → affected
status-b2g-v2.2:
--- → fixed
status-firefox33:
--- → wontfix
status-firefox34:
--- → affected
status-firefox35:
--- → fixed
Flags: needinfo?(allstars.chh)
Assignee | ||
Updated•11 years ago
|
Assignee | ||
Comment 19•11 years ago
|
||
Comment on attachment 8482061 [details] [diff] [review]
Part 1: fix onpeerlost.
Approval Request Comment
[Feature/regressing bug #]:
Bug 1043186
[User impact if declined]:
onpeerlost can not be notified, so Gaia apps cannot know the MozNFCPeer is invalid so the object cannot be GCed.
[Describe test coverage new/current, TBPL]:
Marionette-webapi
[Risks and why]:
No
[String/UUID change made/needed]:
No
Attachment #8482061 -
Flags: approval-mozilla-aurora?
Assignee | ||
Comment 20•11 years ago
|
||
Comment on attachment 8482102 [details] [diff] [review]
Part 2: add removeTarget
Approval Request Comment
Same with Part 1.
Attachment #8482102 -
Flags: approval-mozilla-aurora?
Assignee | ||
Comment 21•11 years ago
|
||
Comment on attachment 8483932 [details] [diff] [review]
Part 3: fix tests case. v2
Approval Request Comment
Same with Part1.
Attachment #8483932 -
Flags: approval-mozilla-aurora?
Updated•11 years ago
|
Attachment #8482061 -
Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Updated•11 years ago
|
Attachment #8482102 -
Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Updated•11 years ago
|
Attachment #8483932 -
Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Comment 22•11 years ago
|
||
You need to log in
before you can comment on or make changes to this bug.
Description
•