Merge m-c to inbound, a=merge

This commit is contained in:
Wes Kocher 2015-10-02 13:43:19 -07:00
commit ee952246ce
44 changed files with 505 additions and 327 deletions

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54"> <project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/> <copyfile dest="Makefile" src="core/root.mk"/>
</project> </project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="9a682cb7bc8b7fde624a9b2b3c2d64415a08b04b"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="f3d9981dccfa4dfdfcb865d95fdcfb85e4077e1e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/> <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/> <project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54"> <project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/> <copyfile dest="Makefile" src="core/root.mk"/>
</project> </project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="9a682cb7bc8b7fde624a9b2b3c2d64415a08b04b"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="f3d9981dccfa4dfdfcb865d95fdcfb85e4077e1e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/> <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/> <project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/>

View File

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/> <copyfile dest="Makefile" src="core/root.mk"/>
</project> </project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/> <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="9a682cb7bc8b7fde624a9b2b3c2d64415a08b04b"/> <project name="gaia.git" path="gaia" remote="mozillaorg" revision="f3d9981dccfa4dfdfcb865d95fdcfb85e4077e1e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/> <project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="27eb2f04e149fc2c9976d881b1b5984bbe7ee089"/> <project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="27eb2f04e149fc2c9976d881b1b5984bbe7ee089"/>

View File

@ -17,7 +17,7 @@
</project> </project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/> <project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/> <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="9a682cb7bc8b7fde624a9b2b3c2d64415a08b04b"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="f3d9981dccfa4dfdfcb865d95fdcfb85e4077e1e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="58909a53f638af022ab09f7a8f6976b0cae8f133"/> <project name="moztt" path="external/moztt" remote="b2g" revision="58909a53f638af022ab09f7a8f6976b0cae8f133"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f004530b30a63c08a16d82536858600446b2abf5"/> <project name="apitrace" path="external/apitrace" remote="apitrace" revision="f004530b30a63c08a16d82536858600446b2abf5"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54"> <project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/> <copyfile dest="Makefile" src="core/root.mk"/>
</project> </project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="9a682cb7bc8b7fde624a9b2b3c2d64415a08b04b"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="f3d9981dccfa4dfdfcb865d95fdcfb85e4077e1e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/> <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/> <project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
@ -128,7 +128,7 @@
<!-- Emulator specific things --> <!-- Emulator specific things -->
<project name="device/generic/armv7-a-neon" path="device/generic/armv7-a-neon" revision="72ffdf71c68a96309212eb13d63560d66db14c9e"/> <project name="device/generic/armv7-a-neon" path="device/generic/armv7-a-neon" revision="72ffdf71c68a96309212eb13d63560d66db14c9e"/>
<project name="device_generic_goldfish" path="device/generic/goldfish" remote="b2g" revision="8d4018ebd33ac3f1a043b2d54bc578028656a659"/> <project name="device_generic_goldfish" path="device/generic/goldfish" remote="b2g" revision="8d4018ebd33ac3f1a043b2d54bc578028656a659"/>
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="e002268b30ce69725e60fdc827a19d729cce7396"/> <project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="b2773dbc3cb24e70cff2b05522e9c959250400ac"/>
<project name="platform/external/libnfc-nci" path="external/libnfc-nci" revision="f37bd545063039e30a92f2550ae78c0e6e4e2d08"/> <project name="platform/external/libnfc-nci" path="external/libnfc-nci" revision="f37bd545063039e30a92f2550ae78c0e6e4e2d08"/>
<project name="platform_external_wpa_supplicant_8" path="external/wpa_supplicant_8" remote="b2g" revision="0c6a6547cd1fd302fa2b0f6e375654df36bf0ec4"/> <project name="platform_external_wpa_supplicant_8" path="external/wpa_supplicant_8" remote="b2g" revision="0c6a6547cd1fd302fa2b0f6e375654df36bf0ec4"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="7132bc11fbc68acfebcd509095562ca04fad5584"/> <project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="7132bc11fbc68acfebcd509095562ca04fad5584"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="c9d4fe680662ee44a4bdea42ae00366f5df399cf"> <project name="platform_build" path="build" remote="b2g" revision="c9d4fe680662ee44a4bdea42ae00366f5df399cf">
<copyfile dest="Makefile" src="core/root.mk"/> <copyfile dest="Makefile" src="core/root.mk"/>
</project> </project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="9a682cb7bc8b7fde624a9b2b3c2d64415a08b04b"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="f3d9981dccfa4dfdfcb865d95fdcfb85e4077e1e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/> <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/> <project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>

View File

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/> <copyfile dest="Makefile" src="core/root.mk"/>
</project> </project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/> <project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="9a682cb7bc8b7fde624a9b2b3c2d64415a08b04b"/> <project name="gaia.git" path="gaia" remote="mozillaorg" revision="f3d9981dccfa4dfdfcb865d95fdcfb85e4077e1e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/> <project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="27eb2f04e149fc2c9976d881b1b5984bbe7ee089"/> <project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="27eb2f04e149fc2c9976d881b1b5984bbe7ee089"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54"> <project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/> <copyfile dest="Makefile" src="core/root.mk"/>
</project> </project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="9a682cb7bc8b7fde624a9b2b3c2d64415a08b04b"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="f3d9981dccfa4dfdfcb865d95fdcfb85e4077e1e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/> <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/> <project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/>

View File

@ -1,9 +1,9 @@
{ {
"git": { "git": {
"git_revision": "9a682cb7bc8b7fde624a9b2b3c2d64415a08b04b", "git_revision": "f3d9981dccfa4dfdfcb865d95fdcfb85e4077e1e",
"remote": "https://git.mozilla.org/releases/gaia.git", "remote": "https://git.mozilla.org/releases/gaia.git",
"branch": "" "branch": ""
}, },
"revision": "73f844def0a5b0a7e077b68e5e16ffd6753129da", "revision": "ad7f7540499e0cf54ddd5cf41ff39886cf63acfb",
"repo_path": "integration/gaia-central" "repo_path": "integration/gaia-central"
} }

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54"> <project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
<copyfile dest="Makefile" src="core/root.mk"/> <copyfile dest="Makefile" src="core/root.mk"/>
</project> </project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="9a682cb7bc8b7fde624a9b2b3c2d64415a08b04b"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="f3d9981dccfa4dfdfcb865d95fdcfb85e4077e1e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/> <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/> <project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/>

View File

@ -18,7 +18,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/> <project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/> <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/> <project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="9a682cb7bc8b7fde624a9b2b3c2d64415a08b04b"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="f3d9981dccfa4dfdfcb865d95fdcfb85e4077e1e"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="58909a53f638af022ab09f7a8f6976b0cae8f133"/> <project name="moztt" path="external/moztt" remote="b2g" revision="58909a53f638af022ab09f7a8f6976b0cae8f133"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f004530b30a63c08a16d82536858600446b2abf5"/> <project name="apitrace" path="external/apitrace" remote="apitrace" revision="f004530b30a63c08a16d82536858600446b2abf5"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="c9d4fe680662ee44a4bdea42ae00366f5df399cf"> <project name="platform_build" path="build" remote="b2g" revision="c9d4fe680662ee44a4bdea42ae00366f5df399cf">
<copyfile dest="Makefile" src="core/root.mk"/> <copyfile dest="Makefile" src="core/root.mk"/>
</project> </project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="9a682cb7bc8b7fde624a9b2b3c2d64415a08b04b"/> <project name="gaia" path="gaia" remote="mozillaorg" revision="f3d9981dccfa4dfdfcb865d95fdcfb85e4077e1e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/> <project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/> <project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/> <project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/>

View File

@ -60,13 +60,13 @@ var LoopUI;
*/ */
promiseDocumentVisible(aDocument) { promiseDocumentVisible(aDocument) {
if (!aDocument.hidden) { if (!aDocument.hidden) {
return Promise.resolve(); return Promise.resolve(aDocument);
} }
return new Promise((resolve) => { return new Promise((resolve) => {
aDocument.addEventListener("visibilitychange", function onVisibilityChanged() { aDocument.addEventListener("visibilitychange", function onVisibilityChanged() {
aDocument.removeEventListener("visibilitychange", onVisibilityChanged); aDocument.removeEventListener("visibilitychange", onVisibilityChanged);
resolve(); resolve(aDocument);
}); });
}); });
}, },
@ -81,6 +81,15 @@ var LoopUI;
* @return {Promise} * @return {Promise}
*/ */
togglePanel: function(event, tabId = null) { togglePanel: function(event, tabId = null) {
if (!this.panel) {
// We're on the hidden window! What fun!
let obs = win => {
Services.obs.removeObserver(obs, "browser-delayed-startup-finished");
win.LoopUI.togglePanel(event, tabId);
};
Services.obs.addObserver(obs, "browser-delayed-startup-finished", false);
return OpenBrowserWindow();
}
if (this.panel.state == "open") { if (this.panel.state == "open") {
return new Promise(resolve => { return new Promise(resolve => {
this.panel.hidePopup(); this.panel.hidePopup();
@ -88,7 +97,12 @@ var LoopUI;
}); });
} }
return this.openCallPanel(event, tabId); return this.openCallPanel(event, tabId).then(doc => {
let fm = Services.focus;
fm.moveFocus(doc.defaultView, null, fm.MOVEFOCUS_FIRST, fm.FLAG_NOSCROLL);
}).catch(err => {
Cu.reportError(x);
});
}, },
/** /**
@ -130,14 +144,14 @@ var LoopUI;
let documentDOMLoaded = () => { let documentDOMLoaded = () => {
iframe.removeEventListener("DOMContentLoaded", documentDOMLoaded, true); iframe.removeEventListener("DOMContentLoaded", documentDOMLoaded, true);
this.injectLoopAPI(iframe.contentWindow); this.injectLoopAPI(iframe.contentWindow);
iframe.contentWindow.addEventListener("loopPanelInitialized", function loopPanelInitialized() { iframe.contentWindow.addEventListener("loopPanelInitialized", function loopPanelInitialized() {
iframe.contentWindow.removeEventListener("loopPanelInitialized", iframe.contentWindow.removeEventListener("loopPanelInitialized",
loopPanelInitialized); loopPanelInitialized);
showTab(); showTab();
}); });
}; };
iframe.addEventListener("DOMContentLoaded", documentDOMLoaded, true); iframe.addEventListener("DOMContentLoaded", documentDOMLoaded, true);
}; };
// Used to clear the temporary "login" state from the button. // Used to clear the temporary "login" state from the button.
@ -153,7 +167,9 @@ var LoopUI;
return; return;
} }
this.PanelFrame.showPopup(window, event ? event.target : this.toolbarButton.node, let anchor = event ? event.target : this.toolbarButton.anchor;
this.PanelFrame.showPopup(window, anchor,
"loop", null, "about:looppanel", "loop", null, "about:looppanel",
// Loop wants a fixed size for the panel. This also stops it dynamically resizing. // Loop wants a fixed size for the panel. This also stops it dynamically resizing.
{ width: 330, height: 410 }, { width: 330, height: 410 },

View File

@ -507,6 +507,12 @@
label="&webapps.label;" label="&webapps.label;"
accesskey="&webapps.accesskey;" accesskey="&webapps.accesskey;"
oncommand="BrowserOpenApps();"/> oncommand="BrowserOpenApps();"/>
<menuitem id="menu_openLoop"
label="&loopMenuItem.label;"
accesskey = "&loopMenuItem.accesskey;"
oncommand="LoopUI.togglePanel();"/>
#ifdef MOZ_SERVICES_SYNC #ifdef MOZ_SERVICES_SYNC
<!-- only one of sync-setup, sync-syncnowitem or sync-reauthitem will be showing at once --> <!-- only one of sync-setup, sync-syncnowitem or sync-reauthitem will be showing at once -->
<menuitem id="sync-setup" <menuitem id="sync-setup"

View File

@ -1847,7 +1847,10 @@
// If we open a new tab with the newtab URL in the default // If we open a new tab with the newtab URL in the default
// userContext, check if there is a preloaded browser ready. // userContext, check if there is a preloaded browser ready.
if (aURI == BROWSER_NEW_TAB_URL && !aUserContextId) { // Private windows are not included because both the label and the
// icon for the tab would be set incorrectly (see bug 1195981).
if (aURI == BROWSER_NEW_TAB_URL && !aUserContextId &&
!PrivateBrowsingUtils.isWindowPrivate(window)) {
b = this._getPreloadedBrowser(); b = this._getPreloadedBrowser();
usingPreloadedContent = !!b; usingPreloadedContent = !!b;
} }

View File

@ -313,6 +313,7 @@ p {
border-radius: 2px; border-radius: 2px;
border-bottom-right-radius: 0; border-bottom-right-radius: 0;
border-top-right-radius: 0; border-top-right-radius: 0;
line-height: 0.9rem;
} }
/* Alerts/Notifications */ /* Alerts/Notifications */

View File

