Closed Bug 988254 Opened 11 years ago Closed 11 years ago

NFC: this.defaultAdapter is null from nfc_handover_manager.js

Categories

(Firefox OS Graveyard :: NFC, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
1.4 S5 (11apr)

People

(Reporter: allstars.chh, Assigned: arno)

References

Details

Attachments

(1 file)

03-25 07:23:17.876: E/GeckoConsole(179): [JavaScript Error: "this.defaultAdapter is null" {file: "app://system.gaiamobile.org/js/nfc_handover_manager.js" line: 232}] 03-25 07:23:17.876: E/GeckoConsole(179): [JavaScript Error: "NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS: [JavaScript Error: "this.defaultAdapter is null" {file: "app://system.gaiamobile.org/js/nfc_handover_manager.js" line: 232}]'[JavaScript Error: "this.defaultAdapter is null" {file: "app://system.gaiamobile.org/js/nfc_handover_manager.js" line: 232}]' when calling method: [nsIDOMSystemMessageCallback::handleMessage]" {file: "null" line: 0}] STR: 1. enable bluetooth from Settings 2. reboot 3. Go to Galley, select an image and try to use Shrinking UI to transfer the image 4. When the user slides the Shrinking UI, there's an error from nfc_handover_manager.js I think the bluetooth-adapter-added event in https://github.com/mozilla-b2g/gaia/blob/master/apps/system/js/nfc_handover_manager.js#L86 only come when Bluetooth is enabled, so if you reboot after enabled bluetooth, the object defaultAdapter in nfc_handover_manager.js will still be null.
Component: Gaia::System → NFC
Flags: needinfo?(dgarnerlee)
I'll take a look. We might need to re-query for the bluetooth-adapter (somehow) if it is reboot, or maybe enforce initialization order if the events are going to miss their targets.
Assignee: nobody → arno
I'll look into it.
Flags: needinfo?(dgarnerlee)
It seems that the bluetooth-adapter-added event was fired after boot when BT was already enabled for older versions of gecko. This behavior seems to have changed in a recent version. Eric: for my peace of mind, can you confirm this?
Flags: needinfo?(echou)
Attachment #8402984 - Flags: review?(ehung)
(In reply to arno from comment #3) > It seems that the bluetooth-adapter-added event was fired after boot when BT > was already enabled for older versions of gecko. This behavior seems to have > changed in a recent version. Eric: for my peace of mind, can you confirm > this? Gaia remembers the status of Bluetooth before powered off and would try to enable Bluetooth at startup, and bluetooth-adapteradded would be fired when Bluetooth is enabled. In such case, as long as the event handler is hooked before firing the event, you should be able to receive it. But I'm not sure if the timing of "Gaia tries to enable Bluetooth" was changed.
Flags: needinfo?(echou)
Comment on attachment 8402984 [details] Proper initialization in Handover Manager if BT is already enabled at boot There is a code segment in Settings app do the same thing.
Attachment #8402984 - Flags: review?(ehung) → review+
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → 1.4 S6 (25apr)
Target Milestone: 1.4 S6 (25apr) → 1.4 S5 (11apr)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: