Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Bug 807881 - [Bluetooth] Need to check SDCard status before receiving file by other devices #6247

Merged

Conversation

ian-liu
Copy link
Contributor

@ian-liu ian-liu commented Nov 7, 2012

No description provided.

@ian-liu
Copy link
Contributor Author

ian-liu commented Nov 7, 2012

/botio lint

@ghost
Copy link

ghost commented Nov 7, 2012

From: Bot.io (Main)


Received

Command cmd_lint from @ian-liu received. Current queue size: 2

Live output at: http://50.116.11.35:8000/05995e59de6e0bd/output.txt

@ghost
Copy link

ghost commented Nov 7, 2012

From: Bot.io (Main)


Failed

Full output at http://50.116.11.35:8000/05995e59de6e0bd/output.txt

Total script time: 3.59 mins

Lint: FAILED
----/bin/bash: warning: setlocale: LC_ALL: cannot change locale (zh_TW.UTF-8)
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (zh_TW.UTF-8)
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (zh_TW.UTF-8)
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (zh_TW.UTF-8)
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (zh_TW.UTF-8)
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (zh_TW.UTF-8)
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (zh_TW.UTF-8)
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (zh_TW.UTF-8)
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (zh_TW.UTF-8)
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (zh_TW.UTF-8)
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (zh_TW.UTF-8)
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (zh_TW.UTF-8)
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (zh_TW.UTF-8)
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (zh_TW.UTF-8)
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (zh_TW.UTF-8)
Skipping 42 file(s).
----- /apps/calendar/js/template.js
85, E:0002: Missing space before "-"
85, E:0002: Missing space after "-"
86, E:0002: Missing space before "+"
86, E:0002: Missing space after "+"
86, E:0002: Missing space before "+"
86, E:0002: Missing space after "+"
104, E:0131: Single-quoted string preferred over double-quoted string.
107, E:0131: Single-quoted string preferred over double-quoted string.
109, E:0131: Single-quoted string preferred over double-quoted string.
----- /apps/clock/js/alarm.js
357, E:0110: Line too long (89 characters).
----- /apps/communications/contacts/test/integration/app.js
60, E:0110: Line too long (82 characters).
----- /apps/communications/contacts/test/integration/launch_test.js
9, E:0131: Single-quoted string preferred over double-quoted string.
11, E:0131: Single-quoted string preferred over double-quoted string.
11, E:0131: Single-quoted string preferred over double-quoted string.
12, E:0131: Single-quoted string preferred over double-quoted string.
12, E:0131: Single-quoted string preferred over double-quoted string.
13, E:0131: Single-quoted string preferred over double-quoted string.
13, E:0131: Single-quoted string preferred over double-quoted string.
14, E:0131: Single-quoted string preferred over double-quoted string.
14, E:0131: Single-quoted string preferred over double-quoted string.
17, E:0131: Single-quoted string preferred over double-quoted string.
19, E:0131: Single-quoted string preferred over double-quoted string.
19, E:0131: Single-quoted string preferred over double-quoted string.
22, E:0131: Single-quoted string preferred over double-quoted string.
22, E:0131: Single-quoted string preferred over double-quoted string.
23, E:0131: Single-quoted string preferred over double-quoted string.
23, E:0131: Single-quoted string preferred over double-quoted string.
24, E:0131: Single-quoted string preferred over double-quoted string.
24, E:0131: Single-quoted string preferred over double-quoted string.
25, E:0131: Single-quoted string preferred over double-quoted string.
27, E:0131: Single-quoted string preferred over double-quoted string.
27, E:0131: Single-quoted string preferred over double-quoted string.
28, E:0131: Single-quoted string preferred over double-quoted string.
28, E:0131: Single-quoted string preferred over double-quoted string.
31, E:0131: Single-quoted string preferred over double-quoted string.
31, E:0131: Single-quoted string preferred over double-quoted string.
98, E:0131: Single-quoted string preferred over double-quoted string.
98, E:0010: Missing semicolon at end of line
105, E:0110: Line too long (81 characters).
155, E:0131: Single-quoted string preferred over double-quoted string.
177, E:0131: Single-quoted string preferred over double-quoted string.
177, E:0010: Missing semicolon at end of line
222, E:0110: Line too long (92 characters).
273, E:0110: Line too long (81 characters).
275, E:0110: Line too long (81 characters).
331, E:0110: Line too long (81 characters).
----- /apps/email/js/console-hook.js
4, E:0131: Single-quoted string preferred over double-quoted string.
6, E:0131: Single-quoted string preferred over double-quoted string.
8, E:0131: Single-quoted string preferred over double-quoted string.
12, E:0001: Extra space after ":"
14, E:0001: Extra space after ":"
15, E:0001: Extra space after ":"
19, E:0131: Single-quoted string preferred over double-quoted string.
19, E:0131: Single-quoted string preferred over double-quoted string.
19, E:0131: Single-quoted string preferred over double-quoted string.
----- /apps/homescreen/js/state.js
250, E:0110: Line too long (83 characters).
----- /apps/keyboard/test/unit/latin_test.js
29, E:0002: Missing space before "-"
29, E:0002: Missing space after "-"
31, E:0001: Extra space at end of line
42, E:0121: Illegal comma at end of object literal
49, E:0001: Extra space at end of line
55, E:0002: Missing space before "("
66, E:0002: Missing space before "("
74, E:0001: Extra space at end of line
80, E:0001: Extra space at end of line
86, E:0001: Extra space at end of line
97, E:0121: Illegal comma at end of array literal
112, E:0131: Single-quoted string preferred over double-quoted string.
132, E:0121: Illegal comma at end of object literal
133, E:0010: Missing semicolon at end of line
148, E:0121: Illegal comma at end of object literal
169, E:0002: Missing space before "-"
169, E:0002: Missing space after "-"
188, E:0002: Missing space before "-"
188, E:0002: Missing space after "-"
211, E:0002: Missing space before "-"
211, E:0002: Missing space after "-"
215, E:0002: Missing space before "-"
215, E:0002: Missing space after "-"
227, E:0001: Extra space at end of line
234, E:0131: Single-quoted string preferred over double-quoted string.
235, E:0002: Missing space before "("
237, E:0002: Missing space before "("
239, E:0002: Missing space before "("
241, E:0002: Missing space before "("
242, E:0010: Missing semicolon at end of line
270, E:0001: Extra space at end of line
272, E:0002: Missing space before "("
273, E:0001: Extra space at end of line
290, E:0001: Extra space at end of line
294, E:0001: Extra space at end of line
296, E:0001: Extra space at end of line
311, E:0001: Extra space at end of line
332, E:0001: Extra space at end of line
347, E:0001: Extra space at end of line
----- /apps/sms/js/sms.js
909, E:0110: Line too long (103 characters).
----- /apps/system/js/airplane_mode.js
41, E:0110: Line too long (89 characters).
----- /apps/system/js/crash_reporter.js
22, E:0110: Line too long (91 characters).
99, E:0110: Line too long (84 characters).
130, E:0010: Missing semicolon at end of line
----- /apps/system/js/identity.js
9, E:0110: Line too long (83 characters).
22, E:0110: Line too long (81 characters).
42, E:0110: Line too long (81 characters).
----- /apps/system/js/keyboard_manager.js
10, E:0013: Redundant semicolon
----- /apps/system/js/lockscreen.js
330, E:0110: Line too long (83 characters).
331, E:0110: Line too long (86 characters).
----- /apps/system/js/trusted_ui.js
8, E:0001: Extra space before "("
70, E:0110: Line too long (82 characters).
106, E:0002: Missing space before "-"
106, E:0002: Missing space after "-"
----- /apps/system/js/updatable.js
72, E:0010: Missing semicolon at end of line
----- /apps/system/test/unit/identity_test.js
24, E:0001: Extra space after "function"
53, E:0110: Line too long (95 characters).
54, E:0110: Line too long (82 characters).
----- /apps/system/test/unit/updatable_test.js
187, E:0110: Line too long (96 characters).
Found 115 errors, including 6 new errors, in 17 files (411 files OK).