@ -430,16 +430,11 @@ html[dir="rtl"] .room-failure > .settings-control {
.screen-share-menu.dropdown-menu, .screen-share-menu.dropdown-menu,
.settings-menu.dropdown-menu { .settings-menu.dropdown-menu {
left: auto;
bottom: 3.1rem; bottom: 3.1rem;
} }
.screen-share-menu.dropdown-menu {
/*offset dropdown menu to be above menu button*/
right: 40px;
}
.settings-menu.dropdown-menu { .settings-menu.dropdown-menu {
left: auto;
/*offset dropdown menu to be above menu button*/ /*offset dropdown menu to be above menu button*/
right: 14px; right: 14px;
} }

View File

@ -338,7 +338,10 @@ loop.store = loop.store || {};
} }
this._endSession(); this._endSession();
this.setStoreState({callState: CALL_STATES.FINISHED}); this.setStoreState({
callState: this._storeState.callState === CALL_STATES.ONGOING ?
CALL_STATES.FINISHED : CALL_STATES.CLOSE
});
}, },
/** /**

View File

@ -163,7 +163,7 @@ loop.shared.views = (function(_, mozL10n) {
React.createElement("div", null, React.createElement("div", null,
React.createElement("button", {className: screenShareClasses, React.createElement("button", {className: screenShareClasses,
onClick: this.handleClick, onClick: this.handleClick,
ref: "menu-button", ref: "anchor",
title: this._getTitle()}, title: this._getTitle()},
isActive ? null : React.createElement("span", {className: "chevron"}) isActive ? null : React.createElement("span", {className: "chevron"})
), ),

View File

@ -163,7 +163,7 @@ loop.shared.views = (function(_, mozL10n) {
<div> <div>
<button className={screenShareClasses} <button className={screenShareClasses}
onClick={this.handleClick} onClick={this.handleClick}
ref="menu-button" ref="anchor"
title={this._getTitle()}> title={this._getTitle()}>
{isActive ? null : <span className="chevron"/>} {isActive ? null : <span className="chevron"/>}
</button> </button>

View File

@ -777,12 +777,22 @@ describe("loop.store.ConversationStore", function () {
sinon.assert.calledOnce(wsHangupSpy); sinon.assert.calledOnce(wsHangupSpy);
}); });
it("should set the callState to finished", function() { it("should set the callState to finished for ongoing call state", function() {
store.hangupCall(new sharedActions.HangupCall()); store.hangupCall(new sharedActions.HangupCall());
expect(store.getStoreState("callState")).eql(CALL_STATES.FINISHED); expect(store.getStoreState("callState")).eql(CALL_STATES.FINISHED);
}); });
it("should set the callState to CLOSE for non-ongoing call state", function() {
store.setStoreState({
callState: CALL_STATES.CONNECTING
});
store.hangupCall(new sharedActions.HangupCall());
expect(store.getStoreState("callState")).eql(CALL_STATES.CLOSE);
});
it("should release mozLoop callsData", function() { it("should release mozLoop callsData", function() {
store.hangupCall(new sharedActions.HangupCall()); store.hangupCall(new sharedActions.HangupCall());

View File

@ -229,6 +229,8 @@ These should match what Safari and other Apple applications use on OS X Lion. --
<!ENTITY addons.commandkey "A"> <!ENTITY addons.commandkey "A">
<!ENTITY webapps.label "Apps"> <!ENTITY webapps.label "Apps">
<!ENTITY webapps.accesskey "p"> <!ENTITY webapps.accesskey "p">
<!ENTITY loopMenuItem.label "Start a conversation…">
<!ENTITY loopMenuItem.accesskey "t">
<!ENTITY webDeveloperMenu.label "Web Developer"> <!ENTITY webDeveloperMenu.label "Web Developer">
<!ENTITY webDeveloperMenu.accesskey "W"> <!ENTITY webDeveloperMenu.accesskey "W">

View File

@ -49,12 +49,6 @@ import org.apache.commons.net.ftp.FTP;
import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPFile; import org.apache.commons.net.ftp.FTPFile;
import org.apache.commons.net.ftp.FTPReply; import org.apache.commons.net.ftp.FTPReply;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import com.mozilla.SUTAgentAndroid.R; import com.mozilla.SUTAgentAndroid.R;
import com.mozilla.SUTAgentAndroid.SUTAgentAndroid; import com.mozilla.SUTAgentAndroid.SUTAgentAndroid;
@ -2964,53 +2958,6 @@ private void CancelNotification()
return(sRet); return(sRet);
} }
public String GetInternetData(String sHost, String sPort, String sURL)
{
String sRet = "";
String sNewURL = "";
HttpClient httpClient = new DefaultHttpClient();
try
{
sNewURL = "http://" + sHost + ((sPort.length() > 0) ? (":" + sPort) : "") + sURL;
HttpGet request = new HttpGet(sNewURL);
HttpResponse response = httpClient.execute(request);
int status = response.getStatusLine().getStatusCode();
// we assume that the response body contains the error message
if (status != HttpStatus.SC_OK)
{
ByteArrayOutputStream ostream = new ByteArrayOutputStream();
response.getEntity().writeTo(ostream);
Log.e("HTTP CLIENT", ostream.toString());
}
else
{
InputStream content = response.getEntity().getContent();
byte [] data = new byte [2048];
int nRead = content.read(data);
sRet = new String(data, 0, nRead);
content.close(); // this will also close the connection
}
}
catch (IllegalArgumentException e)
{
sRet = e.getLocalizedMessage();
e.printStackTrace();
}
catch (ClientProtocolException e)
{
sRet = e.getLocalizedMessage();
e.printStackTrace();
}
catch (IOException e)
{
sRet = e.getLocalizedMessage();
e.printStackTrace();
}
return(sRet);
}
public String GetTimeZone() public String GetTimeZone()
{ {
String sRet = ""; String sRet = "";

View File

@ -9,7 +9,6 @@ import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.net.InetAddress; import java.net.InetAddress;
import org.apache.http.conn.util.InetAddressUtils;
import java.net.NetworkInterface; import java.net.NetworkInterface;
import java.net.SocketException; import java.net.SocketException;
import java.net.UnknownHostException; import java.net.UnknownHostException;
@ -19,6 +18,7 @@ import java.util.Date;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.Formatter; import java.util.Formatter;
import java.util.List; import java.util.List;
import java.util.regex.Pattern;
import java.util.Timer; import java.util.Timer;
import com.mozilla.SUTAgentAndroid.service.ASMozStub; import com.mozilla.SUTAgentAndroid.service.ASMozStub;
@ -56,6 +56,8 @@ public class SUTAgentAndroid extends Activity
{ {
final Handler mHandler = new Handler(); final Handler mHandler = new Handler();
private static final Pattern IPV4_PATTERN = Pattern.compile("^(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)(\\.(25[0-5]|2[0-4]\\d|[0-1]?\\d?\\d)){3}$");
public static final int START_PRG = 1959; public static final int START_PRG = 1959;
MenuItem mExitMenuItem; MenuItem mExitMenuItem;
Timer timer = null; Timer timer = null;
@ -810,6 +812,10 @@ public class SUTAgentAndroid extends Activity
return sHWID; return sHWID;
} }
public static boolean isIPv4Address(final String input) {
return IPV4_PATTERN.matcher(input).matches();
}
public static InetAddress getLocalInetAddress() throws SocketException public static InetAddress getLocalInetAddress() throws SocketException
{ {
for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();)
@ -818,7 +824,7 @@ public class SUTAgentAndroid extends Activity
for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();)
{ {
InetAddress inetAddress = enumIpAddr.nextElement(); InetAddress inetAddress = enumIpAddr.nextElement();
if (!inetAddress.isLoopbackAddress() && InetAddressUtils.isIPv4Address(inetAddress.getHostAddress())) if (!inetAddress.isLoopbackAddress() && isIPv4Address(inetAddress.getHostAddress()))
{ {
return inetAddress; return inetAddress;
} }

View File

@ -105,7 +105,7 @@ BluetoothDaemonCoreModule::GetAdapterPropertiesCmd(
} }
nsresult nsresult
BluetoothDaemonCoreModule::GetAdapterPropertyCmd(const nsAString& aName, BluetoothDaemonCoreModule::GetAdapterPropertyCmd(BluetoothPropertyType aType,
BluetoothResultHandler* aRes) BluetoothResultHandler* aRes)
{ {
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
@ -114,8 +114,7 @@ BluetoothDaemonCoreModule::GetAdapterPropertyCmd(const nsAString& aName,
new DaemonSocketPDU(SERVICE_ID, OPCODE_GET_ADAPTER_PROPERTY, new DaemonSocketPDU(SERVICE_ID, OPCODE_GET_ADAPTER_PROPERTY,
0)); 0));
nsresult rv = PackPDU( nsresult rv = PackPDU(aType, *pdu);
PackConversion<const nsAString, BluetoothPropertyType>(aName), *pdu);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
return rv; return rv;
} }
@ -129,7 +128,7 @@ BluetoothDaemonCoreModule::GetAdapterPropertyCmd(const nsAString& aName,
nsresult nsresult
BluetoothDaemonCoreModule::SetAdapterPropertyCmd( BluetoothDaemonCoreModule::SetAdapterPropertyCmd(
const BluetoothNamedValue& aProperty, BluetoothResultHandler* aRes) const BluetoothProperty& aProperty, BluetoothResultHandler* aRes)
{ {
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
@ -174,7 +173,7 @@ BluetoothDaemonCoreModule::GetRemoteDevicePropertiesCmd(
nsresult nsresult
BluetoothDaemonCoreModule::GetRemoteDevicePropertyCmd( BluetoothDaemonCoreModule::GetRemoteDevicePropertyCmd(
const BluetoothAddress& aRemoteAddr, const BluetoothAddress& aRemoteAddr,
const nsAString& aName, BluetoothPropertyType aType,
BluetoothResultHandler* aRes) BluetoothResultHandler* aRes)
{ {
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
@ -183,9 +182,7 @@ BluetoothDaemonCoreModule::GetRemoteDevicePropertyCmd(
new DaemonSocketPDU(SERVICE_ID, OPCODE_GET_REMOTE_DEVICE_PROPERTY, new DaemonSocketPDU(SERVICE_ID, OPCODE_GET_REMOTE_DEVICE_PROPERTY,
0)); 0));
nsresult rv = PackPDU( nsresult rv = PackPDU(aRemoteAddr, aType, *pdu);
aRemoteAddr,
PackConversion<nsAString, BluetoothPropertyType>(aName), *pdu);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
return rv; return rv;
} }
@ -200,7 +197,7 @@ BluetoothDaemonCoreModule::GetRemoteDevicePropertyCmd(
nsresult nsresult
BluetoothDaemonCoreModule::SetRemoteDevicePropertyCmd( BluetoothDaemonCoreModule::SetRemoteDevicePropertyCmd(
const BluetoothAddress& aRemoteAddr, const BluetoothAddress& aRemoteAddr,
const BluetoothNamedValue& aProperty, const BluetoothProperty& aProperty,
BluetoothResultHandler* aRes) BluetoothResultHandler* aRes)
{ {
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
@ -373,7 +370,7 @@ BluetoothDaemonCoreModule::CancelBondCmd(const BluetoothAddress& aBdAddr,
nsresult nsresult
BluetoothDaemonCoreModule::PinReplyCmd(const BluetoothAddress& aBdAddr, BluetoothDaemonCoreModule::PinReplyCmd(const BluetoothAddress& aBdAddr,
bool aAccept, bool aAccept,
const nsAString& aPinCode, const BluetoothPinCode& aPinCode,
BluetoothResultHandler* aRes) BluetoothResultHandler* aRes)
{ {
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
@ -382,10 +379,7 @@ BluetoothDaemonCoreModule::PinReplyCmd(const BluetoothAddress& aBdAddr,
new DaemonSocketPDU(SERVICE_ID, OPCODE_PIN_REPLY, new DaemonSocketPDU(SERVICE_ID, OPCODE_PIN_REPLY,
0)); 0));
nsresult rv = PackPDU( nsresult rv = PackPDU(aBdAddr, aAccept, aPinCode, *pdu);
aBdAddr,
aAccept,
PackConversion<nsAString, BluetoothPinCode>(aPinCode), *pdu);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
return rv; return rv;
} }
@ -961,7 +955,8 @@ public:
{ } { }
nsresult nsresult
operator () (BluetoothAddress& aArg1, nsString& aArg2, uint32_t& aArg3) const operator () (BluetoothAddress& aArg1, BluetoothRemoteName& aArg2,
uint32_t& aArg3) const
{ {
DaemonSocketPDU& pdu = GetPDU(); DaemonSocketPDU& pdu = GetPDU();
@ -972,8 +967,7 @@ public:
} }
/* Read remote name */ /* Read remote name */
rv = UnpackPDU( rv = UnpackPDU(pdu, aArg2);
pdu, UnpackConversion<BluetoothRemoteName, nsAString>(aArg2));
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
return rv; return rv;
} }
@ -1007,8 +1001,9 @@ public:
{ } { }
nsresult nsresult
operator () (BluetoothAddress& aArg1, nsString& aArg2, uint32_t& aArg3, operator () (BluetoothAddress& aArg1, BluetoothRemoteName& aArg2,
BluetoothSspVariant& aArg4, uint32_t& aArg5) const uint32_t& aArg3, BluetoothSspVariant& aArg4,
uint32_t& aArg5) const
{ {
DaemonSocketPDU& pdu = GetPDU(); DaemonSocketPDU& pdu = GetPDU();
@ -1019,8 +1014,7 @@ public:
} }
/* Read remote name */ /* Read remote name */
rv = UnpackPDU( rv = UnpackPDU(pdu, aArg2);
pdu, UnpackConversion<BluetoothRemoteName, nsAString>(aArg2));
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
return rv; return rv;
} }
@ -1113,7 +1107,7 @@ public:
nsresult nsresult
operator () (BluetoothStatus& aArg1, BluetoothAddress& aArg2, operator () (BluetoothStatus& aArg1, BluetoothAddress& aArg2,
bool& aArg3) const BluetoothAclState& aArg3) const
{ {
DaemonSocketPDU& pdu = GetPDU(); DaemonSocketPDU& pdu = GetPDU();
@ -1130,8 +1124,7 @@ public:
} }
/* Read ACL state */ /* Read ACL state */
rv = UnpackPDU( rv = UnpackPDU(pdu, aArg3);
pdu, UnpackConversion<BluetoothAclState, bool>(aArg3));
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
return rv; return rv;
} }

View File

@ -79,21 +79,21 @@ public:
nsresult GetAdapterPropertiesCmd(BluetoothResultHandler* aRes); nsresult GetAdapterPropertiesCmd(BluetoothResultHandler* aRes);
nsresult GetAdapterPropertyCmd(const nsAString& aName, nsresult GetAdapterPropertyCmd(BluetoothPropertyType aType,
BluetoothResultHandler* aRes); BluetoothResultHandler* aRes);
nsresult SetAdapterPropertyCmd(const BluetoothNamedValue& aProperty, nsresult SetAdapterPropertyCmd(const BluetoothProperty& aProperty,
BluetoothResultHandler* aRes); BluetoothResultHandler* aRes);
nsresult GetRemoteDevicePropertiesCmd(const BluetoothAddress& aRemoteAddr, nsresult GetRemoteDevicePropertiesCmd(const BluetoothAddress& aRemoteAddr,
BluetoothResultHandler* aRes); BluetoothResultHandler* aRes);
nsresult GetRemoteDevicePropertyCmd(const BluetoothAddress& aRemoteAddr, nsresult GetRemoteDevicePropertyCmd(const BluetoothAddress& aRemoteAddr,
const nsAString& aName, BluetoothPropertyType aType,
BluetoothResultHandler* aRes); BluetoothResultHandler* aRes);
nsresult SetRemoteDevicePropertyCmd(const BluetoothAddress& aRemoteAddr, nsresult SetRemoteDevicePropertyCmd(const BluetoothAddress& aRemoteAddr,
const BluetoothNamedValue& aProperty, const BluetoothProperty& aProperty,
BluetoothResultHandler* aRes); BluetoothResultHandler* aRes);
nsresult GetRemoteServiceRecordCmd(const BluetoothAddress& aRemoteAddr, nsresult GetRemoteServiceRecordCmd(const BluetoothAddress& aRemoteAddr,
@ -118,7 +118,7 @@ public:
BluetoothResultHandler* aRes); BluetoothResultHandler* aRes);
nsresult PinReplyCmd(const BluetoothAddress& aBdAddr, bool aAccept, nsresult PinReplyCmd(const BluetoothAddress& aBdAddr, bool aAccept,
const nsAString& aPinCode, const BluetoothPinCode& aPinCode,
BluetoothResultHandler* aRes); BluetoothResultHandler* aRes);
nsresult SspReplyCmd(const BluetoothAddress& aBdAddr, nsresult SspReplyCmd(const BluetoothAddress& aBdAddr,
@ -266,13 +266,16 @@ private:
DiscoveryStateChangedNotification; DiscoveryStateChangedNotification;
typedef mozilla::ipc::DaemonNotificationRunnable3< typedef mozilla::ipc::DaemonNotificationRunnable3<
NotificationHandlerWrapper, void, BluetoothAddress, nsString, uint32_t, NotificationHandlerWrapper, void,
const BluetoothAddress&, const nsAString&> BluetoothAddress, BluetoothRemoteName, uint32_t,
const BluetoothAddress&, const BluetoothRemoteName&>
PinRequestNotification; PinRequestNotification;
typedef mozilla::ipc::DaemonNotificationRunnable5< typedef mozilla::ipc::DaemonNotificationRunnable5<
NotificationHandlerWrapper, void, BluetoothAddress, nsString, uint32_t, NotificationHandlerWrapper, void,
BluetoothSspVariant, uint32_t, const BluetoothAddress&, const nsAString&> BluetoothAddress, BluetoothRemoteName, uint32_t, BluetoothSspVariant,
uint32_t,
const BluetoothAddress&, const BluetoothRemoteName&>
SspRequestNotification; SspRequestNotification;
typedef mozilla::ipc::DaemonNotificationRunnable3< typedef mozilla::ipc::DaemonNotificationRunnable3<
@ -281,7 +284,8 @@ private:
BondStateChangedNotification; BondStateChangedNotification;
typedef mozilla::ipc::DaemonNotificationRunnable3< typedef mozilla::ipc::DaemonNotificationRunnable3<
NotificationHandlerWrapper, void, BluetoothStatus, BluetoothAddress, bool, NotificationHandlerWrapper, void,
BluetoothStatus, BluetoothAddress, BluetoothAclState,
BluetoothStatus, const BluetoothAddress&> BluetoothStatus, const BluetoothAddress&>
AclStateChangedNotification; AclStateChangedNotification;

View File

@ -513,71 +513,6 @@ Convert(int32_t aIn, BluetoothGattStatus& aOut)
return NS_OK; return NS_OK;
} }
nsresult
Convert(const nsAString& aIn, BluetoothPinCode& aOut)
{
if (MOZ_HAL_IPC_CONVERT_WARN_IF(
aIn.Length() > MOZ_ARRAY_LENGTH(aOut.mPinCode), nsAString,
BluetoothPinCode)) {
return NS_ERROR_ILLEGAL_VALUE;
}
NS_ConvertUTF16toUTF8 pinCodeUTF8(aIn);
const char* str = pinCodeUTF8.get();
nsAString::size_type i;
// Fill pin into aOut
for (i = 0; i < aIn.Length(); ++i, ++str) {
aOut.mPinCode[i] = static_cast<uint8_t>(*str);
}
// Clear remaining bytes in aOut
size_t ntrailing = (MOZ_ARRAY_LENGTH(aOut.mPinCode) - aIn.Length()) *
sizeof(aOut.mPinCode[0]);
memset(aOut.mPinCode + aIn.Length(), 0, ntrailing);
aOut.mLength = aIn.Length();
return NS_OK;
}
nsresult
Convert(const nsAString& aIn, BluetoothPropertyType& aOut)
{
if (aIn.EqualsLiteral("Name")) {
aOut = PROPERTY_BDNAME;
} else if (aIn.EqualsLiteral("Discoverable")) {
aOut = PROPERTY_ADAPTER_SCAN_MODE;
} else if (aIn.EqualsLiteral("DiscoverableTimeout")) {
aOut = PROPERTY_ADAPTER_DISCOVERY_TIMEOUT;
} else if (MOZ_HAL_IPC_CONVERT_WARN_IF(
false, nsAString, BluetoothPropertyType)) {
BT_LOGR("Invalid property name: %s", NS_ConvertUTF16toUTF8(aIn).get());
aOut = static_cast<BluetoothPropertyType>(0); // silences compiler warning
return NS_ERROR_ILLEGAL_VALUE;
}
return NS_OK;
}
nsresult
Convert(const nsAString& aIn, BluetoothServiceName& aOut)
{
NS_ConvertUTF16toUTF8 serviceNameUTF8(aIn);
const char* str = serviceNameUTF8.get();
size_t len = strlen(str);
if (MOZ_HAL_IPC_CONVERT_WARN_IF(
len > sizeof(aOut.mName), nsAString, BluetoothServiceName)) {
return NS_ERROR_ILLEGAL_VALUE;
}
memcpy(aOut.mName, str, len);
memset(aOut.mName + len, 0, sizeof(aOut.mName) - len);
return NS_OK;
}
nsresult nsresult
Convert(nsresult aIn, BluetoothStatus& aOut) Convert(nsresult aIn, BluetoothStatus& aOut)
{ {
@ -591,21 +526,6 @@ Convert(nsresult aIn, BluetoothStatus& aOut)
return NS_OK; return NS_OK;
} }
nsresult
Convert(BluetoothAclState aIn, bool& aOut)
{
static const bool sBool[] = {
[ACL_STATE_CONNECTED] = true,
[ACL_STATE_DISCONNECTED] = false
};
if (MOZ_HAL_IPC_CONVERT_WARN_IF(
aIn >= MOZ_ARRAY_LENGTH(sBool), BluetoothAclState, bool)) {
return NS_ERROR_ILLEGAL_VALUE;
}
aOut = sBool[aIn];
return NS_OK;
}
nsresult nsresult
Convert(const BluetoothAttributeHandle& aIn, int32_t& aOut) Convert(const BluetoothAttributeHandle& aIn, int32_t& aOut)
{ {
@ -904,18 +824,6 @@ Convert(BluetoothPropertyType aIn, uint8_t& aOut)
return NS_OK; return NS_OK;
} }
nsresult
Convert(const BluetoothRemoteName& aIn, nsAString& aOut)
{
const char* name = reinterpret_cast<const char*>(aIn.mName);
// We construct an nsCString here because the string
// returned from the PDU is not 0-terminated.
aOut = NS_ConvertUTF8toUTF16(
nsCString(name, strnlen(name, sizeof(aIn.mName))));
return NS_OK;
}
nsresult nsresult
Convert(BluetoothScanMode aIn, int32_t& aOut) Convert(BluetoothScanMode aIn, int32_t& aOut)
{ {
@ -1293,37 +1201,42 @@ PackPDU(const BluetoothHandsfreeWbsConfig& aIn, DaemonSocketPDU& aPDU)
} }
nsresult nsresult
PackPDU(const BluetoothNamedValue& aIn, DaemonSocketPDU& aPDU) PackPDU(const BluetoothProperty& aIn, DaemonSocketPDU& aPDU)
{ {
nsresult rv = PackPDU( nsresult rv = PackPDU(aIn.mType, aPDU);
PackConversion<nsString, BluetoothPropertyType>(aIn.name()), aPDU);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
return rv; return rv;
} }
if (aIn.value().type() == BluetoothValue::Tuint32_t) { switch (aIn.mType) {
// Set discoverable timeout case PROPERTY_BDNAME:
rv = PackPDU(static_cast<uint16_t>(sizeof(uint32_t)), /* fall through */
aIn.value().get_uint32_t(), aPDU); case PROPERTY_REMOTE_FRIENDLY_NAME: {
} else if (aIn.value().type() == BluetoothValue::TnsString) { NS_ConvertUTF16toUTF8 stringUTF8(aIn.mString);
// Set name
const nsCString value =
NS_ConvertUTF16toUTF8(aIn.value().get_nsString());
rv = PackPDU(PackConversion<size_t, uint16_t>(value.Length()), rv = PackPDU(PackConversion<size_t, uint16_t>(stringUTF8.Length()),
PackArray<uint8_t>( PackArray<uint8_t>(
reinterpret_cast<const uint8_t*>(value.get()), reinterpret_cast<const uint8_t*>(stringUTF8.get()),
value.Length()), stringUTF8.Length()),
aPDU); aPDU);
} else if (aIn.value().type() == BluetoothValue::Tbool) { }
// Set scan mode break;
bool value = aIn.value().get_bool(); case PROPERTY_CLASS_OF_DEVICE:
/* fall through */
rv = PackPDU(static_cast<uint16_t>(sizeof(int32_t)), case PROPERTY_ADAPTER_DISCOVERY_TIMEOUT:
PackConversion<bool, BluetoothScanMode>(value), aPDU); rv = PackPDU(PackConversion<size_t, uint16_t>(sizeof(aIn.mUint32)),
} else if (MOZ_HAL_IPC_PACK_WARN_IF(true, BluetoothNamedValue)) { aIn.mUint32,
BT_LOGR("Invalid property value type"); aPDU);
rv = NS_ERROR_ILLEGAL_VALUE; break;
case PROPERTY_ADAPTER_SCAN_MODE:
/* |mScanMode| is sent as signed int of 4 bytes */
rv = PackPDU(PackConversion<size_t, uint16_t>(sizeof(int32_t)),
aIn.mScanMode,
aPDU);
break;
default:
NS_NOTREACHED("Invalid property for packing");
return NS_ERROR_ILLEGAL_VALUE;
} }
return rv; return rv;
} }
@ -1357,7 +1270,15 @@ PackPDU(BluetoothScanMode aIn, DaemonSocketPDU& aPDU)
nsresult nsresult
PackPDU(const BluetoothServiceName& aIn, DaemonSocketPDU& aPDU) PackPDU(const BluetoothServiceName& aIn, DaemonSocketPDU& aPDU)
{ {
return PackPDU(PackArray<uint8_t>(aIn.mName, sizeof(aIn.mName)), aPDU); static const uint8_t sTerminator = '\0';
nsresult rv =
PackPDU(PackArray<uint8_t>(aIn.mName, sizeof(aIn.mName)), aPDU);
if (NS_FAILED(rv)) {
return rv;
}
/* The PDU requries one additional byte for \0 termination */
return aPDU.Write(sTerminator);
} }
nsresult nsresult

View File

@ -27,11 +27,6 @@ using namespace mozilla::ipc::DaemonSocketPDUHelpers;
// Helper structures // Helper structures
// //
enum BluetoothAclState {
ACL_STATE_CONNECTED,
ACL_STATE_DISCONNECTED
};
struct BluetoothAvrcpAttributeTextPairs { struct BluetoothAvrcpAttributeTextPairs {
BluetoothAvrcpAttributeTextPairs(const uint8_t* aAttr, BluetoothAvrcpAttributeTextPairs(const uint8_t* aAttr,
const char** aText, const char** aText,
@ -108,19 +103,6 @@ struct BluetoothConfigurationParameter {
nsAutoArrayPtr<uint8_t> mValue; nsAutoArrayPtr<uint8_t> mValue;
}; };
struct BluetoothPinCode {
uint8_t mPinCode[16];
uint8_t mLength;
};
struct BluetoothRemoteName {
uint8_t mName[249];
};
struct BluetoothServiceName {
uint8_t mName[256];
};
// //
// Conversion // Conversion
// //
@ -200,18 +182,6 @@ Convert(int32_t aIn, BluetoothAttributeHandle& aOut);
nsresult nsresult
Convert(int32_t aIn, BluetoothGattStatus& aOut); Convert(int32_t aIn, BluetoothGattStatus& aOut);
nsresult
Convert(const nsAString& aIn, BluetoothPinCode& aOut);
nsresult
Convert(const nsAString& aIn, BluetoothPropertyType& aOut);
nsresult
Convert(const nsAString& aIn, BluetoothServiceName& aOut);
nsresult
Convert(BluetoothAclState aIn, bool& aOut);
nsresult nsresult
Convert(const BluetoothAttributeHandle& aIn, int32_t& aOut); Convert(const BluetoothAttributeHandle& aIn, int32_t& aOut);
@ -263,9 +233,6 @@ Convert(BluetoothHandsfreeWbsConfig aIn, uint8_t& aOut);
nsresult nsresult
Convert(BluetoothPropertyType aIn, uint8_t& aOut); Convert(BluetoothPropertyType aIn, uint8_t& aOut);
nsresult
Convert(const BluetoothRemoteName& aIn, nsAString& aOut);
nsresult nsresult
Convert(BluetoothScanMode aIn, uint8_t& aOut); Convert(BluetoothScanMode aIn, uint8_t& aOut);
@ -357,7 +324,7 @@ nsresult
PackPDU(const BluetoothHandsfreeWbsConfig& aIn, DaemonSocketPDU& aPDU); PackPDU(const BluetoothHandsfreeWbsConfig& aIn, DaemonSocketPDU& aPDU);
nsresult nsresult
PackPDU(const BluetoothNamedValue& aIn, DaemonSocketPDU& aPDU); PackPDU(const BluetoothProperty& aIn, DaemonSocketPDU& aPDU);
nsresult nsresult
PackPDU(const BluetoothPinCode& aIn, DaemonSocketPDU& aPDU); PackPDU(const BluetoothPinCode& aIn, DaemonSocketPDU& aPDU);
@ -481,7 +448,17 @@ UnpackPDU(DaemonSocketPDU& aPDU, BluetoothRemoteInfo& aOut);
inline nsresult inline nsresult
UnpackPDU(DaemonSocketPDU& aPDU, BluetoothRemoteName& aOut) UnpackPDU(DaemonSocketPDU& aPDU, BluetoothRemoteName& aOut)
{ {
return aPDU.Read(aOut.mName, sizeof(aOut.mName)); nsresult rv = aPDU.Read(aOut.mName, sizeof(aOut.mName));
if (NS_FAILED(rv)) {
return rv;
}
/* The PDU stores one extra byte for the trailing \0 character. We
* consume the byte, but don't store the character.
*/
if (!aPDU.Consume(1)) {
return NS_ERROR_OUT_OF_MEMORY;
}
return NS_OK;
} }
nsresult nsresult

View File

@ -642,11 +642,11 @@ BluetoothDaemonInterface::GetAdapterProperties(BluetoothResultHandler* aRes)
} }
void void
BluetoothDaemonInterface::GetAdapterProperty(const nsAString& aName, BluetoothDaemonInterface::GetAdapterProperty(BluetoothPropertyType aType,
BluetoothResultHandler* aRes) BluetoothResultHandler* aRes)
{ {
nsresult rv = static_cast<BluetoothDaemonCoreModule*> nsresult rv = static_cast<BluetoothDaemonCoreModule*>
(mProtocol)->GetAdapterPropertyCmd(aName, aRes); (mProtocol)->GetAdapterPropertyCmd(aType, aRes);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
DispatchError(aRes, rv); DispatchError(aRes, rv);
} }
@ -654,7 +654,7 @@ BluetoothDaemonInterface::GetAdapterProperty(const nsAString& aName,
void void
BluetoothDaemonInterface::SetAdapterProperty( BluetoothDaemonInterface::SetAdapterProperty(
const BluetoothNamedValue& aProperty, BluetoothResultHandler* aRes) const BluetoothProperty& aProperty, BluetoothResultHandler* aRes)
{ {
nsresult rv = static_cast<BluetoothDaemonCoreModule*> nsresult rv = static_cast<BluetoothDaemonCoreModule*>
(mProtocol)->SetAdapterPropertyCmd(aProperty, aRes); (mProtocol)->SetAdapterPropertyCmd(aProperty, aRes);
@ -678,11 +678,11 @@ BluetoothDaemonInterface::GetRemoteDeviceProperties(
void void
BluetoothDaemonInterface::GetRemoteDeviceProperty( BluetoothDaemonInterface::GetRemoteDeviceProperty(
const BluetoothAddress& aRemoteAddr, const nsAString& aName, const BluetoothAddress& aRemoteAddr, BluetoothPropertyType aType,
BluetoothResultHandler* aRes) BluetoothResultHandler* aRes)
{ {
nsresult rv = static_cast<BluetoothDaemonCoreModule*> nsresult rv = static_cast<BluetoothDaemonCoreModule*>
(mProtocol)->GetRemoteDevicePropertyCmd(aRemoteAddr, aName, aRes); (mProtocol)->GetRemoteDevicePropertyCmd(aRemoteAddr, aType, aRes);
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
DispatchError(aRes, rv); DispatchError(aRes, rv);
} }
@ -690,7 +690,7 @@ BluetoothDaemonInterface::GetRemoteDeviceProperty(
void void
BluetoothDaemonInterface::SetRemoteDeviceProperty( BluetoothDaemonInterface::SetRemoteDeviceProperty(
const BluetoothAddress& aRemoteAddr, const BluetoothNamedValue& aProperty, const BluetoothAddress& aRemoteAddr, const BluetoothProperty& aProperty,
BluetoothResultHandler* aRes) BluetoothResultHandler* aRes)
{ {
nsresult rv = static_cast<BluetoothDaemonCoreModule*> nsresult rv = static_cast<BluetoothDaemonCoreModule*>
@ -797,7 +797,7 @@ BluetoothDaemonInterface::GetConnectionState(const BluetoothAddress& aBdAddr,
void void
BluetoothDaemonInterface::PinReply(const BluetoothAddress& aBdAddr, BluetoothDaemonInterface::PinReply(const BluetoothAddress& aBdAddr,
bool aAccept, bool aAccept,
const nsAString& aPinCode, const BluetoothPinCode& aPinCode,
BluetoothResultHandler* aRes) BluetoothResultHandler* aRes)
{ {
nsresult rv = static_cast<BluetoothDaemonCoreModule*> nsresult rv = static_cast<BluetoothDaemonCoreModule*>

View File

@ -55,9 +55,9 @@ public:
/* Adapter Properties */ /* Adapter Properties */
void GetAdapterProperties(BluetoothResultHandler* aRes) override; void GetAdapterProperties(BluetoothResultHandler* aRes) override;
void GetAdapterProperty(const nsAString& aName, void GetAdapterProperty(BluetoothPropertyType aType,
BluetoothResultHandler* aRes) override; BluetoothResultHandler* aRes) override;
void SetAdapterProperty(const BluetoothNamedValue& aProperty, void SetAdapterProperty(const BluetoothProperty& aProperty,
BluetoothResultHandler* aRes) override; BluetoothResultHandler* aRes) override;
/* Remote Device Properties */ /* Remote Device Properties */
@ -65,10 +65,10 @@ public:
void GetRemoteDeviceProperties(const BluetoothAddress& aRemoteAddr, void GetRemoteDeviceProperties(const BluetoothAddress& aRemoteAddr,
BluetoothResultHandler* aRes) override; BluetoothResultHandler* aRes) override;
void GetRemoteDeviceProperty(const BluetoothAddress& aRemoteAddr, void GetRemoteDeviceProperty(const BluetoothAddress& aRemoteAddr,
const nsAString& aName, BluetoothPropertyType aType,
BluetoothResultHandler* aRes) override; BluetoothResultHandler* aRes) override;
void SetRemoteDeviceProperty(const BluetoothAddress& aRemoteAddr, void SetRemoteDeviceProperty(const BluetoothAddress& aRemoteAddr,
const BluetoothNamedValue& aProperty, const BluetoothProperty& aProperty,
BluetoothResultHandler* aRes) override; BluetoothResultHandler* aRes) override;
/* Remote Services */ /* Remote Services */
@ -102,7 +102,7 @@ public:
/* Authentication */ /* Authentication */
void PinReply(const BluetoothAddress& aBdAddr, bool aAccept, void PinReply(const BluetoothAddress& aBdAddr, bool aAccept,
const nsAString& aPinCode, const BluetoothPinCode& aPinCode,
BluetoothResultHandler* aRes) override; BluetoothResultHandler* aRes) override;
void SspReply(const BluetoothAddress& aBdAddr, void SspReply(const BluetoothAddress& aBdAddr,

View File

@ -24,7 +24,7 @@ const int BluetoothDaemonSocketModule::MAX_NUM_CLIENTS = 1;
nsresult nsresult
BluetoothDaemonSocketModule::ListenCmd(BluetoothSocketType aType, BluetoothDaemonSocketModule::ListenCmd(BluetoothSocketType aType,
const nsAString& aServiceName, const BluetoothServiceName& aServiceName,
const BluetoothUuid& aServiceUuid, const BluetoothUuid& aServiceUuid,
int aChannel, bool aEncrypt, int aChannel, bool aEncrypt,
bool aAuth, bool aAuth,
@ -38,7 +38,7 @@ BluetoothDaemonSocketModule::ListenCmd(BluetoothSocketType aType,
nsresult rv = PackPDU( nsresult rv = PackPDU(
aType, aType,
PackConversion<nsAString, BluetoothServiceName>(aServiceName), aServiceName,
aServiceUuid, aServiceUuid,
PackConversion<int, int32_t>(aChannel), PackConversion<int, int32_t>(aChannel),
SocketFlags(aEncrypt, aAuth), *pdu); SocketFlags(aEncrypt, aAuth), *pdu);
@ -306,7 +306,7 @@ BluetoothDaemonSocketInterface::~BluetoothDaemonSocketInterface()
void void
BluetoothDaemonSocketInterface::Listen(BluetoothSocketType aType, BluetoothDaemonSocketInterface::Listen(BluetoothSocketType aType,
const nsAString& aServiceName, const BluetoothServiceName& aServiceName,
const BluetoothUuid& aServiceUuid, const BluetoothUuid& aServiceUuid,
int aChannel, bool aEncrypt, int aChannel, bool aEncrypt,
bool aAuth, bool aAuth,

View File

@ -39,7 +39,7 @@ public:
// //
nsresult ListenCmd(BluetoothSocketType aType, nsresult ListenCmd(BluetoothSocketType aType,
const nsAString& aServiceName, const BluetoothServiceName& aServiceName,
const BluetoothUuid& aServiceUuid, const BluetoothUuid& aServiceUuid,
int aChannel, bool aEncrypt, bool aAuth, int aChannel, bool aEncrypt, bool aAuth,
BluetoothSocketResultHandler* aRes); BluetoothSocketResultHandler* aRes);
@ -112,7 +112,7 @@ public:
~BluetoothDaemonSocketInterface(); ~BluetoothDaemonSocketInterface();
void Listen(BluetoothSocketType aType, void Listen(BluetoothSocketType aType,
const nsAString& aServiceName, const BluetoothServiceName& aServiceName,
const BluetoothUuid& aServiceUuid, const BluetoothUuid& aServiceUuid,
int aChannel, bool aEncrypt, bool aAuth, int aChannel, bool aEncrypt, bool aAuth,
BluetoothSocketResultHandler* aRes) override; BluetoothSocketResultHandler* aRes) override;

View File

@ -1046,8 +1046,16 @@ BluetoothServiceBluedroid::SetProperty(BluetoothObjectType aType,
ENSURE_BLUETOOTH_IS_READY(aRunnable, NS_OK); ENSURE_BLUETOOTH_IS_READY(aRunnable, NS_OK);
BluetoothProperty property;
nsresult rv = NamedValueToProperty(aValue, property);
if (NS_FAILED(rv)) {
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
return rv;
}
mSetAdapterPropertyRunnables.AppendElement(aRunnable); mSetAdapterPropertyRunnables.AppendElement(aRunnable);
sBtInterface->SetAdapterProperty(aValue, sBtInterface->SetAdapterProperty(
property,
new DispatchReplyErrorResultHandler(mSetAdapterPropertyRunnables, new DispatchReplyErrorResultHandler(mSetAdapterPropertyRunnables,
aRunnable)); aRunnable));
@ -1347,7 +1355,14 @@ BluetoothServiceBluedroid::PinReplyInternal(
return; return;
} }
sBtInterface->PinReply(address, aAccept, aPinCode, BluetoothPinCode pinCode;
rv = StringToPinCode(aPinCode, pinCode);
if (NS_FAILED(rv)) {
DispatchReplyError(aRunnable, STATUS_PARM_INVALID);
return;
}
sBtInterface->PinReply(address, aAccept, pinCode,
new PinReplyResultHandler(aRunnable)); new PinReplyResultHandler(aRunnable));
} }
@ -1940,7 +1955,7 @@ BluetoothServiceBluedroid::AdapterStateChangedNotification(bool aState)
// be connectable and non-discoverable. // be connectable and non-discoverable.
NS_ENSURE_TRUE_VOID(sBtInterface); NS_ENSURE_TRUE_VOID(sBtInterface);
sBtInterface->SetAdapterProperty( sBtInterface->SetAdapterProperty(
BluetoothNamedValue(NS_ConvertUTF8toUTF16("Discoverable"), false), BluetoothProperty(PROPERTY_ADAPTER_SCAN_MODE, SCAN_MODE_CONNECTABLE),
new SetAdapterPropertyDiscoverableResultHandler()); new SetAdapterPropertyDiscoverableResultHandler());
// Trigger OPP & PBAP managers to listen // Trigger OPP & PBAP managers to listen
@ -2286,7 +2301,8 @@ BluetoothServiceBluedroid::DiscoveryStateChangedNotification(bool aState)
void void
BluetoothServiceBluedroid::PinRequestNotification( BluetoothServiceBluedroid::PinRequestNotification(
const BluetoothAddress& aRemoteBdAddr, const nsAString& aBdName, uint32_t aCod) const BluetoothAddress& aRemoteBdAddr, const BluetoothRemoteName& aBdName,
uint32_t aCod)
{ {
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
@ -2297,7 +2313,9 @@ BluetoothServiceBluedroid::PinRequestNotification(
nsAutoString bdAddr; nsAutoString bdAddr;
AddressToString(aRemoteBdAddr, bdAddr); AddressToString(aRemoteBdAddr, bdAddr);
nsString bdName(aBdName); nsAutoString bdName;
RemoteNameToString(aBdName, bdName);
if (bdName.IsEmpty()) { if (bdName.IsEmpty()) {
mDeviceNameMap.Get(aRemoteBdAddr, &bdName); mDeviceNameMap.Get(aRemoteBdAddr, &bdName);
} else { } else {
@ -2318,7 +2336,7 @@ BluetoothServiceBluedroid::PinRequestNotification(
void void
BluetoothServiceBluedroid::SspRequestNotification( BluetoothServiceBluedroid::SspRequestNotification(
const BluetoothAddress& aRemoteBdAddr, const nsAString& aBdName, const BluetoothAddress& aRemoteBdAddr, const BluetoothRemoteName& aBdName,
uint32_t aCod, BluetoothSspVariant aPairingVariant, uint32_t aPassKey) uint32_t aCod, BluetoothSspVariant aPairingVariant, uint32_t aPassKey)
{ {
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
@ -2330,7 +2348,9 @@ BluetoothServiceBluedroid::SspRequestNotification(
nsAutoString bdAddr; nsAutoString bdAddr;
AddressToString(aRemoteBdAddr, bdAddr); AddressToString(aRemoteBdAddr, bdAddr);
nsString bdName(aBdName); nsAutoString bdName;
RemoteNameToString(aBdName, bdName);
if (bdName.IsEmpty()) { if (bdName.IsEmpty()) {
mDeviceNameMap.Get(aRemoteBdAddr, &bdName); mDeviceNameMap.Get(aRemoteBdAddr, &bdName);
} else { } else {
@ -2460,7 +2480,8 @@ BluetoothServiceBluedroid::BondStateChangedNotification(
void void
BluetoothServiceBluedroid::AclStateChangedNotification( BluetoothServiceBluedroid::AclStateChangedNotification(
BluetoothStatus aStatus, const BluetoothAddress& aRemoteBdAddr, bool aState) BluetoothStatus aStatus, const BluetoothAddress& aRemoteBdAddr,
BluetoothAclState aState)
{ {
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());

View File

@ -398,10 +398,10 @@ public:
virtual void DiscoveryStateChangedNotification(bool aState) override; virtual void DiscoveryStateChangedNotification(bool aState) override;
virtual void PinRequestNotification(const BluetoothAddress& aRemoteBdAddr, virtual void PinRequestNotification(const BluetoothAddress& aRemoteBdAddr,
const nsAString& aBdName, const BluetoothRemoteName& aBdName,
uint32_t aCod) override; uint32_t aCod) override;
virtual void SspRequestNotification(const BluetoothAddress& aRemoteBdAddr, virtual void SspRequestNotification(const BluetoothAddress& aRemoteBdAddr,
const nsAString& aBdName, const BluetoothRemoteName& aBdName,
uint32_t aCod, uint32_t aCod,
BluetoothSspVariant aPairingVariant, BluetoothSspVariant aPairingVariant,
uint32_t aPasskey) override; uint32_t aPasskey) override;
@ -411,7 +411,7 @@ public:
BluetoothBondState aState) override; BluetoothBondState aState) override;
virtual void AclStateChangedNotification( virtual void AclStateChangedNotification(
BluetoothStatus aStatus, const BluetoothAddress& aRemoteBdAddr, BluetoothStatus aStatus, const BluetoothAddress& aRemoteBdAddr,
bool aState) override; BluetoothAclState aState) override;
virtual void DutModeRecvNotification(uint16_t aOpcode, virtual void DutModeRecvNotification(uint16_t aOpcode,
const uint8_t* aBuf, const uint8_t* aBuf,

View File

@ -732,6 +732,12 @@ BluetoothSocket::Listen(const nsAString& aServiceName,
{ {
MOZ_ASSERT(!mImpl); MOZ_ASSERT(!mImpl);
BluetoothServiceName serviceName;
nsresult rv = StringToServiceName(aServiceName, serviceName);
if (NS_FAILED(rv)) {
return rv;
}
SetConnectionStatus(SOCKET_LISTENING); SetConnectionStatus(SOCKET_LISTENING);
mImpl = new DroidSocketImpl(aConsumerLoop, aIOLoop, this); mImpl = new DroidSocketImpl(aConsumerLoop, aIOLoop, this);
@ -741,7 +747,7 @@ BluetoothSocket::Listen(const nsAString& aServiceName,
sBluetoothSocketInterface->Listen( sBluetoothSocketInterface->Listen(
aType, aType,
aServiceName, aServiceUuid, aChannel, serviceName, aServiceUuid, aChannel,
aEncrypt, aAuth, res); aEncrypt, aAuth, res);
return NS_OK; return NS_OK;

View File

@ -312,6 +312,11 @@ enum BluetoothStatus {
NUM_STATUS NUM_STATUS
}; };
enum BluetoothAclState {
ACL_STATE_CONNECTED,
ACL_STATE_DISCONNECTED
};
enum BluetoothBondState { enum BluetoothBondState {
BOND_STATE_NONE, BOND_STATE_NONE,
BOND_STATE_BONDING, BOND_STATE_BONDING,
@ -492,6 +497,15 @@ struct BluetoothUuid {
} }
}; };
struct BluetoothPinCode {
uint8_t mPinCode[16]; /* not \0-terminated */
uint8_t mLength;
};
struct BluetoothServiceName {
uint8_t mName[255]; /* not \0-terminated */
};
struct BluetoothServiceRecord { struct BluetoothServiceRecord {
BluetoothUuid mUuid; BluetoothUuid mUuid;
uint16_t mChannel; uint16_t mChannel;
@ -504,6 +518,10 @@ struct BluetoothRemoteInfo {
int mManufacturer; int mManufacturer;
}; };
struct BluetoothRemoteName {
uint8_t mName[248]; /* not \0-terminated */
};
struct BluetoothProperty { struct BluetoothProperty {
/* Type */ /* Type */
BluetoothPropertyType mType; BluetoothPropertyType mType;
@ -542,6 +560,68 @@ struct BluetoothProperty {
/* PROPERTY_REMOTE_VERSION_INFO */ /* PROPERTY_REMOTE_VERSION_INFO */
BluetoothRemoteInfo mRemoteInfo; BluetoothRemoteInfo mRemoteInfo;
BluetoothProperty()
: mType(PROPERTY_UNKNOWN)
{ }
explicit BluetoothProperty(BluetoothPropertyType aType,
const BluetoothAddress& aBdAddress)
: mType(aType)
, mBdAddress(aBdAddress)
{ }
explicit BluetoothProperty(BluetoothPropertyType aType,
const nsAString& aString)
: mType(aType)
, mString(aString)
{ }
explicit BluetoothProperty(BluetoothPropertyType aType,
const nsTArray<BluetoothUuid>& aUuidArray)
: mType(aType)
, mUuidArray(aUuidArray)
{ }
explicit BluetoothProperty(BluetoothPropertyType aType,
const nsTArray<BluetoothAddress>& aBdAddressArray)
: mType(aType)
, mBdAddressArray(aBdAddressArray)
{ }
explicit BluetoothProperty(BluetoothPropertyType aType, uint32_t aUint32)
: mType(aType)
, mUint32(aUint32)
{ }
explicit BluetoothProperty(BluetoothPropertyType aType, int32_t aInt32)
: mType(aType)
, mInt32(aInt32)
{ }
explicit BluetoothProperty(BluetoothPropertyType aType,
BluetoothTypeOfDevice aTypeOfDevice)
: mType(aType)
, mTypeOfDevice(aTypeOfDevice)
{ }
explicit BluetoothProperty(BluetoothPropertyType aType,
const BluetoothServiceRecord& aServiceRecord)
: mType(aType)
, mServiceRecord(aServiceRecord)
{ }
explicit BluetoothProperty(BluetoothPropertyType aType,
BluetoothScanMode aScanMode)
: mType(aType)
, mScanMode(aScanMode)
{ }
explicit BluetoothProperty(BluetoothPropertyType aType,
const BluetoothRemoteInfo& aRemoteInfo)
: mType(aType)
, mRemoteInfo(aRemoteInfo)
{ }
}; };
enum BluetoothSocketType { enum BluetoothSocketType {

View File

@ -876,13 +876,13 @@ BluetoothNotificationHandler::DiscoveryStateChangedNotification(bool aState)
void void
BluetoothNotificationHandler::PinRequestNotification( BluetoothNotificationHandler::PinRequestNotification(
const BluetoothAddress& aRemoteBdAddr, const nsAString& aBdName, const BluetoothAddress& aRemoteBdAddr, const BluetoothRemoteName& aBdName,
uint32_t aCod) uint32_t aCod)
{ } { }
void void
BluetoothNotificationHandler::SspRequestNotification( BluetoothNotificationHandler::SspRequestNotification(
const BluetoothAddress& aRemoteBdAddr, const nsAString& aBdName, const BluetoothAddress& aRemoteBdAddr, const BluetoothRemoteName& aBdName,
uint32_t aCod, BluetoothSspVariant aPairingVariant, uint32_t aPassKey) uint32_t aCod, BluetoothSspVariant aPairingVariant, uint32_t aPassKey)
{ } { }
@ -894,7 +894,8 @@ BluetoothNotificationHandler::BondStateChangedNotification(
void void
BluetoothNotificationHandler::AclStateChangedNotification( BluetoothNotificationHandler::AclStateChangedNotification(
BluetoothStatus aStatus, const BluetoothAddress& aRemoteBdAddr, bool aState) BluetoothStatus aStatus, const BluetoothAddress& aRemoteBdAddr,
BluetoothAclState aState)
{ } { }
void void

View File

@ -56,7 +56,7 @@ public:
// Init and Cleanup is handled by BluetoothInterface // Init and Cleanup is handled by BluetoothInterface
virtual void Listen(BluetoothSocketType aType, virtual void Listen(BluetoothSocketType aType,
const nsAString& aServiceName, const BluetoothServiceName& aServiceName,
const BluetoothUuid& aServiceUuid, const BluetoothUuid& aServiceUuid,
int aChannel, bool aEncrypt, bool aAuth, int aChannel, bool aEncrypt, bool aAuth,
BluetoothSocketResultHandler* aRes) = 0; BluetoothSocketResultHandler* aRes) = 0;
@ -949,10 +949,10 @@ public:
virtual void DiscoveryStateChangedNotification(bool aState); virtual void DiscoveryStateChangedNotification(bool aState);
virtual void PinRequestNotification(const BluetoothAddress& aRemoteBdAddr, virtual void PinRequestNotification(const BluetoothAddress& aRemoteBdAddr,
const nsAString& aBdName, const BluetoothRemoteName& aBdName,
uint32_t aCod); uint32_t aCod);
virtual void SspRequestNotification(const BluetoothAddress& aRemoteBdAddr, virtual void SspRequestNotification(const BluetoothAddress& aRemoteBdAddr,
const nsAString& aBdName, const BluetoothRemoteName& aBdName,
uint32_t aCod, uint32_t aCod,
BluetoothSspVariant aPairingVariant, BluetoothSspVariant aPairingVariant,
uint32_t aPassKey); uint32_t aPassKey);
@ -962,7 +962,7 @@ public:
BluetoothBondState aState); BluetoothBondState aState);
virtual void AclStateChangedNotification( virtual void AclStateChangedNotification(
BluetoothStatus aStatus, const BluetoothAddress& aRemoteBdAddr, BluetoothStatus aStatus, const BluetoothAddress& aRemoteBdAddr,
bool aState); BluetoothAclState aState);
virtual void DutModeRecvNotification(uint16_t aOpcode, virtual void DutModeRecvNotification(uint16_t aOpcode,
const uint8_t* aBuf, uint8_t aLen); const uint8_t* aBuf, uint8_t aLen);
@ -1038,9 +1038,9 @@ public:
/* Adapter Properties */ /* Adapter Properties */
virtual void GetAdapterProperties(BluetoothResultHandler* aRes) = 0; virtual void GetAdapterProperties(BluetoothResultHandler* aRes) = 0;
virtual void GetAdapterProperty(const nsAString& aName, virtual void GetAdapterProperty(BluetoothPropertyType,
BluetoothResultHandler* aRes) = 0; BluetoothResultHandler* aRes) = 0;
virtual void SetAdapterProperty(const BluetoothNamedValue& aProperty, virtual void SetAdapterProperty(const BluetoothProperty& aProperty,
BluetoothResultHandler* aRes) = 0; BluetoothResultHandler* aRes) = 0;
/* Remote Device Properties */ /* Remote Device Properties */
@ -1048,10 +1048,10 @@ public:
virtual void GetRemoteDeviceProperties(const BluetoothAddress& aRemoteAddr, virtual void GetRemoteDeviceProperties(const BluetoothAddress& aRemoteAddr,
BluetoothResultHandler* aRes) = 0; BluetoothResultHandler* aRes) = 0;
virtual void GetRemoteDeviceProperty(const BluetoothAddress& aRemoteAddr, virtual void GetRemoteDeviceProperty(const BluetoothAddress& aRemoteAddr,
const nsAString& aName, BluetoothPropertyType aType,
BluetoothResultHandler* aRes) = 0; BluetoothResultHandler* aRes) = 0;
virtual void SetRemoteDeviceProperty(const BluetoothAddress& aRemoteAddr, virtual void SetRemoteDeviceProperty(const BluetoothAddress& aRemoteAddr,
const BluetoothNamedValue& aProperty, const BluetoothProperty& aProperty,
BluetoothResultHandler* aRes) = 0; BluetoothResultHandler* aRes) = 0;
/* Remote Services */ /* Remote Services */
@ -1085,7 +1085,7 @@ public:
/* Authentication */ /* Authentication */
virtual void PinReply(const BluetoothAddress& aBdAddr, bool aAccept, virtual void PinReply(const BluetoothAddress& aBdAddr, bool aAccept,
const nsAString& aPinCode, const BluetoothPinCode& aPinCode,
BluetoothResultHandler* aRes) = 0; BluetoothResultHandler* aRes) = 0;
virtual void SspReply(const BluetoothAddress& aBdAddr, virtual void SspReply(const BluetoothAddress& aBdAddr,

View File

@ -61,6 +61,126 @@ StringToAddress(const nsAString& aString, BluetoothAddress& aAddress)
return NS_OK; return NS_OK;
} }
nsresult
StringToPinCode(const nsAString& aString, BluetoothPinCode& aPinCode)
{
NS_ConvertUTF16toUTF8 stringUTF8(aString);
auto len = stringUTF8.Length();
if (len > sizeof(aPinCode.mPinCode)) {
BT_LOGR("Service-name string too long");
return NS_ERROR_ILLEGAL_VALUE;
}
auto str = stringUTF8.get();
memcpy(aPinCode.mPinCode, str, len);
memset(aPinCode.mPinCode + len, 0, sizeof(aPinCode.mPinCode) - len);
aPinCode.mLength = len;
return NS_OK;
}
nsresult
StringToPropertyType(const nsAString& aString, BluetoothPropertyType& aType)
{
if (aString.EqualsLiteral("Name")) {
aType = PROPERTY_BDNAME;
} else if (aString.EqualsLiteral("Discoverable")) {
aType = PROPERTY_ADAPTER_SCAN_MODE;
} else if (aString.EqualsLiteral("DiscoverableTimeout")) {
aType = PROPERTY_ADAPTER_DISCOVERY_TIMEOUT;
} else {
BT_LOGR("Invalid property name: %s", NS_ConvertUTF16toUTF8(aString).get());
aType = PROPERTY_UNKNOWN; // silences compiler warning
return NS_ERROR_ILLEGAL_VALUE;
}
return NS_OK;
}
nsresult
NamedValueToProperty(const BluetoothNamedValue& aValue,
BluetoothProperty& aProperty)
{
nsresult rv = StringToPropertyType(aValue.name(), aProperty.mType);
if (NS_FAILED(rv)) {
return rv;
}
switch (aProperty.mType) {
case PROPERTY_BDNAME:
if (aValue.value().type() != BluetoothValue::TnsString) {
BT_LOGR("Bluetooth property value is not a string");
return NS_ERROR_ILLEGAL_VALUE;
}
// Set name
aProperty.mString = aValue.value().get_nsString();
break;
case PROPERTY_ADAPTER_SCAN_MODE:
if (aValue.value().type() != BluetoothValue::Tbool) {
BT_LOGR("Bluetooth property value is not a boolean");
return NS_ERROR_ILLEGAL_VALUE;
}
// Set scan mode
if (aValue.value().get_bool()) {
aProperty.mScanMode = SCAN_MODE_CONNECTABLE_DISCOVERABLE;
} else {
aProperty.mScanMode = SCAN_MODE_CONNECTABLE;
}
break;
case PROPERTY_ADAPTER_DISCOVERY_TIMEOUT:
if (aValue.value().type() != BluetoothValue::Tuint32_t) {
BT_LOGR("Bluetooth property value is not an unsigned integer");
return NS_ERROR_ILLEGAL_VALUE;
}
// Set discoverable timeout
aProperty.mUint32 = aValue.value().get_uint32_t();
break;
default:
BT_LOGR("Invalid property value type");
return NS_ERROR_ILLEGAL_VALUE;
}
return NS_OK;
}
void
RemoteNameToString(const BluetoothRemoteName& aRemoteName, nsAString& aString)
{
auto name = reinterpret_cast<const char*>(aRemoteName.mName);
/* The content in |BluetoothRemoteName| is not a C string and not
* terminated by \0. We use |strnlen| to limit its length.
*/
aString =
NS_ConvertUTF8toUTF16(name, strnlen(name, sizeof(aRemoteName.mName)));
}
nsresult
StringToServiceName(const nsAString& aString,
BluetoothServiceName& aServiceName)
{
NS_ConvertUTF16toUTF8 serviceNameUTF8(aString);
auto len = serviceNameUTF8.Length();
if (len > sizeof(aServiceName.mName)) {
BT_LOGR("Service-name string too long");
return NS_ERROR_ILLEGAL_VALUE;
}
auto str = serviceNameUTF8.get();
memcpy(aServiceName.mName, str, len);
memset(aServiceName.mName + len, 0, sizeof(aServiceName.mName) - len);
return NS_OK;
}
void void
UuidToString(const BluetoothUuid& aUuid, nsAString& aString) UuidToString(const BluetoothUuid& aUuid, nsAString& aString)
{ {

View File

@ -33,6 +33,43 @@ AddressToString(const BluetoothAddress& aAddress, nsAString& aString);
nsresult nsresult
StringToAddress(const nsAString& aString, BluetoothAddress& aAddress); StringToAddress(const nsAString& aString, BluetoothAddress& aAddress);
//
// Pin code/string conversion
//
nsresult
StringToPinCode(const nsAString& aString, BluetoothPinCode& aPinCode);
//
// Property type/string conversion
//
nsresult
StringToPropertyType(const nsAString& aString, BluetoothPropertyType& aType);
//
// Property conversion
//
nsresult
NamedValueToProperty(const BluetoothNamedValue& aIn,
BluetoothProperty& aProperty);
//
// Remote name/string conversion
//
void
RemoteNameToString(const BluetoothRemoteName& aRemoteName, nsAString& aString);
//
// Service name/string conversion
//
nsresult
StringToServiceName(const nsAString& aString,
BluetoothServiceName& aServiceName);
// //
// BluetoothUuid <-> uuid string conversion // BluetoothUuid <-> uuid string conversion
// //

View File

@ -150,6 +150,9 @@ public class PostSearchFragment extends Fragment {
return false; return false;
} }
// We are suppressing the 'deprecation' warning because the new method is only available starting with API
// level 23 and that's much higher than our current minSdkLevel (1208580).
@SuppressWarnings("deprecation")
@Override @Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
Log.e(LOG_TAG, "Error loading search results: " + description); Log.e(LOG_TAG, "Error loading search results: " + description);

View File

@ -14,10 +14,6 @@ import android.util.Log;
import com.jayway.android.robotium.solo.Solo; import com.jayway.android.robotium.solo.Solo;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.DefaultHttpClient;
import org.mozilla.gecko.Actions; import org.mozilla.gecko.Actions;
import org.mozilla.gecko.AppConstants; import org.mozilla.gecko.AppConstants;
import org.mozilla.gecko.Assert; import org.mozilla.gecko.Assert;
@ -32,6 +28,8 @@ import org.mozilla.gecko.GeckoAppShell;
import org.mozilla.gecko.GeckoEvent; import org.mozilla.gecko.GeckoEvent;
import org.mozilla.gecko.updater.UpdateServiceHelper; import org.mozilla.gecko.updater.UpdateServiceHelper;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Map; import java.util.Map;
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -236,15 +234,21 @@ public abstract class BaseRobocopTest extends ActivityInstrumentationTestCase2<A
// those are managed by Fennec's proxy settings. // those are managed by Fennec's proxy settings.
final String rawUrl = ((String) mConfig.get("rawhost")).replaceAll("(/$)", ""); final String rawUrl = ((String) mConfig.get("rawhost")).replaceAll("(/$)", "");
HttpURLConnection urlConnection = null;
try { try {
final HttpClient httpclient = new DefaultHttpClient(); urlConnection = (HttpURLConnection) new URL(rawUrl).openConnection();
final HttpResponse response = httpclient.execute(new HttpGet(rawUrl));
final int statusCode = response.getStatusLine().getStatusCode(); final int statusCode = urlConnection.getResponseCode();
if (200 != statusCode) { if (200 != statusCode) {
throw new IllegalStateException("Status code: " + statusCode); throw new IllegalStateException("Status code: " + statusCode);
} }
} catch (Exception e) { } catch (Exception e) {
mAsserter.ok(false, "Robocop tests on your device need network/wifi access to reach: [" + rawUrl + "].", e.toString()); mAsserter.ok(false, "Robocop tests on your device need network/wifi access to reach: [" + rawUrl + "].", e.toString());
} finally {
if (urlConnection != null) {
urlConnection.disconnect();
}
} }
} }

View File

@ -172,9 +172,9 @@ public class testImportFromAndroid extends AboutHomeTest {
Cursor cursor = null; Cursor cursor = null;
try { try {
if (data.equals("history")) { if (data.equals("history")) {
cursor = Browser.getAllVisitedUrls(resolver); cursor = getAllVisitedUrls(resolver);
} else if (data.equals("bookmarks")) { } else if (data.equals("bookmarks")) {
cursor = Browser.getAllBookmarks(resolver); cursor = getAllBookmarks(resolver);
} }
if (cursor != null) { if (cursor != null) {
cursor.moveToFirst(); cursor.moveToFirst();
@ -205,6 +205,23 @@ public class testImportFromAndroid extends AboutHomeTest {
} }
} }
private static Cursor getAllVisitedUrls(ContentResolver resolver) {
final Uri authorityUri = Uri.parse("content://com.android.browser");
final Uri contentUri = Uri.withAppendedPath(authorityUri, "combined");
return resolver.query(contentUri,
new String[] { "url" }, null, null,
"created ASC");
}
private static Cursor getAllBookmarks(ContentResolver resolver) {
final Uri bookmarksUri = Uri.parse("content://browser/bookmarks");
return resolver.query(bookmarksUri,
new String[] { "url" },
"folder = 0", null, null);
}
@Override @Override
public void tearDown() throws Exception { public void tearDown() throws Exception {
deleteImportedData(); deleteImportedData();

View File

@ -31,6 +31,11 @@ if [ 0$B2G_DEBUG -ne 0 ]; then
debug_flag='--debug' debug_flag='--debug'
fi fi
if ! aws --output=text s3 ls s3://b2g-phone-backups/; then
echo "[aws:error] Failed to connect to AWS! Are the AWS credentials ok?"
exit 1
fi
backup_file=$(aws --output=text s3 ls s3://b2g-phone-backups/$TARGET/ | tail -1 | awk '{print $NF}') backup_file=$(aws --output=text s3 ls s3://b2g-phone-backups/$TARGET/ | tail -1 | awk '{print $NF}')
if echo $backup_file | grep '\.tar\.bz2'; then if echo $backup_file | grep '\.tar\.bz2'; then