Some of the errors reported by GJsLint may be auto-fixable using the script
fixjsstyle. Please double check any changes it makes and report any bugs. The
script can be run by executing:

fixjsstyle --nojsdoc -r apps -e homescreen/everything.me,sms/js/ext,pdfjs/content,pdfjs/test,email/js/ext,music/js/ext,calendar/js/ext
make: *** [lint] Error 3

openReceivedFile: function bt_openReceivedFile(evt) {
// Launch the gallery with an open activity to view this specific photo
var fileName = evt.fileName;
var filePath = '/sdcard/Downloads/' + fileName;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's "/downloads/bluetooth", at least in my test.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And if this path is defined in gecko, it might be better to add some comments about that it's a predefined path.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know where the file gets stored by the bluetooth module, but device storage uses /sdcard as its root, so you don't include that in the path. I'm hoping that gecko uses a capital D and strores files in Downloads/ instead of downloads/. But that doesn't really matter.

@davidflanagan
Copy link

One final comment.. In the init() method of bluetooth_transfer.js, you have unnecessary nested functions for mozSetMessageHandler(). That would be a good place to just pass bound copies of your methods.

"bluetooth":{},
"mozBluetooth":{},
"device-storage:pictures":{},
"device-storage:music":{}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comma is missing.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, just forget it, my mistake.

@ian-liu
Copy link
Contributor Author

ian-liu commented Nov 8, 2012

/botio lint

@ghost
Copy link

ghost commented Nov 8, 2012

From: Bot.io (Main)


Received

Command cmd_lint from @ian-liu received. Current queue size: 0

Live output at: http://50.116.11.35:8000/679c859a52805f5/output.txt

@ghost
Copy link

ghost commented Nov 8, 2012

From: Bot.io (Main)


Failed

Full output at http://50.116.11.35:8000/679c859a52805f5/output.txt

Total script time: 1.82 mins

Lint: FAILED
----/bin/bash: warning: setlocale: LC_ALL: cannot change locale (zh_TW.UTF-8)
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (zh_TW.UTF-8)
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (zh_TW.UTF-8)
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (zh_TW.UTF-8)
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (zh_TW.UTF-8)
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (zh_TW.UTF-8)
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (zh_TW.UTF-8)
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (zh_TW.UTF-8)
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (zh_TW.UTF-8)
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (zh_TW.UTF-8)
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (zh_TW.UTF-8)
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (zh_TW.UTF-8)
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (zh_TW.UTF-8)
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (zh_TW.UTF-8)
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (zh_TW.UTF-8)
Skipping 43 file(s).
----- /apps/calendar/js/template.js
85, E:0002: Missing space before "-"
85, E:0002: Missing space after "-"
86, E:0002: Missing space before "+"
86, E:0002: Missing space after "+"
86, E:0002: Missing space before "+"
86, E:0002: Missing space after "+"
104, E:0131: Single-quoted string preferred over double-quoted string.
107, E:0131: Single-quoted string preferred over double-quoted string.
109, E:0131: Single-quoted string preferred over double-quoted string.
----- /apps/clock/js/alarm.js
357, E:0110: Line too long (89 characters).
----- /apps/communications/contacts/test/integration/app.js
60, E:0110: Line too long (82 characters).
----- /apps/communications/contacts/test/integration/launch_test.js
9, E:0131: Single-quoted string preferred over double-quoted string.
11, E:0131: Single-quoted string preferred over double-quoted string.
11, E:0131: Single-quoted string preferred over double-quoted string.
12, E:0131: Single-quoted string preferred over double-quoted string.
12, E:0131: Single-quoted string preferred over double-quoted string.
13, E:0131: Single-quoted string preferred over double-quoted string.
13, E:0131: Single-quoted string preferred over double-quoted string.
14, E:0131: Single-quoted string preferred over double-quoted string.
14, E:0131: Single-quoted string preferred over double-quoted string.
17, E:0131: Single-quoted string preferred over double-quoted string.
19, E:0131: Single-quoted string preferred over double-quoted string.
19, E:0131: Single-quoted string preferred over double-quoted string.
22, E:0131: Single-quoted string preferred over double-quoted string.
22, E:0131: Single-quoted string preferred over double-quoted string.
23, E:0131: Single-quoted string preferred over double-quoted string.
23, E:0131: Single-quoted string preferred over double-quoted string.
24, E:0131: Single-quoted string preferred over double-quoted string.
24, E:0131: Single-quoted string preferred over double-quoted string.
25, E:0131: Single-quoted string preferred over double-quoted string.
27, E:0131: Single-quoted string preferred over double-quoted string.
27, E:0131: Single-quoted string preferred over double-quoted string.
28, E:0131: Single-quoted string preferred over double-quoted string.
28, E:0131: Single-quoted string preferred over double-quoted string.
31, E:0131: Single-quoted string preferred over double-quoted string.
31, E:0131: Single-quoted string preferred over double-quoted string.
98, E:0131: Single-quoted string preferred over double-quoted string.
98, E:0010: Missing semicolon at end of line
105, E:0110: Line too long (81 characters).
155, E:0131: Single-quoted string preferred over double-quoted string.
177, E:0131: Single-quoted string preferred over double-quoted string.
177, E:0010: Missing semicolon at end of line
222, E:0110: Line too long (92 characters).
273, E:0110: Line too long (81 characters).
275, E:0110: Line too long (81 characters).
331, E:0110: Line too long (81 characters).
----- /apps/communications/dialer/js/handled_call.js
74, E:0131: Single-quoted string preferred over double-quoted string.
----- /apps/email/js/console-hook.js
4, E:0131: Single-quoted string preferred over double-quoted string.
6, E:0131: Single-quoted string preferred over double-quoted string.
8, E:0131: Single-quoted string preferred over double-quoted string.
12, E:0001: Extra space after ":"
14, E:0001: Extra space after ":"
15, E:0001: Extra space after ":"
19, E:0131: Single-quoted string preferred over double-quoted string.
19, E:0131: Single-quoted string preferred over double-quoted string.
19, E:0131: Single-quoted string preferred over double-quoted string.
----- /apps/homescreen/js/state.js
250, E:0110: Line too long (83 characters).
----- /apps/keyboard/test/unit/latin_test.js
29, E:0002: Missing space before "-"
29, E:0002: Missing space after "-"
31, E:0001: Extra space at end of line
42, E:0121: Illegal comma at end of object literal
49, E:0001: Extra space at end of line
55, E:0002: Missing space before "("
66, E:0002: Missing space before "("
74, E:0001: Extra space at end of line
80, E:0001: Extra space at end of line
86, E:0001: Extra space at end of line
97, E:0121: Illegal comma at end of array literal
112, E:0131: Single-quoted string preferred over double-quoted string.
132, E:0121: Illegal comma at end of object literal
133, E:0010: Missing semicolon at end of line
148, E:0121: Illegal comma at end of object literal
169, E:0002: Missing space before "-"
169, E:0002: Missing space after "-"
188, E:0002: Missing space before "-"
188, E:0002: Missing space after "-"
211, E:0002: Missing space before "-"
211, E:0002: Missing space after "-"
215, E:0002: Missing space before "-"
215, E:0002: Missing space after "-"
227, E:0001: Extra space at end of line
234, E:0131: Single-quoted string preferred over double-quoted string.
235, E:0002: Missing space before "("
237, E:0002: Missing space before "("
239, E:0002: Missing space before "("
241, E:0002: Missing space before "("
242, E:0010: Missing semicolon at end of line
270, E:0001: Extra space at end of line
272, E:0002: Missing space before "("
273, E:0001: Extra space at end of line
290, E:0001: Extra space at end of line
294, E:0001: Extra space at end of line
296, E:0001: Extra space at end of line
311, E:0001: Extra space at end of line
332, E:0001: Extra space at end of line
347, E:0001: Extra space at end of line
----- /apps/settings/js/utils.js
66, E:0110: Line too long (85 characters).
66, E:0001: Extra space at end of line
----- /apps/sms/js/background.js
25, E:0110: Line too long (81 characters).
----- /apps/sms/js/sms.js
909, E:0110: Line too long (103 characters).
----- /apps/system/js/airplane_mode.js
41, E:0110: Line too long (89 characters).
----- /apps/system/js/cost_control.js
47, E:0001: Extra space at end of line
----- /apps/system/js/crash_reporter.js
22, E:0110: Line too long (91 characters).
99, E:0110: Line too long (84 characters).
130, E:0010: Missing semicolon at end of line
----- /apps/system/js/identity.js
9, E:0110: Line too long (83 characters).
22, E:0110: Line too long (81 characters).
43, E:0110: Line too long (81 characters).
----- /apps/system/js/keyboard_manager.js
10, E:0013: Redundant semicolon
----- /apps/system/js/lockscreen.js
330, E:0110: Line too long (83 characters).
331, E:0110: Line too long (86 characters).
----- /apps/system/js/trusted_ui.js
8, E:0001: Extra space before "("
70, E:0110: Line too long (82 characters).
106, E:0002: Missing space before "-"
106, E:0002: Missing space after "-"
----- /apps/system/js/updatable.js
72, E:0010: Missing semicolon at end of line
----- /apps/system/js/window_manager.js
904, E:0121: Illegal comma at end of array literal
----- /apps/system/test/unit/identity_test.js
24, E:0001: Extra space after "function"
53, E:0110: Line too long (95 characters).
54, E:0110: Line too long (82 characters).
----- /apps/system/test/unit/mock_l10n.js
11, E:0131: Single-quoted string preferred over double-quoted string.
----- /apps/system/test/unit/statusbar_test.js
28, E:0131: Single-quoted string preferred over double-quoted string.
29, E:0131: Single-quoted string preferred over double-quoted string.
33, E:0131: Single-quoted string preferred over double-quoted string.
34, E:0131: Single-quoted string preferred over double-quoted string.
47, E:0131: Single-quoted string preferred over double-quoted string.
48, E:0131: Single-quoted string preferred over double-quoted string.
50, E:0131: Single-quoted string preferred over double-quoted string.
52, E:0131: Single-quoted string preferred over double-quoted string.
52, E:0110: Line too long (83 characters).
55, E:0131: Single-quoted string preferred over double-quoted string.
57, E:0131: Single-quoted string preferred over double-quoted string.
57, E:0110: Line too long (90 characters).
61, E:0131: Single-quoted string preferred over double-quoted string.
63, E:0131: Single-quoted string preferred over double-quoted string.
63, E:0110: Line too long (89 characters).
67, E:0131: Single-quoted string preferred over double-quoted string.
71, E:0131: Single-quoted string preferred over double-quoted string.
71, E:0110: Line too long (103 characters).
76, E:0131: Single-quoted string preferred over double-quoted string.
----- /apps/system/test/unit/updatable_test.js
187, E:0110: Line too long (96 characters).
Found 141 errors, including 6 new errors, in 24 files (407 files OK).

Some of the errors reported by GJsLint may be auto-fixable using the script
fixjsstyle. Please double check any changes it makes and report any bugs. The
script can be run by executing:

fixjsstyle --nojsdoc -r apps -e homescreen/everything.me,sms/js/ext,pdfjs/content,pdfjs/test,email/js/ext,music/js/ext,calendar/js/ext
make: *** [lint] Error 3

@ian-liu
Copy link
Contributor Author

ian-liu commented Nov 8, 2012

Refined the pull request according the above comment.

Note:
I have changed to use the storage type of "sdcard" for access the received file.
And change the file path to be '/Downloads/bluetooth' + fileName;
But I got nothing in the getreq.result of onsuccess() function.
Do you know why?

@ian-liu
Copy link
Contributor Author

ian-liu commented Nov 9, 2012

@davidflanagan and @dominickuo
For the above comment, could you help me to figure out how to get the file by storage type 'sdcard'?

@dominickuo
Copy link
Contributor

@ian-liu Let me help you first, let's discuss offline.

@ian-liu
Copy link
Contributor Author

ian-liu commented Nov 9, 2012

@davidflanagan and @dominickuo
I refined a patch to use the storage type of "sdcard" only when the API's file type is empty.

function bt_gotReceivingFileConfirmationMessage(message) {
self.onReceivingFileConfirmation(message);
}
this.bluetoothMessageHandler.bind(this, 'receiving-file-confirmation')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couldn't this just be

this.onReceivingFileConfirmation.bind(this)

CustomDialog.show(_('cannotOpenFile'), body, confirm);
},

confirmUnknowMediaPrompt: function bt_confirmUnknowMediaPrompt() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is such a simple function that I'd just nest it in the method above. It doesn't use this, and doesn't need to be a method.

@ian-liu
Copy link
Contributor Author

ian-liu commented Nov 14, 2012

/botio lint

@ian-liu
Copy link
Contributor Author

ian-liu commented Nov 14, 2012

According @davidflanagan and @dominickuo 's comment, I have refined the patch.
Could @dominickuo help to review again?
Thank you.

// use the file.type to replace the empty fileType which is given by API
var fileType = '';
var fileName = file.name;
var filetype = (fileType != '') ? fileType : file.type;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is filetype typo? looks like fileType, not filetype

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here (fileType != '') will always be false. isn't it?

@dominickuo
Copy link
Contributor

@ian-liu Looks good to me, r+, and I will send another patch for Gallery to sync with your patch, which caused by Bug 811615.

@ian-liu
Copy link
Contributor Author

ian-liu commented Nov 16, 2012

@dominickuo Thanks for your reviewed effort. We can merge the pr now.

ian-liu added a commit that referenced this pull request Nov 16, 2012
Bug 807881 - [Bluetooth] Need to check SDCard status before receiving file by other devices
@ian-liu ian-liu merged commit 34895f2 into mozilla-b2g:master Nov 16, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants