mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-13 03:24:26 +00:00
Merge m-c to inbound. a=merge
--HG-- rename : mobile/android/tests/browser/junit3/src/tests/BrowserTestCase.java => mobile/android/tests/browser/junit3/src/BrowserTestCase.java rename : mobile/android/tests/browser/junit3/src/tests/TestDistribution.java => mobile/android/tests/browser/junit3/src/TestDistribution.java rename : mobile/android/tests/browser/junit3/src/tests/TestGeckoMenu.java => mobile/android/tests/browser/junit3/src/TestGeckoMenu.java rename : mobile/android/tests/browser/junit3/src/tests/TestGeckoProfilesProvider.java => mobile/android/tests/browser/junit3/src/TestGeckoProfilesProvider.java rename : mobile/android/tests/browser/junit3/src/tests/TestGeckoSharedPrefs.java => mobile/android/tests/browser/junit3/src/TestGeckoSharedPrefs.java rename : mobile/android/tests/browser/junit3/src/tests/TestImageDownloader.java => mobile/android/tests/browser/junit3/src/TestImageDownloader.java rename : mobile/android/tests/browser/junit3/src/tests/TestJarReader.java => mobile/android/tests/browser/junit3/src/TestJarReader.java rename : mobile/android/tests/browser/junit3/src/tests/TestRawResource.java => mobile/android/tests/browser/junit3/src/TestRawResource.java rename : mobile/android/tests/browser/junit3/src/tests/TestSuggestedSites.java => mobile/android/tests/browser/junit3/src/TestSuggestedSites.java rename : mobile/android/tests/browser/junit3/src/tests/TestTopSitesCursorWrapper.java => mobile/android/tests/browser/junit3/src/TestTopSitesCursorWrapper.java extra : rebase_source : 45e2cb5230292b398a90b74756ec65f86bfb03ef
This commit is contained in:
commit
1a839a6f29
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="fe92ddd450e03b38edb2d465de7897971d68ac68">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="c71fd5d8c9c7cb021c97e5e9fbb29f92b50a084d"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="4acd3e69b263b54f4111e3586ff4ade84b49b4da"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="6969df171e5295f855f12d12db0382048e6892e7"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
|
@ -19,7 +19,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c71fd5d8c9c7cb021c97e5e9fbb29f92b50a084d"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4acd3e69b263b54f4111e3586ff4ade84b49b4da"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="6969df171e5295f855f12d12db0382048e6892e7"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>
|
||||
|
@ -17,7 +17,7 @@
|
||||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="c71fd5d8c9c7cb021c97e5e9fbb29f92b50a084d"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="4acd3e69b263b54f4111e3586ff4ade84b49b4da"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="6969df171e5295f855f12d12db0382048e6892e7"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="facdb3593e63dcbb740709303a5b2527113c50a0"/>
|
||||
@ -130,7 +130,7 @@
|
||||
<project name="device/generic/armv7-a-neon" path="device/generic/armv7-a-neon" revision="3a9a17613cc685aa232432566ad6cc607eab4ec1"/>
|
||||
<project name="device_generic_goldfish" path="device/generic/goldfish" remote="b2g" revision="197cd9492b9fadaa915c5daf36ff557f8f4a8d1c"/>
|
||||
<project name="platform/external/libnfc-nci" path="external/libnfc-nci" revision="7d33aaf740bbf6c7c6e9c34a92b371eda311b66b"/>
|
||||
<project name="libnfcemu" path="platform/external/libnfcemu" remote="b2g" revision="682e556367e0049bb3ae127cec6e6c459abca1b0"/>
|
||||
<project name="libnfcemu" path="external/libnfcemu" remote="b2g" revision="682e556367e0049bb3ae127cec6e6c459abca1b0"/>
|
||||
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="57b16fcb790bdf0b53b3c6435a37ccc8ca90ed36"/>
|
||||
<project name="platform/external/wpa_supplicant_8" path="external/wpa_supplicant_8" revision="0e56e450367cd802241b27164a2979188242b95f"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="9f28c4faea3b2f01db227b2467b08aeba96d9bec"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="fe92ddd450e03b38edb2d465de7897971d68ac68">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="c71fd5d8c9c7cb021c97e5e9fbb29f92b50a084d"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="4acd3e69b263b54f4111e3586ff4ade84b49b4da"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="6969df171e5295f855f12d12db0382048e6892e7"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
|
@ -19,7 +19,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c71fd5d8c9c7cb021c97e5e9fbb29f92b50a084d"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4acd3e69b263b54f4111e3586ff4ade84b49b4da"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="6969df171e5295f855f12d12db0382048e6892e7"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="fe92ddd450e03b38edb2d465de7897971d68ac68">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="c71fd5d8c9c7cb021c97e5e9fbb29f92b50a084d"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="4acd3e69b263b54f4111e3586ff4ade84b49b4da"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="6969df171e5295f855f12d12db0382048e6892e7"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
|
@ -17,7 +17,7 @@
|
||||
</project>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="c71fd5d8c9c7cb021c97e5e9fbb29f92b50a084d"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="4acd3e69b263b54f4111e3586ff4ade84b49b4da"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="6969df171e5295f855f12d12db0382048e6892e7"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="facdb3593e63dcbb740709303a5b2527113c50a0"/>
|
||||
|
@ -4,6 +4,6 @@
|
||||
"remote": "",
|
||||
"branch": ""
|
||||
},
|
||||
"revision": "c1fd0c75afd4ccbc7f32465d50d3022eaa55e7b6",
|
||||
"revision": "4ea08e48f566bc02e4df1600ec1aeae413c1a1d7",
|
||||
"repo_path": "/integration/gaia-central"
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c71fd5d8c9c7cb021c97e5e9fbb29f92b50a084d"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4acd3e69b263b54f4111e3586ff4ade84b49b4da"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="6969df171e5295f855f12d12db0382048e6892e7"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c71fd5d8c9c7cb021c97e5e9fbb29f92b50a084d"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4acd3e69b263b54f4111e3586ff4ade84b49b4da"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="6969df171e5295f855f12d12db0382048e6892e7"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
|
@ -17,7 +17,7 @@
|
||||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="c71fd5d8c9c7cb021c97e5e9fbb29f92b50a084d"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="4acd3e69b263b54f4111e3586ff4ade84b49b4da"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="6969df171e5295f855f12d12db0382048e6892e7"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="facdb3593e63dcbb740709303a5b2527113c50a0"/>
|
||||
|
@ -17,7 +17,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="c71fd5d8c9c7cb021c97e5e9fbb29f92b50a084d"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4acd3e69b263b54f4111e3586ff4ade84b49b4da"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="6969df171e5295f855f12d12db0382048e6892e7"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
|
@ -1131,13 +1131,6 @@ pref("browser.zoom.updateBackgroundTabs", true);
|
||||
// The breakpad report server to link to in about:crashes
|
||||
pref("breakpad.reportURL", "https://crash-stats.mozilla.com/report/index/");
|
||||
|
||||
#ifndef RELEASE_BUILD
|
||||
// Override submission of plugin hang reports to a different processing server
|
||||
// for the smaller-volume nightly/aurora populations.
|
||||
pref("toolkit.crashreporter.pluginHangSubmitURL",
|
||||
"https://hang-reports.mozilla.org/submit");
|
||||
#endif
|
||||
|
||||
// URL for "Learn More" for Crash Reporter
|
||||
pref("toolkit.crashreporter.infoURL",
|
||||
"https://www.mozilla.org/legal/privacy/firefox.html#crash-reporter");
|
||||
|
@ -504,12 +504,21 @@ function HistoryMenu(aPopupShowingEvent) {
|
||||
}
|
||||
|
||||
HistoryMenu.prototype = {
|
||||
_getClosedTabCount() {
|
||||
// SessionStore doesn't track the hidden window, so just return zero then.
|
||||
if (window == Services.appShell.hiddenDOMWindow) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return SessionStore.getClosedTabCount(window);
|
||||
},
|
||||
|
||||
toggleRecentlyClosedTabs: function HM_toggleRecentlyClosedTabs() {
|
||||
// enable/disable the Recently Closed Tabs sub menu
|
||||
var undoMenu = this._rootElt.getElementsByClassName("recentlyClosedTabsMenu")[0];
|
||||
|
||||
// no restorable tabs, so disable menu
|
||||
if (SessionStore.getClosedTabCount(window) == 0)
|
||||
if (this._getClosedTabCount() == 0)
|
||||
undoMenu.setAttribute("disabled", true);
|
||||
else
|
||||
undoMenu.removeAttribute("disabled");
|
||||
@ -527,7 +536,7 @@ HistoryMenu.prototype = {
|
||||
undoPopup.removeChild(undoPopup.firstChild);
|
||||
|
||||
// no restorable tabs, so make sure menu is disabled, and return
|
||||
if (SessionStore.getClosedTabCount(window) == 0) {
|
||||
if (this._getClosedTabCount() == 0) {
|
||||
undoMenu.setAttribute("disabled", true);
|
||||
return;
|
||||
}
|
||||
|
@ -1520,7 +1520,9 @@ Toolbox.prototype = {
|
||||
this._telemetry.toolClosed("toolbox");
|
||||
this._telemetry.destroy();
|
||||
|
||||
this._destroyer = promise.all(outstanding).then(() => {
|
||||
// Finish all outstanding tasks (successfully or not) before destroying the
|
||||
// target.
|
||||
this._destroyer = promise.all(outstanding).then(null, console.error).then(() => {
|
||||
// Targets need to be notified that the toolbox is being torn down.
|
||||
// This is done after other destruction tasks since it may tear down
|
||||
// fronts and the debugger transport which earlier destroy methods may
|
||||
@ -1533,7 +1535,7 @@ Toolbox.prototype = {
|
||||
this.highlighterUtils.release();
|
||||
target.off("close", this.destroy);
|
||||
return target.destroy();
|
||||
}).then(() => {
|
||||
}, console.error).then(() => {
|
||||
this.emit("destroyed");
|
||||
|
||||
// We need to grab a reference to win before this._host is destroyed.
|
||||
|
@ -5639,7 +5639,7 @@ if test -n "${JAVA_BIN_PATH}" -o \
|
||||
AC_MSG_ERROR([The program keytool was not found. Set \$JAVA_HOME to your Java SDK directory or use --with-java-bin-path={java-bin-dir}])
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([for minimum required javac version = 1.7])
|
||||
AC_MSG_CHECKING([for minimum required javac version >= 1.7])
|
||||
|
||||
dnl Javac spits out something like `javac 1.7.0`. This line cuts off the 'javac'
|
||||
_javac_version=$($JAVAC -version 2>&1 | cut -d ' ' -f 2)
|
||||
@ -5653,8 +5653,8 @@ if test -n "${JAVA_BIN_PATH}" -o \
|
||||
|
||||
dnl Fail if we have a version other than 1.7.X
|
||||
if test "$_javac_major_version" -ne "1" -o \
|
||||
\( "$_javac_minor_version" -ne "7" \); then
|
||||
AC_MSG_ERROR([javac 1.7 is required.])
|
||||
\( "$_javac_minor_version" -lt "7" \); then
|
||||
AC_MSG_ERROR([javac 1.7 or higher is required.])
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -751,6 +751,7 @@ BluetoothOppManager::ComposePacket(uint8_t aOpCode, UnixSocketRawData* aMessage)
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(aMessage);
|
||||
|
||||
const uint8_t* data = aMessage->GetData();
|
||||
int frameHeaderLength = 0;
|
||||
|
||||
// See if this is the first part of each Put packet
|
||||
@ -759,8 +760,9 @@ BluetoothOppManager::ComposePacket(uint8_t aOpCode, UnixSocketRawData* aMessage)
|
||||
// [opcode:1][length:2][Headers:var]
|
||||
frameHeaderLength = 3;
|
||||
|
||||
mPacketLength = ((((int)aMessage->mData[1]) << 8) | aMessage->mData[2]) -
|
||||
frameHeaderLength;
|
||||
mPacketLength = ((static_cast<int>(data[1]) << 8) | data[2]) -
|
||||
frameHeaderLength;
|
||||
|
||||
/**
|
||||
* A PUT request from remote devices may be divided into multiple parts.
|
||||
* In other words, one request may need to be received multiple times,
|
||||
@ -771,7 +773,7 @@ BluetoothOppManager::ComposePacket(uint8_t aOpCode, UnixSocketRawData* aMessage)
|
||||
mPutFinalFlag = (aOpCode == ObexRequestCode::PutFinal);
|
||||
}
|
||||
|
||||
int dataLength = aMessage->mSize - frameHeaderLength;
|
||||
int dataLength = aMessage->GetSize() - frameHeaderLength;
|
||||
|
||||
// Check length before memcpy to prevent from memory pollution
|
||||
if (dataLength < 0 ||
|
||||
@ -786,7 +788,7 @@ BluetoothOppManager::ComposePacket(uint8_t aOpCode, UnixSocketRawData* aMessage)
|
||||
}
|
||||
|
||||
memcpy(mReceivedDataBuffer.get() + mPutPacketReceivedLength,
|
||||
&aMessage->mData[frameHeaderLength], dataLength);
|
||||
&data[frameHeaderLength], dataLength);
|
||||
|
||||
mPutPacketReceivedLength += dataLength;
|
||||
|
||||
@ -799,12 +801,13 @@ BluetoothOppManager::ServerDataHandler(UnixSocketRawData* aMessage)
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
uint8_t opCode;
|
||||
int receivedLength = aMessage->mSize;
|
||||
int receivedLength = aMessage->GetSize();
|
||||
const uint8_t* data = aMessage->GetData();
|
||||
|
||||
if (mPutPacketReceivedLength > 0) {
|
||||
opCode = mPutFinalFlag ? ObexRequestCode::PutFinal : ObexRequestCode::Put;
|
||||
} else {
|
||||
opCode = aMessage->mData[0];
|
||||
opCode = data[0];
|
||||
|
||||
// When there's a Put packet right after a PutFinal packet,
|
||||
// which means it's the start point of a new file.
|
||||
@ -821,7 +824,7 @@ BluetoothOppManager::ServerDataHandler(UnixSocketRawData* aMessage)
|
||||
// Section 3.3.1 "Connect", IrOBEX 1.2
|
||||
// [opcode:1][length:2][version:1][flags:1][MaxPktSizeWeCanReceive:2]
|
||||
// [Headers:var]
|
||||
if (!ParseHeaders(&aMessage->mData[7], receivedLength - 7, &pktHeaders)) {
|
||||
if (!ParseHeaders(&data[7], receivedLength - 7, &pktHeaders)) {
|
||||
ReplyError(ObexResponseCode::BadRequest);
|
||||
return;
|
||||
}
|
||||
@ -831,7 +834,7 @@ BluetoothOppManager::ServerDataHandler(UnixSocketRawData* aMessage)
|
||||
} else if (opCode == ObexRequestCode::Abort) {
|
||||
// Section 3.3.5 "Abort", IrOBEX 1.2
|
||||
// [opcode:1][length:2][Headers:var]
|
||||
if (!ParseHeaders(&aMessage->mData[3], receivedLength - 3, &pktHeaders)) {
|
||||
if (!ParseHeaders(&data[3], receivedLength - 3, &pktHeaders)) {
|
||||
ReplyError(ObexResponseCode::BadRequest);
|
||||
return;
|
||||
}
|
||||
@ -841,7 +844,7 @@ BluetoothOppManager::ServerDataHandler(UnixSocketRawData* aMessage)
|
||||
} else if (opCode == ObexRequestCode::Disconnect) {
|
||||
// Section 3.3.2 "Disconnect", IrOBEX 1.2
|
||||
// [opcode:1][length:2][Headers:var]
|
||||
if (!ParseHeaders(&aMessage->mData[3], receivedLength - 3, &pktHeaders)) {
|
||||
if (!ParseHeaders(&data[3], receivedLength - 3, &pktHeaders)) {
|
||||
ReplyError(ObexResponseCode::BadRequest);
|
||||
return;
|
||||
}
|
||||
@ -924,7 +927,8 @@ BluetoothOppManager::ClientDataHandler(UnixSocketRawData* aMessage)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
uint8_t opCode = aMessage->mData[0];
|
||||
const uint8_t* data = aMessage->GetData();
|
||||
uint8_t opCode = data[0];
|
||||
|
||||
// Check response code and send out system message as finished if the response
|
||||
// code is somehow incorrect.
|
||||
@ -981,10 +985,9 @@ BluetoothOppManager::ClientDataHandler(UnixSocketRawData* aMessage)
|
||||
AfterOppConnected();
|
||||
|
||||
// Keep remote information
|
||||
mRemoteObexVersion = aMessage->mData[3];
|
||||
mRemoteConnectionFlags = aMessage->mData[4];
|
||||
mRemoteMaxPacketLength =
|
||||
(((int)(aMessage->mData[5]) << 8) | aMessage->mData[6]);
|
||||
mRemoteObexVersion = data[3];
|
||||
mRemoteConnectionFlags = data[4];
|
||||
mRemoteMaxPacketLength = ((static_cast<int>(data[5]) << 8) | data[6]);
|
||||
|
||||
// The length of file name exceeds maximum length.
|
||||
int fileNameByteLen = (mFileName.Length() + 1) * 2;
|
||||
@ -1253,8 +1256,7 @@ BluetoothOppManager::SendObexData(uint8_t* aData, uint8_t aOpcode, int aSize)
|
||||
mLastCommand = aOpcode;
|
||||
}
|
||||
|
||||
UnixSocketRawData* s = new UnixSocketRawData(aSize);
|
||||
memcpy(s->mData, aData, s->mSize);
|
||||
UnixSocketRawData* s = new UnixSocketRawData(aData, aSize);
|
||||
mSocket->SendSocketData(s);
|
||||
}
|
||||
|
||||
|
@ -707,7 +707,8 @@ BluetoothHfpManager::ReceiveSocketData(BluetoothSocket* aSocket,
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(aSocket);
|
||||
|
||||
nsAutoCString msg((const char*)aMessage->mData.get(), aMessage->mSize);
|
||||
nsAutoCString msg(reinterpret_cast<const char*>(aMessage->GetData()),
|
||||
aMessage->GetSize());
|
||||
msg.StripWhitespace();
|
||||
|
||||
nsTArray<nsCString> atCommandValues;
|
||||
|
@ -774,6 +774,7 @@ BluetoothOppManager::ComposePacket(uint8_t aOpCode, UnixSocketRawData* aMessage)
|
||||
MOZ_ASSERT(aMessage);
|
||||
|
||||
int frameHeaderLength = 0;
|
||||
const uint8_t* data = aMessage->GetData();
|
||||
|
||||
// See if this is the first part of each Put packet
|
||||
if (mPutPacketReceivedLength == 0) {
|
||||
@ -781,8 +782,8 @@ BluetoothOppManager::ComposePacket(uint8_t aOpCode, UnixSocketRawData* aMessage)
|
||||
// [opcode:1][length:2][Headers:var]
|
||||
frameHeaderLength = 3;
|
||||
|
||||
mPacketLength = ((((int)aMessage->mData[1]) << 8) | aMessage->mData[2]) -
|
||||
frameHeaderLength;
|
||||
mPacketLength = ((static_cast<int>(data[1]) << 8) | data[2]) -
|
||||
frameHeaderLength;
|
||||
/**
|
||||
* A PUT request from remote devices may be divided into multiple parts.
|
||||
* In other words, one request may need to be received multiple times,
|
||||
@ -793,7 +794,7 @@ BluetoothOppManager::ComposePacket(uint8_t aOpCode, UnixSocketRawData* aMessage)
|
||||
mPutFinalFlag = (aOpCode == ObexRequestCode::PutFinal);
|
||||
}
|
||||
|
||||
int dataLength = aMessage->mSize - frameHeaderLength;
|
||||
int dataLength = aMessage->GetSize() - frameHeaderLength;
|
||||
|
||||
// Check length before memcpy to prevent from memory pollution
|
||||
if (dataLength < 0 ||
|
||||
@ -808,7 +809,7 @@ BluetoothOppManager::ComposePacket(uint8_t aOpCode, UnixSocketRawData* aMessage)
|
||||
}
|
||||
|
||||
memcpy(mReceivedDataBuffer.get() + mPutPacketReceivedLength,
|
||||
&aMessage->mData[frameHeaderLength], dataLength);
|
||||
&data[frameHeaderLength], dataLength);
|
||||
|
||||
mPutPacketReceivedLength += dataLength;
|
||||
|
||||
@ -821,12 +822,13 @@ BluetoothOppManager::ServerDataHandler(UnixSocketRawData* aMessage)
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
uint8_t opCode;
|
||||
int receivedLength = aMessage->mSize;
|
||||
int receivedLength = aMessage->GetSize();
|
||||
const uint8_t* data = aMessage->GetData();
|
||||
|
||||
if (mPutPacketReceivedLength > 0) {
|
||||
opCode = mPutFinalFlag ? ObexRequestCode::PutFinal : ObexRequestCode::Put;
|
||||
} else {
|
||||
opCode = aMessage->mData[0];
|
||||
opCode = data[0];
|
||||
|
||||
// When there's a Put packet right after a PutFinal packet,
|
||||
// which means it's the start point of a new file.
|
||||
@ -843,7 +845,7 @@ BluetoothOppManager::ServerDataHandler(UnixSocketRawData* aMessage)
|
||||
// Section 3.3.1 "Connect", IrOBEX 1.2
|
||||
// [opcode:1][length:2][version:1][flags:1][MaxPktSizeWeCanReceive:2]
|
||||
// [Headers:var]
|
||||
if (!ParseHeaders(&aMessage->mData[7], receivedLength - 7, &pktHeaders)) {
|
||||
if (!ParseHeaders(&data[7], receivedLength - 7, &pktHeaders)) {
|
||||
ReplyError(ObexResponseCode::BadRequest);
|
||||
return;
|
||||
}
|
||||
@ -853,7 +855,7 @@ BluetoothOppManager::ServerDataHandler(UnixSocketRawData* aMessage)
|
||||
} else if (opCode == ObexRequestCode::Abort) {
|
||||
// Section 3.3.5 "Abort", IrOBEX 1.2
|
||||
// [opcode:1][length:2][Headers:var]
|
||||
if (!ParseHeaders(&aMessage->mData[3], receivedLength - 3, &pktHeaders)) {
|
||||
if (!ParseHeaders(&data[3], receivedLength - 3, &pktHeaders)) {
|
||||
ReplyError(ObexResponseCode::BadRequest);
|
||||
return;
|
||||
}
|
||||
@ -863,7 +865,7 @@ BluetoothOppManager::ServerDataHandler(UnixSocketRawData* aMessage)
|
||||
} else if (opCode == ObexRequestCode::Disconnect) {
|
||||
// Section 3.3.2 "Disconnect", IrOBEX 1.2
|
||||
// [opcode:1][length:2][Headers:var]
|
||||
if (!ParseHeaders(&aMessage->mData[3], receivedLength - 3, &pktHeaders)) {
|
||||
if (!ParseHeaders(&data[3], receivedLength - 3, &pktHeaders)) {
|
||||
ReplyError(ObexResponseCode::BadRequest);
|
||||
return;
|
||||
}
|
||||
@ -946,7 +948,8 @@ BluetoothOppManager::ClientDataHandler(UnixSocketRawData* aMessage)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
uint8_t opCode = aMessage->mData[0];
|
||||
const uint8_t* data = aMessage->GetData();
|
||||
uint8_t opCode = data[0];
|
||||
|
||||
// Check response code and send out system message as finished if the response
|
||||
// code is somehow incorrect.
|
||||
@ -1003,10 +1006,9 @@ BluetoothOppManager::ClientDataHandler(UnixSocketRawData* aMessage)
|
||||
AfterOppConnected();
|
||||
|
||||
// Keep remote information
|
||||
mRemoteObexVersion = aMessage->mData[3];
|
||||
mRemoteConnectionFlags = aMessage->mData[4];
|
||||
mRemoteMaxPacketLength =
|
||||
(((int)(aMessage->mData[5]) << 8) | aMessage->mData[6]);
|
||||
mRemoteObexVersion = data[3];
|
||||
mRemoteConnectionFlags = data[4];
|
||||
mRemoteMaxPacketLength = (static_cast<int>(data[5]) << 8) | data[6];
|
||||
|
||||
// The length of file name exceeds maximum length.
|
||||
int fileNameByteLen = (mFileName.Length() + 1) * 2;
|
||||
@ -1274,8 +1276,7 @@ BluetoothOppManager::SendObexData(uint8_t* aData, uint8_t aOpcode, int aSize)
|
||||
mLastCommand = aOpcode;
|
||||
}
|
||||
|
||||
UnixSocketRawData* s = new UnixSocketRawData(aSize);
|
||||
memcpy(s->mData, aData, s->mSize);
|
||||
UnixSocketRawData* s = new UnixSocketRawData(aData, aSize);
|
||||
mSocket->SendSocketData(s);
|
||||
}
|
||||
|
||||
|
@ -751,6 +751,7 @@ BluetoothOppManager::ComposePacket(uint8_t aOpCode, UnixSocketRawData* aMessage)
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(aMessage);
|
||||
|
||||
const uint8_t* data = aMessage->GetData();
|
||||
int frameHeaderLength = 0;
|
||||
|
||||
// See if this is the first part of each Put packet
|
||||
@ -759,8 +760,9 @@ BluetoothOppManager::ComposePacket(uint8_t aOpCode, UnixSocketRawData* aMessage)
|
||||
// [opcode:1][length:2][Headers:var]
|
||||
frameHeaderLength = 3;
|
||||
|
||||
mPacketLength = ((((int)aMessage->mData[1]) << 8) | aMessage->mData[2]) -
|
||||
frameHeaderLength;
|
||||
mPacketLength = ((static_cast<int>(data[1]) << 8) | data[2]) -
|
||||
frameHeaderLength;
|
||||
|
||||
/**
|
||||
* A PUT request from remote devices may be divided into multiple parts.
|
||||
* In other words, one request may need to be received multiple times,
|
||||
@ -771,7 +773,7 @@ BluetoothOppManager::ComposePacket(uint8_t aOpCode, UnixSocketRawData* aMessage)
|
||||
mPutFinalFlag = (aOpCode == ObexRequestCode::PutFinal);
|
||||
}
|
||||
|
||||
int dataLength = aMessage->mSize - frameHeaderLength;
|
||||
int dataLength = aMessage->GetSize() - frameHeaderLength;
|
||||
|
||||
// Check length before memcpy to prevent from memory pollution
|
||||
if (dataLength < 0 ||
|
||||
@ -786,7 +788,7 @@ BluetoothOppManager::ComposePacket(uint8_t aOpCode, UnixSocketRawData* aMessage)
|
||||
}
|
||||
|
||||
memcpy(mReceivedDataBuffer.get() + mPutPacketReceivedLength,
|
||||
&aMessage->mData[frameHeaderLength], dataLength);
|
||||
&data[frameHeaderLength], dataLength);
|
||||
|
||||
mPutPacketReceivedLength += dataLength;
|
||||
|
||||
@ -799,12 +801,13 @@ BluetoothOppManager::ServerDataHandler(UnixSocketRawData* aMessage)
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
uint8_t opCode;
|
||||
int receivedLength = aMessage->mSize;
|
||||
int receivedLength = aMessage->GetSize();
|
||||
const uint8_t* data = aMessage->GetData();
|
||||
|
||||
if (mPutPacketReceivedLength > 0) {
|
||||
opCode = mPutFinalFlag ? ObexRequestCode::PutFinal : ObexRequestCode::Put;
|
||||
} else {
|
||||
opCode = aMessage->mData[0];
|
||||
opCode = data[0];
|
||||
|
||||
// When there's a Put packet right after a PutFinal packet,
|
||||
// which means it's the start point of a new file.
|
||||
@ -821,7 +824,7 @@ BluetoothOppManager::ServerDataHandler(UnixSocketRawData* aMessage)
|
||||
// Section 3.3.1 "Connect", IrOBEX 1.2
|
||||
// [opcode:1][length:2][version:1][flags:1][MaxPktSizeWeCanReceive:2]
|
||||
// [Headers:var]
|
||||
if (!ParseHeaders(&aMessage->mData[7], receivedLength - 7, &pktHeaders)) {
|
||||
if (!ParseHeaders(&data[7], receivedLength - 7, &pktHeaders)) {
|
||||
ReplyError(ObexResponseCode::BadRequest);
|
||||
return;
|
||||
}
|
||||
@ -831,7 +834,7 @@ BluetoothOppManager::ServerDataHandler(UnixSocketRawData* aMessage)
|
||||
} else if (opCode == ObexRequestCode::Abort) {
|
||||
// Section 3.3.5 "Abort", IrOBEX 1.2
|
||||
// [opcode:1][length:2][Headers:var]
|
||||
if (!ParseHeaders(&aMessage->mData[3], receivedLength - 3, &pktHeaders)) {
|
||||
if (!ParseHeaders(&data[3], receivedLength - 3, &pktHeaders)) {
|
||||
ReplyError(ObexResponseCode::BadRequest);
|
||||
return;
|
||||
}
|
||||
@ -841,7 +844,7 @@ BluetoothOppManager::ServerDataHandler(UnixSocketRawData* aMessage)
|
||||
} else if (opCode == ObexRequestCode::Disconnect) {
|
||||
// Section 3.3.2 "Disconnect", IrOBEX 1.2
|
||||
// [opcode:1][length:2][Headers:var]
|
||||
if (!ParseHeaders(&aMessage->mData[3], receivedLength - 3, &pktHeaders)) {
|
||||
if (!ParseHeaders(&data[3], receivedLength - 3, &pktHeaders)) {
|
||||
ReplyError(ObexResponseCode::BadRequest);
|
||||
return;
|
||||
}
|
||||
@ -924,7 +927,8 @@ BluetoothOppManager::ClientDataHandler(UnixSocketRawData* aMessage)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
uint8_t opCode = aMessage->mData[0];
|
||||
const uint8_t* data = aMessage->GetData();
|
||||
uint8_t opCode = data[0];
|
||||
|
||||
// Check response code and send out system message as finished if the response
|
||||
// code is somehow incorrect.
|
||||
@ -981,10 +985,9 @@ BluetoothOppManager::ClientDataHandler(UnixSocketRawData* aMessage)
|
||||
AfterOppConnected();
|
||||
|
||||
// Keep remote information
|
||||
mRemoteObexVersion = aMessage->mData[3];
|
||||
mRemoteConnectionFlags = aMessage->mData[4];
|
||||
mRemoteMaxPacketLength =
|
||||
(((int)(aMessage->mData[5]) << 8) | aMessage->mData[6]);
|
||||
mRemoteObexVersion = data[3];
|
||||
mRemoteConnectionFlags = data[4];
|
||||
mRemoteMaxPacketLength = ((static_cast<int>(data[5]) << 8) | data[6]);
|
||||
|
||||
// The length of file name exceeds maximum length.
|
||||
int fileNameByteLen = (mFileName.Length() + 1) * 2;
|
||||
@ -1253,8 +1256,7 @@ BluetoothOppManager::SendObexData(uint8_t* aData, uint8_t aOpcode, int aSize)
|
||||
mLastCommand = aOpcode;
|
||||
}
|
||||
|
||||
UnixSocketRawData* s = new UnixSocketRawData(aSize);
|
||||
memcpy(s->mData, aData, s->mSize);
|
||||
UnixSocketRawData* s = new UnixSocketRawData(aData, aSize);
|
||||
mSocket->SendSocketData(s);
|
||||
}
|
||||
|
||||
|
@ -707,7 +707,8 @@ BluetoothHfpManager::ReceiveSocketData(BluetoothSocket* aSocket,
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(aSocket);
|
||||
|
||||
nsAutoCString msg((const char*)aMessage->mData.get(), aMessage->mSize);
|
||||
nsAutoCString msg(reinterpret_cast<const char*>(aMessage->GetData()),
|
||||
aMessage->GetSize());
|
||||
msg.StripWhitespace();
|
||||
|
||||
nsTArray<nsCString> atCommandValues;
|
||||
|
@ -774,6 +774,7 @@ BluetoothOppManager::ComposePacket(uint8_t aOpCode, UnixSocketRawData* aMessage)
|
||||
MOZ_ASSERT(aMessage);
|
||||
|
||||
int frameHeaderLength = 0;
|
||||
const uint8_t* data = aMessage->GetData();
|
||||
|
||||
// See if this is the first part of each Put packet
|
||||
if (mPutPacketReceivedLength == 0) {
|
||||
@ -781,8 +782,8 @@ BluetoothOppManager::ComposePacket(uint8_t aOpCode, UnixSocketRawData* aMessage)
|
||||
// [opcode:1][length:2][Headers:var]
|
||||
frameHeaderLength = 3;
|
||||
|
||||
mPacketLength = ((((int)aMessage->mData[1]) << 8) | aMessage->mData[2]) -
|
||||
frameHeaderLength;
|
||||
mPacketLength = ((static_cast<int>(data[1]) << 8) | data[2]) -
|
||||
frameHeaderLength;
|
||||
/**
|
||||
* A PUT request from remote devices may be divided into multiple parts.
|
||||
* In other words, one request may need to be received multiple times,
|
||||
@ -793,7 +794,7 @@ BluetoothOppManager::ComposePacket(uint8_t aOpCode, UnixSocketRawData* aMessage)
|
||||
mPutFinalFlag = (aOpCode == ObexRequestCode::PutFinal);
|
||||
}
|
||||
|
||||
int dataLength = aMessage->mSize - frameHeaderLength;
|
||||
int dataLength = aMessage->GetSize() - frameHeaderLength;
|
||||
|
||||
// Check length before memcpy to prevent from memory pollution
|
||||
if (dataLength < 0 ||
|
||||
@ -808,7 +809,7 @@ BluetoothOppManager::ComposePacket(uint8_t aOpCode, UnixSocketRawData* aMessage)
|
||||
}
|
||||
|
||||
memcpy(mReceivedDataBuffer.get() + mPutPacketReceivedLength,
|
||||
&aMessage->mData[frameHeaderLength], dataLength);
|
||||
&data[frameHeaderLength], dataLength);
|
||||
|
||||
mPutPacketReceivedLength += dataLength;
|
||||
|
||||
@ -821,12 +822,13 @@ BluetoothOppManager::ServerDataHandler(UnixSocketRawData* aMessage)
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
uint8_t opCode;
|
||||
int receivedLength = aMessage->mSize;
|
||||
int receivedLength = aMessage->GetSize();
|
||||
const uint8_t* data = aMessage->GetData();
|
||||
|
||||
if (mPutPacketReceivedLength > 0) {
|
||||
opCode = mPutFinalFlag ? ObexRequestCode::PutFinal : ObexRequestCode::Put;
|
||||
} else {
|
||||
opCode = aMessage->mData[0];
|
||||
opCode = data[0];
|
||||
|
||||
// When there's a Put packet right after a PutFinal packet,
|
||||
// which means it's the start point of a new file.
|
||||
@ -843,7 +845,7 @@ BluetoothOppManager::ServerDataHandler(UnixSocketRawData* aMessage)
|
||||
// Section 3.3.1 "Connect", IrOBEX 1.2
|
||||
// [opcode:1][length:2][version:1][flags:1][MaxPktSizeWeCanReceive:2]
|
||||
// [Headers:var]
|
||||
if (!ParseHeaders(&aMessage->mData[7], receivedLength - 7, &pktHeaders)) {
|
||||
if (!ParseHeaders(&data[7], receivedLength - 7, &pktHeaders)) {
|
||||
ReplyError(ObexResponseCode::BadRequest);
|
||||
return;
|
||||
}
|
||||
@ -853,7 +855,7 @@ BluetoothOppManager::ServerDataHandler(UnixSocketRawData* aMessage)
|
||||
} else if (opCode == ObexRequestCode::Abort) {
|
||||
// Section 3.3.5 "Abort", IrOBEX 1.2
|
||||
// [opcode:1][length:2][Headers:var]
|
||||
if (!ParseHeaders(&aMessage->mData[3], receivedLength - 3, &pktHeaders)) {
|
||||
if (!ParseHeaders(&data[3], receivedLength - 3, &pktHeaders)) {
|
||||
ReplyError(ObexResponseCode::BadRequest);
|
||||
return;
|
||||
}
|
||||
@ -863,7 +865,7 @@ BluetoothOppManager::ServerDataHandler(UnixSocketRawData* aMessage)
|
||||
} else if (opCode == ObexRequestCode::Disconnect) {
|
||||
// Section 3.3.2 "Disconnect", IrOBEX 1.2
|
||||
// [opcode:1][length:2][Headers:var]
|
||||
if (!ParseHeaders(&aMessage->mData[3], receivedLength - 3, &pktHeaders)) {
|
||||
if (!ParseHeaders(&data[3], receivedLength - 3, &pktHeaders)) {
|
||||
ReplyError(ObexResponseCode::BadRequest);
|
||||
return;
|
||||
}
|
||||
@ -946,7 +948,8 @@ BluetoothOppManager::ClientDataHandler(UnixSocketRawData* aMessage)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
uint8_t opCode = aMessage->mData[0];
|
||||
const uint8_t* data = aMessage->GetData();
|
||||
uint8_t opCode = data[0];
|
||||
|
||||
// Check response code and send out system message as finished if the response
|
||||
// code is somehow incorrect.
|
||||
@ -1003,10 +1006,9 @@ BluetoothOppManager::ClientDataHandler(UnixSocketRawData* aMessage)
|
||||
AfterOppConnected();
|
||||
|
||||
// Keep remote information
|
||||
mRemoteObexVersion = aMessage->mData[3];
|
||||
mRemoteConnectionFlags = aMessage->mData[4];
|
||||
mRemoteMaxPacketLength =
|
||||
(((int)(aMessage->mData[5]) << 8) | aMessage->mData[6]);
|
||||
mRemoteObexVersion = data[3];
|
||||
mRemoteConnectionFlags = data[4];
|
||||
mRemoteMaxPacketLength = (static_cast<int>(data[5]) << 8) | data[6];
|
||||
|
||||
// The length of file name exceeds maximum length.
|
||||
int fileNameByteLen = (mFileName.Length() + 1) * 2;
|
||||
@ -1274,8 +1276,7 @@ BluetoothOppManager::SendObexData(uint8_t* aData, uint8_t aOpcode, int aSize)
|
||||
mLastCommand = aOpcode;
|
||||
}
|
||||
|
||||
UnixSocketRawData* s = new UnixSocketRawData(aSize);
|
||||
memcpy(s->mData, aData, s->mSize);
|
||||
UnixSocketRawData* s = new UnixSocketRawData(aData, aSize);
|
||||
mSocket->SendSocketData(s);
|
||||
}
|
||||
|
||||
|
@ -24,8 +24,7 @@ const NET_NETWORKSTATSSERVICE_CID = Components.ID("{18725604-e9ac-488a-8aa0-2471
|
||||
|
||||
const TOPIC_BANDWIDTH_CONTROL = "netd-bandwidth-control"
|
||||
|
||||
const TOPIC_INTERFACE_REGISTERED = "network-interface-registered";
|
||||
const TOPIC_INTERFACE_UNREGISTERED = "network-interface-unregistered";
|
||||
const TOPIC_CONNECTION_STATE_CHANGED = "network-connection-state-changed";
|
||||
const NET_TYPE_WIFI = Ci.nsINetworkInterface.NETWORK_TYPE_WIFI;
|
||||
const NET_TYPE_MOBILE = Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE;
|
||||
|
||||
@ -74,8 +73,7 @@ this.NetworkStatsService = {
|
||||
debug("Service started");
|
||||
|
||||
Services.obs.addObserver(this, "xpcom-shutdown", false);
|
||||
Services.obs.addObserver(this, TOPIC_INTERFACE_REGISTERED, false);
|
||||
Services.obs.addObserver(this, TOPIC_INTERFACE_UNREGISTERED, false);
|
||||
Services.obs.addObserver(this, TOPIC_CONNECTION_STATE_CHANGED, false);
|
||||
Services.obs.addObserver(this, TOPIC_BANDWIDTH_CONTROL, false);
|
||||
Services.obs.addObserver(this, "profile-after-change", false);
|
||||
|
||||
@ -183,8 +181,7 @@ this.NetworkStatsService = {
|
||||
|
||||
observe: function observe(aSubject, aTopic, aData) {
|
||||
switch (aTopic) {
|
||||
case TOPIC_INTERFACE_REGISTERED:
|
||||
case TOPIC_INTERFACE_UNREGISTERED:
|
||||
case TOPIC_CONNECTION_STATE_CHANGED:
|
||||
|
||||
// If new interface is registered (notified from NetworkService),
|
||||
// the stats are updated for the new interface without waiting to
|
||||
@ -228,8 +225,7 @@ this.NetworkStatsService = {
|
||||
|
||||
Services.obs.removeObserver(this, "xpcom-shutdown");
|
||||
Services.obs.removeObserver(this, "profile-after-change");
|
||||
Services.obs.removeObserver(this, TOPIC_INTERFACE_REGISTERED);
|
||||
Services.obs.removeObserver(this, TOPIC_INTERFACE_UNREGISTERED);
|
||||
Services.obs.removeObserver(this, TOPIC_CONNECTION_STATE_CHANGED);
|
||||
Services.obs.removeObserver(this, TOPIC_BANDWIDTH_CONTROL);
|
||||
|
||||
this.timer.cancel();
|
||||
|
@ -199,26 +199,22 @@ public:
|
||||
{
|
||||
assertIsNfcServiceThread();
|
||||
|
||||
size_t size = mData->mSize;
|
||||
size_t offset = 0;
|
||||
|
||||
while (size > 0) {
|
||||
while (mData->GetSize()) {
|
||||
EventOptions event;
|
||||
const uint8_t* data = mData->mData.get();
|
||||
uint32_t parcelSize = ((data[offset + 0] & 0xff) << 24) |
|
||||
((data[offset + 1] & 0xff) << 16) |
|
||||
((data[offset + 2] & 0xff) << 8) |
|
||||
(data[offset + 3] & 0xff);
|
||||
MOZ_ASSERT(parcelSize <= (mData->mSize - offset));
|
||||
const uint8_t* data = mData->GetData();
|
||||
uint32_t parcelSize = ((data[0] & 0xff) << 24) |
|
||||
((data[1] & 0xff) << 16) |
|
||||
((data[2] & 0xff) << 8) |
|
||||
(data[3] & 0xff);
|
||||
MOZ_ASSERT(parcelSize <= mData->GetSize());
|
||||
|
||||
Parcel parcel;
|
||||
parcel.setData(&data[offset], parcelSize + sizeof(int));
|
||||
parcel.setData(mData->GetData(), parcelSize + sizeof(parcelSize));
|
||||
mHandler->Unmarshall(parcel, event);
|
||||
nsCOMPtr<nsIRunnable> runnable = new NfcEventDispatcher(event);
|
||||
NS_DispatchToMainThread(runnable);
|
||||
|
||||
size -= parcel.dataSize();
|
||||
offset += parcel.dataSize();
|
||||
mData->Consume(parcelSize + sizeof(parcelSize));
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -30,14 +30,7 @@ const Ci = Components.interfaces;
|
||||
const crashReporter = Cc["@mozilla.org/toolkit/crash-reporter;1"].getService(Ci.nsICrashReporter);
|
||||
const SERVER_URL = "http://example.com/browser/toolkit/crashreporter/test/browser/crashreport.sjs";
|
||||
|
||||
const serverPrefName = "toolkit.crashreporter.pluginHangSubmitURL";
|
||||
|
||||
var oldServerPref;
|
||||
try {
|
||||
oldServerPref = Services.prefs.getCharPref(serverPrefName);
|
||||
}
|
||||
catch(e) {
|
||||
}
|
||||
var oldServerURL = crashReporter.serverURL;
|
||||
|
||||
const oldTimeoutPref = Services.prefs.getIntPref("dom.ipc.plugins.timeoutSecs");
|
||||
|
||||
@ -90,12 +83,7 @@ var testObserver = {
|
||||
env.set("MOZ_CRASHREPORTER_NO_REPORT", "1");
|
||||
|
||||
// Finally re-set prefs
|
||||
if (oldServerPref === undefined) {
|
||||
Services.prefs.clearUserPref(serverPrefName);
|
||||
}
|
||||
else {
|
||||
Services.prefs.setCharPref(serverPrefName, oldServerPref);
|
||||
}
|
||||
crashReporter.serverURL = oldServerURL;
|
||||
Services.prefs.setIntPref("dom.ipc.plugins.timeoutSecs", oldTimeoutPref);
|
||||
|
||||
// Check and cleanup CrashManager.
|
||||
@ -159,7 +147,7 @@ function runTests() {
|
||||
env.set("MOZ_CRASHREPORTER_NO_REPORT", "");
|
||||
|
||||
// Override the crash reporter URL to send to our fake server
|
||||
Services.prefs.setCharPref("toolkit.crashreporter.pluginHangSubmitURL", SERVER_URL);
|
||||
crashReporter.serverURL = NetUtil.newURI(SERVER_URL);
|
||||
|
||||
// Hook into plugin crash events
|
||||
Services.obs.addObserver(testObserver, "crash-report-status", true);
|
||||
|
@ -400,8 +400,7 @@ KeyStore::ResetHandlerInfo()
|
||||
bool
|
||||
KeyStore::CheckSize(UnixSocketRawData *aMessage, size_t aExpectSize)
|
||||
{
|
||||
return (aMessage->mSize - aMessage->mCurrentWriteOffset >= aExpectSize) ?
|
||||
true : false;
|
||||
return (aMessage->GetSize() >= aExpectSize);
|
||||
}
|
||||
|
||||
ResponseCode
|
||||
@ -417,8 +416,8 @@ KeyStore::ReadCommand(UnixSocketRawData *aMessage)
|
||||
return PROTOCOL_ERROR;
|
||||
}
|
||||
|
||||
mHandlerInfo.command = aMessage->mData[aMessage->mCurrentWriteOffset];
|
||||
aMessage->mCurrentWriteOffset++;
|
||||
mHandlerInfo.command = *aMessage->GetData();
|
||||
aMessage->Consume(1);
|
||||
|
||||
// Find corrsponding command pattern
|
||||
const struct ProtocolCommand *command = commands;
|
||||
@ -457,9 +456,10 @@ KeyStore::ReadLength(UnixSocketRawData *aMessage)
|
||||
}
|
||||
|
||||
// Read length of command parameter.
|
||||
// FIXME: Depends on endianess and (sizeof(unsigned short) == 2)
|
||||
unsigned short dataLength;
|
||||
memcpy(&dataLength, &aMessage->mData[aMessage->mCurrentWriteOffset], 2);
|
||||
aMessage->mCurrentWriteOffset += 2;
|
||||
memcpy(&dataLength, aMessage->GetData(), 2);
|
||||
aMessage->Consume(2);
|
||||
mHandlerInfo.param[mHandlerInfo.paramCount].length = ntohs(dataLength);
|
||||
|
||||
mHandlerInfo.state = STATE_READ_PARAM_DATA;
|
||||
@ -482,9 +482,9 @@ KeyStore::ReadData(UnixSocketRawData *aMessage)
|
||||
|
||||
// Read command parameter.
|
||||
memcpy(mHandlerInfo.param[mHandlerInfo.paramCount].data,
|
||||
&aMessage->mData[aMessage->mCurrentWriteOffset],
|
||||
aMessage->GetData(),
|
||||
mHandlerInfo.param[mHandlerInfo.paramCount].length);
|
||||
aMessage->mCurrentWriteOffset += mHandlerInfo.param[mHandlerInfo.paramCount].length;
|
||||
aMessage->Consume(mHandlerInfo.param[mHandlerInfo.paramCount].length);
|
||||
mHandlerInfo.paramCount++;
|
||||
|
||||
if (mHandlerInfo.paramCount == mHandlerInfo.commandPattern->paramNum) {
|
||||
@ -528,7 +528,7 @@ KeyStore::ReceiveSocketData(nsAutoPtr<UnixSocketRawData>& aMessage)
|
||||
|
||||
// Handle request.
|
||||
ResponseCode result = SUCCESS;
|
||||
while (aMessage->mCurrentWriteOffset < aMessage->mSize ||
|
||||
while (aMessage->GetSize() ||
|
||||
mHandlerInfo.state == STATE_PROCESSING) {
|
||||
switch (mHandlerInfo.state) {
|
||||
case STATE_IDLE:
|
||||
|
@ -184,11 +184,13 @@ DispatchRILEvent::RunTask(JSContext *aCx)
|
||||
{
|
||||
JS::Rooted<JSObject*> obj(aCx, JS::CurrentGlobalOrNull(aCx));
|
||||
|
||||
JS::Rooted<JSObject*> array(aCx, JS_NewUint8Array(aCx, mMessage->mSize));
|
||||
JS::Rooted<JSObject*> array(aCx,
|
||||
JS_NewUint8Array(aCx, mMessage->GetSize()));
|
||||
if (!array) {
|
||||
return false;
|
||||
}
|
||||
memcpy(JS_GetArrayBufferViewData(array), mMessage->mData, mMessage->mSize);
|
||||
memcpy(JS_GetArrayBufferViewData(array),
|
||||
mMessage->GetData(), mMessage->GetSize());
|
||||
|
||||
JS::AutoValueArray<2> args(aCx);
|
||||
args[0].setNumber((uint32_t)mClientId);
|
||||
|
@ -7,8 +7,9 @@
|
||||
*/
|
||||
|
||||
#include "SocketBase.h"
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include "nsThreadUtils.h"
|
||||
#include <unistd.h>
|
||||
|
||||
namespace mozilla {
|
||||
namespace ipc {
|
||||
@ -17,23 +18,81 @@ namespace ipc {
|
||||
// UnixSocketRawData
|
||||
//
|
||||
|
||||
UnixSocketRawData::UnixSocketRawData(size_t aSize)
|
||||
: mSize(aSize)
|
||||
, mCurrentWriteOffset(0)
|
||||
{
|
||||
mData = new uint8_t[mSize];
|
||||
}
|
||||
|
||||
UnixSocketRawData::UnixSocketRawData(const void* aData, size_t aSize)
|
||||
: mSize(aSize)
|
||||
, mCurrentWriteOffset(0)
|
||||
, mOffset(0)
|
||||
, mAvailableSpace(aSize)
|
||||
{
|
||||
MOZ_ASSERT(aData || !mSize);
|
||||
|
||||
mData = new uint8_t[mSize];
|
||||
mData = new uint8_t[mAvailableSpace];
|
||||
memcpy(mData, aData, mSize);
|
||||
}
|
||||
|
||||
UnixSocketRawData::UnixSocketRawData(size_t aSize)
|
||||
: mSize(0)
|
||||
, mOffset(0)
|
||||
, mAvailableSpace(aSize)
|
||||
{
|
||||
mData = new uint8_t[mAvailableSpace];
|
||||
}
|
||||
|
||||
ssize_t
|
||||
UnixSocketRawData::Receive(int aFd)
|
||||
{
|
||||
if (!GetTrailingSpace()) {
|
||||
if (!GetLeadingSpace()) {
|
||||
return -1; /* buffer is full */
|
||||
}
|
||||
/* free up space at the end of data buffer */
|
||||
if (GetSize() <= GetLeadingSpace()) {
|
||||
memcpy(mData, GetData(), GetSize());
|
||||
} else {
|
||||
memmove(mData, GetData(), GetSize());
|
||||
}
|
||||
mOffset = 0;
|
||||
}
|
||||
|
||||
ssize_t res =
|
||||
TEMP_FAILURE_RETRY(read(aFd, GetTrailingBytes(), GetTrailingSpace()));
|
||||
|
||||
if (res < 0) {
|
||||
/* I/O error */
|
||||
return -1;
|
||||
} else if (!res) {
|
||||
/* EOF or peer shutdown sending */
|
||||
return 0;
|
||||
}
|
||||
|
||||
mSize += res;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
ssize_t
|
||||
UnixSocketRawData::Send(int aFd)
|
||||
{
|
||||
if (!GetSize()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
ssize_t res = TEMP_FAILURE_RETRY(write(aFd, GetData(), GetSize()));
|
||||
|
||||
if (res < 0) {
|
||||
if (errno == EAGAIN || errno == EWOULDBLOCK) {
|
||||
return 0; /* socket is blocked; try again later */
|
||||
}
|
||||
return -1;
|
||||
} else if (!res) {
|
||||
/* nothing written */
|
||||
return 0;
|
||||
}
|
||||
|
||||
Consume(res);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
//
|
||||
// SocketConsumerBase
|
||||
//
|
||||
@ -134,7 +193,7 @@ SocketIOBase::~SocketIOBase()
|
||||
void
|
||||
SocketIOBase::EnqueueData(UnixSocketRawData* aData)
|
||||
{
|
||||
if (!aData->mSize) {
|
||||
if (!aData->GetSize()) {
|
||||
delete aData; // delete empty data immediately
|
||||
return;
|
||||
}
|
||||
|
@ -9,8 +9,6 @@
|
||||
#ifndef mozilla_ipc_SocketBase_h
|
||||
#define mozilla_ipc_SocketBase_h
|
||||
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include "base/message_loop.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsTArray.h"
|
||||
@ -31,22 +29,73 @@ namespace ipc {
|
||||
class UnixSocketRawData
|
||||
{
|
||||
public:
|
||||
// Number of octets in mData.
|
||||
size_t mSize;
|
||||
size_t mCurrentWriteOffset;
|
||||
nsAutoArrayPtr<uint8_t> mData;
|
||||
/* This constructor copies aData of aSize bytes length into the
|
||||
* new instance of |UnixSocketRawData|.
|
||||
*/
|
||||
UnixSocketRawData(const void* aData, size_t aSize);
|
||||
|
||||
/**
|
||||
* Constructor for situations where only size is known beforehand
|
||||
* (for example, when being assigned strings)
|
||||
/* This constructor reserves aSize bytes of space. Currently
|
||||
* it's only possible to fill this buffer by calling |Receive|.
|
||||
*/
|
||||
UnixSocketRawData(size_t aSize);
|
||||
|
||||
/**
|
||||
* Constructor for situations where size and data is known
|
||||
* beforehand (for example, when being assigned strings)
|
||||
* Receives data from aFd at the end of the buffer. The returned value
|
||||
* is the number of newly received bytes, or 0 if the peer shut down
|
||||
* its connection, or a negative value on errors.
|
||||
*/
|
||||
UnixSocketRawData(const void* aData, size_t aSize);
|
||||
ssize_t Receive(int aFd);
|
||||
|
||||
/**
|
||||
* Sends data to aFd from the beginning of the buffer. The returned value
|
||||
* is the number of bytes written, or a negative value on error.
|
||||
*/
|
||||
ssize_t Send(int aFd);
|
||||
|
||||
const uint8_t* GetData() const
|
||||
{
|
||||
return mData + mOffset;
|
||||
}
|
||||
|
||||
size_t GetSize() const
|
||||
{
|
||||
return mSize;
|
||||
}
|
||||
|
||||
void Consume(size_t aSize)
|
||||
{
|
||||
MOZ_ASSERT(aSize <= mSize);
|
||||
|
||||
mSize -= aSize;
|
||||
mOffset += aSize;
|
||||
}
|
||||
|
||||
protected:
|
||||
size_t GetLeadingSpace() const
|
||||
{
|
||||
return mOffset;
|
||||
}
|
||||
|
||||
size_t GetTrailingSpace() const
|
||||
{
|
||||
return mAvailableSpace - (mOffset + mSize);
|
||||
}
|
||||
|
||||
size_t GetAvailableSpace() const
|
||||
{
|
||||
return mAvailableSpace;
|
||||
}
|
||||
|
||||
void* GetTrailingBytes()
|
||||
{
|
||||
return mData + mOffset + mSize;
|
||||
}
|
||||
|
||||
private:
|
||||
size_t mSize;
|
||||
size_t mOffset;
|
||||
size_t mAvailableSpace;
|
||||
nsAutoArrayPtr<uint8_t> mData;
|
||||
};
|
||||
|
||||
enum SocketConnectionStatus {
|
||||
@ -331,9 +380,7 @@ public:
|
||||
nsAutoPtr<UnixSocketRawData> incoming(
|
||||
new UnixSocketRawData(mMaxReadSize));
|
||||
|
||||
ssize_t res =
|
||||
TEMP_FAILURE_RETRY(read(aFd, incoming->mData, incoming->mSize));
|
||||
|
||||
ssize_t res = incoming->Receive(aFd);
|
||||
if (res < 0) {
|
||||
/* an I/O error occured */
|
||||
nsRefPtr<nsRunnable> r = new SocketIORequestClosingRunnable<T>(aIO);
|
||||
@ -346,8 +393,6 @@ public:
|
||||
return 0;
|
||||
}
|
||||
|
||||
incoming->mSize = res;
|
||||
|
||||
#ifdef MOZ_TASK_TRACER
|
||||
// Make unix socket creation events to be the source events of TaskTracer,
|
||||
// and originate the rest correlation tasks from here.
|
||||
@ -367,38 +412,24 @@ public:
|
||||
MOZ_ASSERT(aFd >= 0);
|
||||
MOZ_ASSERT(aIO);
|
||||
|
||||
do {
|
||||
if (!HasPendingData()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
while (HasPendingData()) {
|
||||
UnixSocketRawData* outgoing = mOutgoingQ.ElementAt(0);
|
||||
MOZ_ASSERT(outgoing->mSize);
|
||||
|
||||
const uint8_t* data = outgoing->mData + outgoing->mCurrentWriteOffset;
|
||||
size_t size = outgoing->mSize - outgoing->mCurrentWriteOffset;
|
||||
|
||||
ssize_t res = TEMP_FAILURE_RETRY(write(aFd, data, size));
|
||||
|
||||
ssize_t res = outgoing->Send(aFd);
|
||||
if (res < 0) {
|
||||
if (errno == EAGAIN || errno == EWOULDBLOCK) {
|
||||
return NS_OK; /* no more data available */
|
||||
}
|
||||
/* an error occored */
|
||||
/* an I/O error occured */
|
||||
nsRefPtr<nsRunnable> r = new SocketIORequestClosingRunnable<T>(aIO);
|
||||
NS_DispatchToMainThread(r);
|
||||
return NS_ERROR_FAILURE;
|
||||
} else if (!res) {
|
||||
return NS_OK; /* nothing written */
|
||||
} else if (!res && outgoing->GetSize()) {
|
||||
/* I/O is currently blocked; try again later */
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
outgoing->mCurrentWriteOffset += res;
|
||||
|
||||
if (outgoing->mCurrentWriteOffset == outgoing->mSize) {
|
||||
if (!outgoing->GetSize()) {
|
||||
mOutgoingQ.RemoveElementAt(0);
|
||||
delete outgoing;
|
||||
}
|
||||
} while (true);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -470,7 +470,7 @@ public class BrowserApp extends GeckoApp
|
||||
(new UIAsyncTask.WithoutParams<String>(ThreadUtils.getBackgroundHandler()) {
|
||||
@Override
|
||||
public String doInBackground() {
|
||||
return Favicons.getFaviconURLForPageURL(url);
|
||||
return Favicons.getFaviconURLForPageURL(getContext(), url);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -942,11 +942,13 @@ public class BrowserApp extends GeckoApp
|
||||
}
|
||||
|
||||
final OnFaviconLoadedListener listener = new GeckoAppShell.CreateShortcutFaviconLoadedListener(url, title);
|
||||
Favicons.getSizedFavicon(url,
|
||||
tab.getFaviconURL(),
|
||||
Integer.MAX_VALUE,
|
||||
LoadFaviconTask.FLAG_PERSIST,
|
||||
listener);
|
||||
Favicons.getSizedFavicon(getContext(),
|
||||
url,
|
||||
tab.getFaviconURL(),
|
||||
Integer.MAX_VALUE,
|
||||
LoadFaviconTask.FLAG_PERSIST,
|
||||
listener);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1743,7 +1745,7 @@ public class BrowserApp extends GeckoApp
|
||||
final int tabFaviconSize = getResources().getDimensionPixelSize(R.dimen.browser_toolbar_favicon_size);
|
||||
|
||||
int flags = (tab.isPrivate() || tab.getErrorType() != Tab.ErrorType.NONE) ? 0 : LoadFaviconTask.FLAG_PERSIST;
|
||||
int id = Favicons.getSizedFavicon(tab.getURL(), tab.getFaviconURL(), tabFaviconSize, flags, sFaviconLoadedListener);
|
||||
int id = Favicons.getSizedFavicon(getContext(), tab.getURL(), tab.getFaviconURL(), tabFaviconSize, flags, sFaviconLoadedListener);
|
||||
|
||||
tab.setFaviconLoadId(id);
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ import org.mozilla.gecko.mozglue.GeckoLoader;
|
||||
import org.mozilla.gecko.preferences.ClearOnShutdownPref;
|
||||
import org.mozilla.gecko.preferences.GeckoPreferences;
|
||||
import org.mozilla.gecko.prompts.PromptService;
|
||||
import org.mozilla.gecko.SmsManager;
|
||||
import org.mozilla.gecko.updater.UpdateService;
|
||||
import org.mozilla.gecko.updater.UpdateServiceHelper;
|
||||
import org.mozilla.gecko.util.ActivityResultHandler;
|
||||
@ -1190,7 +1191,7 @@ public abstract class GeckoApp
|
||||
|
||||
Tabs.getInstance().attachToContext(this);
|
||||
try {
|
||||
Favicons.attachToContext(this);
|
||||
Favicons.initializeWithContext(this);
|
||||
} catch (Exception e) {
|
||||
Log.e(LOGTAG, "Exception starting favicon cache. Corrupt resources?", e);
|
||||
}
|
||||
@ -1544,9 +1545,8 @@ public abstract class GeckoApp
|
||||
mWebappEventListener.registerEvents();
|
||||
}
|
||||
|
||||
|
||||
if (SmsManager.getInstance() != null) {
|
||||
SmsManager.getInstance().start();
|
||||
if (SmsManager.isEnabled()) {
|
||||
SmsManager.getInstance().start();
|
||||
}
|
||||
|
||||
mContactService = new ContactService(EventDispatcher.getInstance(), this);
|
||||
@ -2079,10 +2079,11 @@ public abstract class GeckoApp
|
||||
IntentHelper.destroy();
|
||||
GeckoNetworkManager.destroy();
|
||||
|
||||
if (SmsManager.getInstance() != null) {
|
||||
if (SmsManager.isEnabled()) {
|
||||
SmsManager.getInstance().stop();
|
||||
if (isFinishing())
|
||||
if (isFinishing()) {
|
||||
SmsManager.getInstance().shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
final HealthRecorder rec = mHealthRecorder;
|
||||
|
@ -48,6 +48,7 @@ import org.mozilla.gecko.mozglue.RobocopTarget;
|
||||
import org.mozilla.gecko.mozglue.generatorannotations.OptionalGeneratedParameter;
|
||||
import org.mozilla.gecko.mozglue.generatorannotations.WrapElementForJNI;
|
||||
import org.mozilla.gecko.prompts.PromptService;
|
||||
import org.mozilla.gecko.SmsManager;
|
||||
import org.mozilla.gecko.util.EventCallback;
|
||||
import org.mozilla.gecko.util.GeckoRequest;
|
||||
import org.mozilla.gecko.util.HardwareUtils;
|
||||
@ -2352,7 +2353,7 @@ public class GeckoAppShell
|
||||
*/
|
||||
@WrapElementForJNI(stubName = "SendMessageWrapper")
|
||||
public static void sendMessage(String aNumber, String aMessage, int aRequestId) {
|
||||
if (SmsManager.getInstance() == null) {
|
||||
if (!SmsManager.isEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2361,7 +2362,7 @@ public class GeckoAppShell
|
||||
|
||||
@WrapElementForJNI(stubName = "GetMessageWrapper")
|
||||
public static void getMessage(int aMessageId, int aRequestId) {
|
||||
if (SmsManager.getInstance() == null) {
|
||||
if (!SmsManager.isEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2370,7 +2371,7 @@ public class GeckoAppShell
|
||||
|
||||
@WrapElementForJNI(stubName = "DeleteMessageWrapper")
|
||||
public static void deleteMessage(int aMessageId, int aRequestId) {
|
||||
if (SmsManager.getInstance() == null) {
|
||||
if (!SmsManager.isEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2379,7 +2380,7 @@ public class GeckoAppShell
|
||||
|
||||
@WrapElementForJNI(stubName = "CreateMessageListWrapper")
|
||||
public static void createMessageList(long aStartDate, long aEndDate, String[] aNumbers, int aNumbersCount, String aDelivery, boolean aHasRead, boolean aRead, long aThreadId, boolean aReverse, int aRequestId) {
|
||||
if (SmsManager.getInstance() == null) {
|
||||
if (!SmsManager.isEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2388,7 +2389,7 @@ public class GeckoAppShell
|
||||
|
||||
@WrapElementForJNI(stubName = "GetNextMessageInListWrapper")
|
||||
public static void getNextMessageInList(int aListId, int aRequestId) {
|
||||
if (SmsManager.getInstance() == null) {
|
||||
if (!SmsManager.isEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2397,7 +2398,7 @@ public class GeckoAppShell
|
||||
|
||||
@WrapElementForJNI
|
||||
public static void clearMessageList(int aListId) {
|
||||
if (SmsManager.getInstance() == null) {
|
||||
if (!SmsManager.isEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
package org.mozilla.gecko;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
@ -37,39 +38,6 @@ import android.util.Log;
|
||||
import android.view.KeyCharacterMap;
|
||||
import android.view.KeyEvent;
|
||||
|
||||
// interface for the IC thread
|
||||
interface GeckoEditableClient {
|
||||
void sendEvent(GeckoEvent event);
|
||||
Editable getEditable();
|
||||
void setUpdateGecko(boolean update);
|
||||
void setSuppressKeyUp(boolean suppress);
|
||||
Handler getInputConnectionHandler();
|
||||
boolean setInputConnectionHandler(Handler handler);
|
||||
}
|
||||
|
||||
/* interface for the Editable to listen to the Gecko thread
|
||||
and also for the IC thread to listen to the Editable */
|
||||
interface GeckoEditableListener {
|
||||
// IME notification type for notifyIME(), corresponding to NotificationToIME enum in Gecko
|
||||
final int NOTIFY_IME_OPEN_VKB = -2;
|
||||
final int NOTIFY_IME_REPLY_EVENT = -1;
|
||||
final int NOTIFY_IME_OF_FOCUS = 1;
|
||||
final int NOTIFY_IME_OF_BLUR = 2;
|
||||
final int NOTIFY_IME_TO_COMMIT_COMPOSITION = 8;
|
||||
final int NOTIFY_IME_TO_CANCEL_COMPOSITION = 9;
|
||||
// IME enabled state for notifyIMEContext()
|
||||
final int IME_STATE_DISABLED = 0;
|
||||
final int IME_STATE_ENABLED = 1;
|
||||
final int IME_STATE_PASSWORD = 2;
|
||||
final int IME_STATE_PLUGIN = 3;
|
||||
|
||||
void notifyIME(int type);
|
||||
void notifyIMEContext(int state, String typeHint,
|
||||
String modeHint, String actionHint);
|
||||
void onSelectionChange(int start, int end);
|
||||
void onTextChange(CharSequence text, int start, int oldEnd, int newEnd);
|
||||
}
|
||||
|
||||
/*
|
||||
GeckoEditable implements only some functions of Editable
|
||||
The field mText contains the actual underlying
|
||||
@ -1004,12 +972,12 @@ final class GeckoEditable
|
||||
} else if (Proxy.isProxyClass(obj.getClass())) {
|
||||
debugAppend(sb, Proxy.getInvocationHandler(obj));
|
||||
} else if (obj instanceof CharSequence) {
|
||||
sb.append("\"").append(obj.toString().replace('\n', '\u21b2')).append("\"");
|
||||
sb.append('"').append(obj.toString().replace('\n', '\u21b2')).append('"');
|
||||
} else if (obj.getClass().isArray()) {
|
||||
sb.append(obj.getClass().getComponentType().getSimpleName()).append("[")
|
||||
.append(java.lang.reflect.Array.getLength(obj)).append("]");
|
||||
sb.append(obj.getClass().getComponentType().getSimpleName()).append('[')
|
||||
.append(Array.getLength(obj)).append(']');
|
||||
} else {
|
||||
sb.append(obj.toString());
|
||||
sb.append(obj);
|
||||
}
|
||||
return sb;
|
||||
}
|
||||
|
21
mobile/android/base/GeckoEditableClient.java
Normal file
21
mobile/android/base/GeckoEditableClient.java
Normal file
@ -0,0 +1,21 @@
|
||||
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*-
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
package org.mozilla.gecko;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.text.Editable;
|
||||
|
||||
/**
|
||||
* Interface for the IC thread.
|
||||
*/
|
||||
interface GeckoEditableClient {
|
||||
void sendEvent(GeckoEvent event);
|
||||
Editable getEditable();
|
||||
void setUpdateGecko(boolean update);
|
||||
void setSuppressKeyUp(boolean suppress);
|
||||
Handler getInputConnectionHandler();
|
||||
boolean setInputConnectionHandler(Handler handler);
|
||||
}
|
30
mobile/android/base/GeckoEditableListener.java
Normal file
30
mobile/android/base/GeckoEditableListener.java
Normal file
@ -0,0 +1,30 @@
|
||||
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*-
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
package org.mozilla.gecko;
|
||||
|
||||
/**
|
||||
* Interface for the Editable to listen on the Gecko thread, as well as for the IC thread to listen
|
||||
* to the Editable.
|
||||
*/
|
||||
interface GeckoEditableListener {
|
||||
// IME notification type for notifyIME(), corresponding to NotificationToIME enum in Gecko
|
||||
int NOTIFY_IME_OPEN_VKB = -2;
|
||||
int NOTIFY_IME_REPLY_EVENT = -1;
|
||||
int NOTIFY_IME_OF_FOCUS = 1;
|
||||
int NOTIFY_IME_OF_BLUR = 2;
|
||||
int NOTIFY_IME_TO_COMMIT_COMPOSITION = 8;
|
||||
int NOTIFY_IME_TO_CANCEL_COMPOSITION = 9;
|
||||
// IME enabled state for notifyIMEContext()
|
||||
int IME_STATE_DISABLED = 0;
|
||||
int IME_STATE_ENABLED = 1;
|
||||
int IME_STATE_PASSWORD = 2;
|
||||
int IME_STATE_PLUGIN = 3;
|
||||
|
||||
void notifyIME(int type);
|
||||
void notifyIMEContext(int state, String typeHint, String modeHint, String actionHint);
|
||||
void onSelectionChange(int start, int end);
|
||||
void onTextChange(CharSequence text, int start, int oldEnd, int newEnd);
|
||||
}
|
@ -1007,7 +1007,7 @@ final class DebugGeckoInputConnection
|
||||
|
||||
public static GeckoEditableListener create(View targetView,
|
||||
GeckoEditableClient editable) {
|
||||
final Class[] PROXY_INTERFACES = { InputConnection.class,
|
||||
final Class<?>[] PROXY_INTERFACES = { InputConnection.class,
|
||||
InputConnectionHandler.class,
|
||||
GeckoEditableListener.class };
|
||||
DebugGeckoInputConnection dgic =
|
||||
|
22
mobile/android/base/GeckoMediaPlayer.java
Normal file
22
mobile/android/base/GeckoMediaPlayer.java
Normal file
@ -0,0 +1,22 @@
|
||||
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*-
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
package org.mozilla.gecko;
|
||||
|
||||
import org.json.JSONObject;
|
||||
import org.mozilla.gecko.util.EventCallback;
|
||||
|
||||
/* Wrapper for MediaRouter types supported by Android, such as Chromecast, Miracast, etc. */
|
||||
interface GeckoMediaPlayer {
|
||||
JSONObject toJSON();
|
||||
void load(String title, String url, String type, EventCallback callback);
|
||||
void play(EventCallback callback);
|
||||
void pause(EventCallback callback);
|
||||
void stop(EventCallback callback);
|
||||
void start(EventCallback callback);
|
||||
void end(EventCallback callback);
|
||||
void mirror(EventCallback callback);
|
||||
void message(String message, EventCallback callback);
|
||||
}
|
@ -24,20 +24,10 @@ import android.telephony.SmsMessage;
|
||||
import android.util.Log;
|
||||
|
||||
import static android.telephony.SmsMessage.MessageClass;
|
||||
import static org.mozilla.gecko.SmsManager.ISmsManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* This class is returning unique ids for PendingIntent requestCode attribute.
|
||||
* There are only |Integer.MAX_VALUE - Integer.MIN_VALUE| unique IDs available,
|
||||
* and they wrap around.
|
||||
*/
|
||||
class PendingIntentUID
|
||||
{
|
||||
static private int sUID = Integer.MIN_VALUE;
|
||||
|
||||
static public int generate() { return sUID++; }
|
||||
}
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
* The envelope class contains all information that are needed to keep track of
|
||||
@ -76,7 +66,7 @@ class Envelope
|
||||
mMessageId = -1;
|
||||
mError = GeckoSmsManager.kNoError;
|
||||
|
||||
int size = Envelope.SubParts.values().length;
|
||||
int size = SubParts.values().length;
|
||||
mRemainingParts = new int[size];
|
||||
mFailing = new boolean[size];
|
||||
|
||||
@ -86,7 +76,7 @@ class Envelope
|
||||
}
|
||||
}
|
||||
|
||||
public void decreaseRemainingParts(Envelope.SubParts aType) {
|
||||
public void decreaseRemainingParts(SubParts aType) {
|
||||
--mRemainingParts[aType.ordinal()];
|
||||
|
||||
if (mRemainingParts[SubParts.SENT_PART.ordinal()] >
|
||||
@ -95,15 +85,15 @@ class Envelope
|
||||
}
|
||||
}
|
||||
|
||||
public boolean arePartsRemaining(Envelope.SubParts aType) {
|
||||
public boolean arePartsRemaining(SubParts aType) {
|
||||
return mRemainingParts[aType.ordinal()] != 0;
|
||||
}
|
||||
|
||||
public void markAsFailed(Envelope.SubParts aType) {
|
||||
public void markAsFailed(SubParts aType) {
|
||||
mFailing[aType.ordinal()] = true;
|
||||
}
|
||||
|
||||
public boolean isFailing(Envelope.SubParts aType) {
|
||||
public boolean isFailing(SubParts aType) {
|
||||
return mFailing[aType.ordinal()];
|
||||
}
|
||||
|
||||
@ -141,7 +131,7 @@ class Postman
|
||||
|
||||
private static final Postman sInstance = new Postman();
|
||||
|
||||
private ArrayList<Envelope> mEnvelopes = new ArrayList<Envelope>(1);
|
||||
private final ArrayList<Envelope> mEnvelopes = new ArrayList<>(1);
|
||||
|
||||
private Postman() {}
|
||||
|
||||
@ -224,7 +214,7 @@ class MessagesListManager
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
private ArrayList<Cursor> mCursors = new ArrayList<Cursor>(0);
|
||||
private final ArrayList<Cursor> mCursors = new ArrayList<>();
|
||||
|
||||
public int add(Cursor aCursor) {
|
||||
int size = mCursors.size();
|
||||
@ -355,7 +345,13 @@ public class GeckoSmsManager
|
||||
private final static int kMessageClassClass2 = 3;
|
||||
private final static int kMessageClassClass3 = 4;
|
||||
|
||||
private final static String[] kRequiredMessageRows = new String[] { "_id", "address", "body", "date", "type", "status" };
|
||||
private final static String[] kRequiredMessageRows = { "_id", "address", "body", "date", "type", "status" };
|
||||
|
||||
// Used to generate monotonically increasing GUIDs.
|
||||
private static final AtomicInteger pendingIntentGuid = new AtomicInteger(Integer.MIN_VALUE);
|
||||
|
||||
// The maximum value of a 32 bit signed integer. Used to enforce a limit on ids.
|
||||
private static final long UNSIGNED_INTEGER_MAX_VALUE = Integer.MAX_VALUE * 2L + 1L;
|
||||
|
||||
public GeckoSmsManager() {
|
||||
SmsIOThread.getInstance().start();
|
||||
@ -364,9 +360,9 @@ public class GeckoSmsManager
|
||||
@Override
|
||||
public void start() {
|
||||
IntentFilter smsFilter = new IntentFilter();
|
||||
smsFilter.addAction(GeckoSmsManager.ACTION_SMS_RECEIVED);
|
||||
smsFilter.addAction(GeckoSmsManager.ACTION_SMS_SENT);
|
||||
smsFilter.addAction(GeckoSmsManager.ACTION_SMS_DELIVERED);
|
||||
smsFilter.addAction(ACTION_SMS_RECEIVED);
|
||||
smsFilter.addAction(ACTION_SMS_SENT);
|
||||
smsFilter.addAction(ACTION_SMS_DELIVERED);
|
||||
|
||||
GeckoAppShell.getContext().registerReceiver(this, smsFilter);
|
||||
}
|
||||
@ -490,8 +486,6 @@ public class GeckoSmsManager
|
||||
!envelope.arePartsRemaining(Envelope.SubParts.DELIVERED_PART)) {
|
||||
postman.destroyEnvelope(envelopeId);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -530,12 +524,12 @@ public class GeckoSmsManager
|
||||
*/
|
||||
PendingIntent sentPendingIntent =
|
||||
PendingIntent.getBroadcast(GeckoAppShell.getContext(),
|
||||
PendingIntentUID.generate(), sentIntent,
|
||||
pendingIntentGuid.incrementAndGet(), sentIntent,
|
||||
PendingIntent.FLAG_CANCEL_CURRENT);
|
||||
|
||||
PendingIntent deliveredPendingIntent =
|
||||
PendingIntent.getBroadcast(GeckoAppShell.getContext(),
|
||||
PendingIntentUID.generate(), deliveredIntent,
|
||||
pendingIntentGuid.incrementAndGet(), deliveredIntent,
|
||||
PendingIntent.FLAG_CANCEL_CURRENT);
|
||||
|
||||
sm.sendTextMessage(aNumber, "", aMessage,
|
||||
@ -556,13 +550,13 @@ public class GeckoSmsManager
|
||||
for (int i=0; i<parts.size(); ++i) {
|
||||
sentPendingIntents.add(
|
||||
PendingIntent.getBroadcast(GeckoAppShell.getContext(),
|
||||
PendingIntentUID.generate(), sentIntent,
|
||||
pendingIntentGuid.incrementAndGet(), sentIntent,
|
||||
PendingIntent.FLAG_CANCEL_CURRENT)
|
||||
);
|
||||
|
||||
deliveredPendingIntents.add(
|
||||
PendingIntent.getBroadcast(GeckoAppShell.getContext(),
|
||||
PendingIntentUID.generate(), deliveredIntent,
|
||||
pendingIntentGuid.incrementAndGet(), deliveredIntent,
|
||||
PendingIntent.FLAG_CANCEL_CURRENT)
|
||||
);
|
||||
}
|
||||
@ -597,7 +591,7 @@ public class GeckoSmsManager
|
||||
|
||||
// The DOM API takes a 32bits unsigned int for the id. It's unlikely that
|
||||
// we happen to need more than that but it doesn't cost to check.
|
||||
if (id > Integer.MAX_VALUE) {
|
||||
if (id > UNSIGNED_INTEGER_MAX_VALUE) {
|
||||
throw new IdTooHighException();
|
||||
}
|
||||
|
||||
@ -614,8 +608,8 @@ public class GeckoSmsManager
|
||||
@Override
|
||||
public void getMessage(int aMessageId, int aRequestId) {
|
||||
class GetMessageRunnable implements Runnable {
|
||||
private int mMessageId;
|
||||
private int mRequestId;
|
||||
private final int mMessageId;
|
||||
private final int mRequestId;
|
||||
|
||||
GetMessageRunnable(int aMessageId, int aRequestId) {
|
||||
mMessageId = aMessageId;
|
||||
@ -699,8 +693,8 @@ public class GeckoSmsManager
|
||||
@Override
|
||||
public void deleteMessage(int aMessageId, int aRequestId) {
|
||||
class DeleteMessageRunnable implements Runnable {
|
||||
private int mMessageId;
|
||||
private int mRequestId;
|
||||
private final int mMessageId;
|
||||
private final int mRequestId;
|
||||
|
||||
DeleteMessageRunnable(int aMessageId, int aRequestId) {
|
||||
mMessageId = aMessageId;
|
||||
@ -739,13 +733,13 @@ public class GeckoSmsManager
|
||||
@Override
|
||||
public void createMessageList(long aStartDate, long aEndDate, String[] aNumbers, int aNumbersCount, String aDelivery, boolean aHasRead, boolean aRead, long aThreadId, boolean aReverse, int aRequestId) {
|
||||
class CreateMessageListRunnable implements Runnable {
|
||||
private long mStartDate;
|
||||
private long mEndDate;
|
||||
private String[] mNumbers;
|
||||
private int mNumbersCount;
|
||||
private String mDelivery;
|
||||
private boolean mReverse;
|
||||
private int mRequestId;
|
||||
private final long mStartDate;
|
||||
private final long mEndDate;
|
||||
private final String[] mNumbers;
|
||||
private final int mNumbersCount;
|
||||
private final String mDelivery;
|
||||
private final boolean mReverse;
|
||||
private final int mRequestId;
|
||||
|
||||
CreateMessageListRunnable(long aStartDate, long aEndDate, String[] aNumbers, int aNumbersCount, String aDelivery, boolean aHasRead, boolean aRead, long aThreadId, boolean aReverse, int aRequestId) {
|
||||
mStartDate = aStartDate;
|
||||
@ -775,34 +769,38 @@ public class GeckoSmsManager
|
||||
}
|
||||
|
||||
if (mNumbersCount > 0) {
|
||||
String numberRestriction = "address IN ('" + mNumbers[0] + "'";
|
||||
final StringBuilder numberRestriction = new StringBuilder("address IN ('");
|
||||
numberRestriction.append(mNumbers[0]).append("'");
|
||||
|
||||
for (int i=1; i<mNumbersCount; ++i) {
|
||||
numberRestriction += ", '" + mNumbers[i] + "'";
|
||||
numberRestriction.append(", '").append(mNumbers[i]).append("'");
|
||||
}
|
||||
numberRestriction += ")";
|
||||
numberRestriction.append(')');
|
||||
|
||||
restrictions.add(numberRestriction);
|
||||
restrictions.add(numberRestriction.toString());
|
||||
}
|
||||
|
||||
if (mDelivery == null) {
|
||||
restrictions.add("type IN ('" + kSmsTypeSentbox + "', '" + kSmsTypeInbox + "')");
|
||||
} else if (mDelivery == "sent") {
|
||||
} else if (mDelivery.equals("sent")) {
|
||||
restrictions.add("type = " + kSmsTypeSentbox);
|
||||
} else if (mDelivery == "received") {
|
||||
} else if (mDelivery.equals("received")) {
|
||||
restrictions.add("type = " + kSmsTypeInbox);
|
||||
} else {
|
||||
throw new UnexpectedDeliveryStateException();
|
||||
}
|
||||
|
||||
String restrictionText = restrictions.size() > 0 ? restrictions.get(0) : "";
|
||||
final StringBuilder restrictionText = new StringBuilder();
|
||||
if (!restrictions.isEmpty()) {
|
||||
restrictionText.append(restrictions.get(0));
|
||||
}
|
||||
|
||||
for (int i=1; i<restrictions.size(); ++i) {
|
||||
restrictionText += " AND " + restrictions.get(i);
|
||||
restrictionText.append(" AND ").append(restrictions.get(i));
|
||||
}
|
||||
|
||||
ContentResolver cr = GeckoAppShell.getContext().getContentResolver();
|
||||
cursor = cr.query(kSmsContentUri, kRequiredMessageRows, restrictionText, null,
|
||||
cursor = cr.query(kSmsContentUri, kRequiredMessageRows, restrictionText.toString(), null,
|
||||
mReverse ? "date DESC" : "date ASC");
|
||||
|
||||
if (cursor.getCount() == 0) {
|
||||
@ -862,8 +860,8 @@ public class GeckoSmsManager
|
||||
@Override
|
||||
public void getNextMessageInList(int aListId, int aRequestId) {
|
||||
class GetNextMessageInListRunnable implements Runnable {
|
||||
private int mListId;
|
||||
private int mRequestId;
|
||||
private final int mListId;
|
||||
private final int mRequestId;
|
||||
|
||||
GetNextMessageInListRunnable(int aListId, int aRequestId) {
|
||||
mListId = aListId;
|
||||
@ -963,27 +961,27 @@ public class GeckoSmsManager
|
||||
}
|
||||
}
|
||||
|
||||
class IdTooHighException extends Exception {
|
||||
static class IdTooHighException extends Exception {
|
||||
private static final long serialVersionUID = 29935575131092050L;
|
||||
}
|
||||
|
||||
class InvalidTypeException extends Exception {
|
||||
static class InvalidTypeException extends Exception {
|
||||
private static final long serialVersionUID = 47436856832535912L;
|
||||
}
|
||||
|
||||
class NotFoundException extends Exception {
|
||||
static class NotFoundException extends Exception {
|
||||
private static final long serialVersionUID = 1940676816633984L;
|
||||
}
|
||||
|
||||
class TooManyResultsException extends Exception {
|
||||
static class TooManyResultsException extends Exception {
|
||||
private static final long serialVersionUID = 51883196784325305L;
|
||||
}
|
||||
|
||||
class UnexpectedDeliveryStateException extends Exception {
|
||||
static class UnexpectedDeliveryStateException extends Exception {
|
||||
private static final long serialVersionUID = 494122763684005716L;
|
||||
}
|
||||
|
||||
class UnmatchingIdException extends Exception {
|
||||
static class UnmatchingIdException extends Exception {
|
||||
private static final long serialVersionUID = 158467542575633280L;
|
||||
}
|
||||
|
||||
|
@ -27,19 +27,6 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Iterator;
|
||||
|
||||
/* Wraper for different MediaRouter types supproted by Android. i.e. Chromecast, Miracast, etc. */
|
||||
interface GeckoMediaPlayer {
|
||||
public JSONObject toJSON();
|
||||
public void load(String title, String url, String type, EventCallback callback);
|
||||
public void play(EventCallback callback);
|
||||
public void pause(EventCallback callback);
|
||||
public void stop(EventCallback callback);
|
||||
public void start(EventCallback callback);
|
||||
public void end(EventCallback callback);
|
||||
public void mirror(EventCallback callback);
|
||||
public void message(String message, EventCallback callback);
|
||||
}
|
||||
|
||||
/* Manages a list of GeckoMediaPlayers methods (i.e. Chromecast/Miracast). Routes messages
|
||||
* from Gecko to the correct caster based on the id of the display
|
||||
*/
|
||||
|
@ -9,6 +9,7 @@ import java.util.List;
|
||||
|
||||
import org.mozilla.gecko.TabsAccessor.RemoteClient;
|
||||
import org.mozilla.gecko.TabsAccessor.RemoteTab;
|
||||
import org.mozilla.gecko.home.TwoLinePageRow;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
@ -151,11 +152,18 @@ public class RemoteTabsExpandableListAdapter extends BaseExpandableListAdapter {
|
||||
final RemoteClient client = clients.get(groupPosition);
|
||||
final RemoteTab tab = client.tabs.get(childPosition);
|
||||
|
||||
final TextView titleView = (TextView) view.findViewById(R.id.title);
|
||||
titleView.setText(TextUtils.isEmpty(tab.title) ? tab.url : tab.title);
|
||||
// The view is a TwoLinePageRow only for some of our child views: it's
|
||||
// present for the home panel children and not for the tabs tray
|
||||
// children. Therefore, we must handle one case manually.
|
||||
if (view instanceof TwoLinePageRow) {
|
||||
((TwoLinePageRow) view).update(tab.title, tab.url);
|
||||
} else {
|
||||
final TextView titleView = (TextView) view.findViewById(R.id.title);
|
||||
titleView.setText(TextUtils.isEmpty(tab.title) ? tab.url : tab.title);
|
||||
|
||||
final TextView urlView = (TextView) view.findViewById(R.id.url);
|
||||
urlView.setText(tab.url);
|
||||
final TextView urlView = (TextView) view.findViewById(R.id.url);
|
||||
urlView.setText(tab.url);
|
||||
}
|
||||
|
||||
return view;
|
||||
}
|
||||
|
@ -5,30 +5,35 @@
|
||||
|
||||
package org.mozilla.gecko;
|
||||
|
||||
class SmsManager
|
||||
{
|
||||
static private ISmsManager sInstance;
|
||||
|
||||
static public ISmsManager getInstance() {
|
||||
public class SmsManager {
|
||||
private static final ISmsManager sInstance;
|
||||
static {
|
||||
if (AppConstants.MOZ_WEBSMS_BACKEND) {
|
||||
if (sInstance == null) {
|
||||
sInstance = new GeckoSmsManager();
|
||||
}
|
||||
sInstance = new GeckoSmsManager();
|
||||
} else {
|
||||
sInstance = null;
|
||||
}
|
||||
}
|
||||
|
||||
public static ISmsManager getInstance() {
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public static boolean isEnabled() {
|
||||
return AppConstants.MOZ_WEBSMS_BACKEND;
|
||||
}
|
||||
|
||||
public interface ISmsManager {
|
||||
void start();
|
||||
void stop();
|
||||
void shutdown();
|
||||
|
||||
void send(String aNumber, String aMessage, int aRequestId);
|
||||
void getMessage(int aMessageId, int aRequestId);
|
||||
void deleteMessage(int aMessageId, int aRequestId);
|
||||
void createMessageList(long aStartDate, long aEndDate, String[] aNumbers, int aNumbersCount, String aDelivery, boolean aHasRead, boolean aRead, long aThreadId, boolean aReverse, int aRequestId);
|
||||
void getNextMessageInList(int aListId, int aRequestId);
|
||||
void clearMessageList(int aListId);
|
||||
}
|
||||
}
|
||||
|
||||
interface ISmsManager
|
||||
{
|
||||
public void start();
|
||||
public void stop();
|
||||
public void shutdown();
|
||||
|
||||
public void send(String aNumber, String aMessage, int aRequestId);
|
||||
public void getMessage(int aMessageId, int aRequestId);
|
||||
public void deleteMessage(int aMessageId, int aRequestId);
|
||||
public void createMessageList(long aStartDate, long aEndDate, String[] aNumbers, int aNumbersCount, String aDelivery, boolean aHasRead, boolean aRead, long aThreadId, boolean aReverse, int aRequestId);
|
||||
public void getNextMessageInList(int aListId, int aRequestId);
|
||||
public void clearMessageList(int aListId);
|
||||
}
|
||||
|
@ -61,6 +61,11 @@ public class Tab {
|
||||
return Utils.sameArrays(this.history, other.history);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return super.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract a <code>Tab</code> from a cursor row.
|
||||
* <p>
|
||||
|
@ -237,14 +237,6 @@ public class BrowserDB {
|
||||
sDb.registerBookmarkObserver(cr, observer);
|
||||
}
|
||||
|
||||
public static void registerHistoryObserver(ContentResolver cr, ContentObserver observer) {
|
||||
sDb.registerHistoryObserver(cr, observer);
|
||||
}
|
||||
|
||||
public static void unregisterContentObserver(ContentResolver cr, ContentObserver observer) {
|
||||
cr.unregisterContentObserver(observer);
|
||||
}
|
||||
|
||||
public static int getCount(ContentResolver cr, String database) {
|
||||
return sDb.getCount(cr, database);
|
||||
}
|
||||
@ -257,23 +249,11 @@ public class BrowserDB {
|
||||
sDb.unpinSite(cr, position);
|
||||
}
|
||||
|
||||
public static void unpinAllSites(ContentResolver cr) {
|
||||
sDb.unpinAllSites(cr);
|
||||
}
|
||||
|
||||
public static Cursor getPinnedSites(ContentResolver cr, int limit) {
|
||||
return sDb.getPinnedSites(cr, limit);
|
||||
}
|
||||
|
||||
@RobocopTarget
|
||||
public static Cursor getBookmarkForUrl(ContentResolver cr, String url) {
|
||||
return sDb.getBookmarkForUrl(cr, url);
|
||||
}
|
||||
|
||||
public static boolean areContentProvidersDisabled() {
|
||||
return sAreContentProvidersEnabled;
|
||||
}
|
||||
|
||||
public static void setEnableContentProviders(boolean enableContentProviders) {
|
||||
sAreContentProvidersEnabled = enableContentProviders;
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public class LocalBrowserDB {
|
||||
// Calculate these once, at initialization. isLoggable is too expensive to
|
||||
// have in-line in each log call.
|
||||
private static final String LOGTAG = "GeckoLocalBrowserDB";
|
||||
private static boolean logDebug = Log.isLoggable(LOGTAG, Log.DEBUG);
|
||||
private static final boolean logDebug = Log.isLoggable(LOGTAG, Log.DEBUG);
|
||||
protected static void debug(String message) {
|
||||
if (logDebug) {
|
||||
Log.d(LOGTAG, message);
|
||||
@ -449,11 +449,6 @@ public class LocalBrowserDB {
|
||||
mDesktopBookmarksExist = null;
|
||||
}
|
||||
|
||||
private Uri historyUriWithLimit(int limit) {
|
||||
return mHistoryUriWithProfile.buildUpon().appendQueryParameter(BrowserContract.PARAM_LIMIT,
|
||||
String.valueOf(limit)).build();
|
||||
}
|
||||
|
||||
private Uri bookmarksUriWithLimit(int limit) {
|
||||
return mBookmarksUriWithProfile.buildUpon().appendQueryParameter(BrowserContract.PARAM_LIMIT,
|
||||
String.valueOf(limit)).build();
|
||||
@ -486,11 +481,6 @@ public class LocalBrowserDB {
|
||||
return uriBuilder.build();
|
||||
}
|
||||
|
||||
private Cursor filterAllSites(ContentResolver cr, String[] projection, CharSequence constraint,
|
||||
int limit, CharSequence urlFilter) {
|
||||
return filterAllSites(cr, projection, constraint, limit, urlFilter, "", null);
|
||||
}
|
||||
|
||||
private Cursor filterAllSites(ContentResolver cr, String[] projection, CharSequence constraint,
|
||||
int limit, CharSequence urlFilter, String selection, String[] selectionArgs) {
|
||||
// The combined history/bookmarks selection queries for sites with a url or title containing
|
||||
@ -639,38 +629,6 @@ public class LocalBrowserDB {
|
||||
new String[] { uri });
|
||||
}
|
||||
|
||||
public void updateHistoryEntry(ContentResolver cr, String uri, String title,
|
||||
long date, int visits) {
|
||||
int oldVisits = 0;
|
||||
Cursor cursor = null;
|
||||
try {
|
||||
cursor = cr.query(mHistoryUriWithProfile,
|
||||
new String[] { History.VISITS },
|
||||
History.URL + " = ?",
|
||||
new String[] { uri },
|
||||
null);
|
||||
|
||||
if (cursor.moveToFirst()) {
|
||||
oldVisits = cursor.getInt(0);
|
||||
}
|
||||
} finally {
|
||||
if (cursor != null)
|
||||
cursor.close();
|
||||
}
|
||||
|
||||
ContentValues values = new ContentValues();
|
||||
values.put(History.DATE_LAST_VISITED, date);
|
||||
values.put(History.VISITS, oldVisits + visits);
|
||||
if (title != null) {
|
||||
values.put(History.TITLE, title);
|
||||
}
|
||||
|
||||
cr.update(mHistoryUriWithProfile,
|
||||
values,
|
||||
History.URL + " = ?",
|
||||
new String[] { uri });
|
||||
}
|
||||
|
||||
@RobocopTarget
|
||||
public Cursor getAllVisitedHistory(ContentResolver cr) {
|
||||
return cr.query(mHistoryUriWithProfile,
|
||||
@ -700,12 +658,6 @@ public class LocalBrowserDB {
|
||||
cr.delete(url, null, null);
|
||||
}
|
||||
|
||||
public void removeHistoryEntry(ContentResolver cr, int id) {
|
||||
cr.delete(mHistoryUriWithProfile,
|
||||
History._ID + " = ?",
|
||||
new String[] { String.valueOf(id) });
|
||||
}
|
||||
|
||||
@RobocopTarget
|
||||
public void removeHistoryEntry(ContentResolver cr, String url) {
|
||||
cr.delete(mHistoryUriWithProfile,
|
||||
@ -807,22 +759,6 @@ public class LocalBrowserDB {
|
||||
return mDesktopBookmarksExist;
|
||||
}
|
||||
|
||||
public int getReadingListCount(ContentResolver cr) {
|
||||
Cursor c = null;
|
||||
try {
|
||||
c = cr.query(mReadingListUriWithProfile,
|
||||
new String[] { ReadingListItems._ID },
|
||||
null,
|
||||
null,
|
||||
null);
|
||||
return c.getCount();
|
||||
} finally {
|
||||
if (c != null) {
|
||||
c.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@RobocopTarget
|
||||
public boolean isBookmark(ContentResolver cr, String uri) {
|
||||
Cursor c = null;
|
||||
@ -1008,18 +944,6 @@ public class LocalBrowserDB {
|
||||
addBookmarkItem(cr, title, uri, folderId);
|
||||
}
|
||||
|
||||
public void removeBookmark(ContentResolver cr, int id) {
|
||||
Uri contentUri = mBookmarksUriWithProfile;
|
||||
|
||||
// Do this now so that the item still exists!
|
||||
final String idString = String.valueOf(id);
|
||||
bumpParents(cr, Bookmarks._ID, idString);
|
||||
|
||||
final String[] idArgs = new String[] { idString };
|
||||
final String idEquals = Bookmarks._ID + " = ?";
|
||||
cr.delete(contentUri, idEquals, idArgs);
|
||||
}
|
||||
|
||||
@RobocopTarget
|
||||
public void removeBookmarksWithURL(ContentResolver cr, String uri) {
|
||||
Uri contentUri = mBookmarksUriWithProfile;
|
||||
@ -1062,18 +986,10 @@ public class LocalBrowserDB {
|
||||
cr.delete(mReadingListUriWithProfile, ReadingListItems.URL + " = ? ", new String[] { uri });
|
||||
}
|
||||
|
||||
public void removeReadingListItem(ContentResolver cr, int id) {
|
||||
cr.delete(mReadingListUriWithProfile, ReadingListItems._ID + " = ? ", new String[] { String.valueOf(id) });
|
||||
}
|
||||
|
||||
public void registerBookmarkObserver(ContentResolver cr, ContentObserver observer) {
|
||||
cr.registerContentObserver(mBookmarksUriWithProfile, false, observer);
|
||||
}
|
||||
|
||||
public void registerHistoryObserver(ContentResolver cr, ContentObserver observer) {
|
||||
cr.registerContentObserver(mHistoryUriWithProfile, false, observer);
|
||||
}
|
||||
|
||||
@RobocopTarget
|
||||
public void updateBookmark(ContentResolver cr, int id, String uri, String title, String keyword) {
|
||||
ContentValues values = new ContentValues();
|
||||
@ -1415,7 +1331,7 @@ public class LocalBrowserDB {
|
||||
|
||||
// This wrapper adds a fake "Desktop Bookmarks" folder entry to the
|
||||
// beginning of the cursor's data set.
|
||||
private class SpecialFoldersCursorWrapper extends CursorWrapper {
|
||||
private static class SpecialFoldersCursorWrapper extends CursorWrapper {
|
||||
private int mIndexOffset;
|
||||
|
||||
private int mDesktopBookmarksIndex = -1;
|
||||
@ -1431,22 +1347,27 @@ public class LocalBrowserDB {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return super.getCount() + mIndexOffset;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean moveToPosition(int position) {
|
||||
mAtDesktopBookmarksPosition = (mDesktopBookmarksIndex == position);
|
||||
|
||||
if (mAtDesktopBookmarksPosition)
|
||||
if (mAtDesktopBookmarksPosition) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.moveToPosition(position - mIndexOffset);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLong(int columnIndex) {
|
||||
if (!mAtDesktopBookmarksPosition)
|
||||
if (!mAtDesktopBookmarksPosition) {
|
||||
return super.getLong(columnIndex);
|
||||
}
|
||||
|
||||
if (columnIndex == getColumnIndex(Bookmarks.PARENT)) {
|
||||
return Bookmarks.FIXED_ROOT_ID;
|
||||
@ -1455,25 +1376,32 @@ public class LocalBrowserDB {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInt(int columnIndex) {
|
||||
if (!mAtDesktopBookmarksPosition)
|
||||
if (!mAtDesktopBookmarksPosition) {
|
||||
return super.getInt(columnIndex);
|
||||
}
|
||||
|
||||
if (columnIndex == getColumnIndex(Bookmarks._ID) && mAtDesktopBookmarksPosition)
|
||||
return Bookmarks.FAKE_DESKTOP_FOLDER_ID;
|
||||
if (columnIndex == getColumnIndex(Bookmarks._ID) && mAtDesktopBookmarksPosition) {
|
||||
return Bookmarks.FAKE_DESKTOP_FOLDER_ID;
|
||||
}
|
||||
|
||||
if (columnIndex == getColumnIndex(Bookmarks.TYPE))
|
||||
if (columnIndex == getColumnIndex(Bookmarks.TYPE)) {
|
||||
return Bookmarks.TYPE_FOLDER;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getString(int columnIndex) {
|
||||
if (!mAtDesktopBookmarksPosition)
|
||||
if (!mAtDesktopBookmarksPosition) {
|
||||
return super.getString(columnIndex);
|
||||
}
|
||||
|
||||
if (columnIndex == getColumnIndex(Bookmarks.GUID) && mAtDesktopBookmarksPosition)
|
||||
return Bookmarks.FAKE_DESKTOP_FOLDER_GUID;
|
||||
if (columnIndex == getColumnIndex(Bookmarks.GUID) && mAtDesktopBookmarksPosition) {
|
||||
return Bookmarks.FAKE_DESKTOP_FOLDER_GUID;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
@ -1523,35 +1451,6 @@ public class LocalBrowserDB {
|
||||
});
|
||||
}
|
||||
|
||||
public void unpinAllSites(ContentResolver cr) {
|
||||
cr.delete(mBookmarksUriWithProfile,
|
||||
Bookmarks.PARENT + " == ?",
|
||||
new String[] {
|
||||
String.valueOf(Bookmarks.FIXED_PINNED_LIST_ID)
|
||||
});
|
||||
}
|
||||
|
||||
public boolean isVisited(ContentResolver cr, String uri) {
|
||||
int count = 0;
|
||||
Cursor c = null;
|
||||
|
||||
try {
|
||||
c = cr.query(historyUriWithLimit(1),
|
||||
new String[] { History._ID },
|
||||
History.URL + " = ?",
|
||||
new String[] { uri },
|
||||
History.URL);
|
||||
count = c.getCount();
|
||||
} catch (NullPointerException e) {
|
||||
Log.e(LOGTAG, "NullPointerException in isVisited");
|
||||
} finally {
|
||||
if (c != null)
|
||||
c.close();
|
||||
}
|
||||
|
||||
return (count > 0);
|
||||
}
|
||||
|
||||
@RobocopTarget
|
||||
public Cursor getBookmarkForUrl(ContentResolver cr, String url) {
|
||||
Cursor c = cr.query(bookmarksUriWithLimit(1),
|
||||
|
@ -29,10 +29,12 @@ import java.io.File;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
public class Favicons {
|
||||
private static final String LOGTAG = "GeckoFavicons";
|
||||
@ -54,8 +56,6 @@ public class Favicons {
|
||||
public static final int FLAG_PERSIST = 2;
|
||||
public static final int FLAG_SCALE = 4;
|
||||
|
||||
protected static Context context;
|
||||
|
||||
// The default Favicon to show if no other can be found.
|
||||
public static Bitmap defaultFavicon;
|
||||
|
||||
@ -65,14 +65,17 @@ public class Favicons {
|
||||
// The density-adjusted maximum Favicon dimensions.
|
||||
public static int largestFaviconSize;
|
||||
|
||||
// Used to prevent multiple-initialisation.
|
||||
public static final AtomicBoolean isInitialized = new AtomicBoolean(false);
|
||||
|
||||
// Executor for long-running Favicon Tasks.
|
||||
public static final ExecutorService longRunningExecutor = Executors.newSingleThreadExecutor();
|
||||
|
||||
private static final SparseArray<LoadFaviconTask> loadTasks = new SparseArray<LoadFaviconTask>();
|
||||
private static final SparseArray<LoadFaviconTask> loadTasks = new SparseArray<>();
|
||||
|
||||
// Cache to hold mappings between page URLs and Favicon URLs. Used to avoid going to the DB when
|
||||
// doing so is not necessary.
|
||||
private static final NonEvictingLruCache<String, String> pageURLMappings = new NonEvictingLruCache<String, String>(NUM_PAGE_URL_MAPPINGS_TO_STORE);
|
||||
private static final NonEvictingLruCache<String, String> pageURLMappings = new NonEvictingLruCache<>(NUM_PAGE_URL_MAPPINGS_TO_STORE);
|
||||
|
||||
public static String getFaviconURLForPageURLFromCache(String pageURL) {
|
||||
return pageURLMappings.get(pageURL);
|
||||
@ -143,7 +146,7 @@ public class Favicons {
|
||||
* @return The id of the asynchronous task created, NOT_LOADING if none is created, or
|
||||
* LOADED if the value could be dispatched on the current thread.
|
||||
*/
|
||||
public static int getSizedFavicon(String pageURL, String faviconURL, int targetSize, int flags, OnFaviconLoadedListener listener) {
|
||||
public static int getSizedFavicon(Context context, String pageURL, String faviconURL, int targetSize, int flags, OnFaviconLoadedListener listener) {
|
||||
// Do we know the favicon URL for this page already?
|
||||
String cacheURL = faviconURL;
|
||||
if (cacheURL == null) {
|
||||
@ -171,7 +174,7 @@ public class Favicons {
|
||||
}
|
||||
|
||||
// Failing that, try and get one from the database or internet.
|
||||
return loadUncachedFavicon(pageURL, faviconURL, flags, targetSize, listener);
|
||||
return loadUncachedFavicon(context, pageURL, faviconURL, flags, targetSize, listener);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -202,7 +205,7 @@ public class Favicons {
|
||||
* @param callback Callback to fire with the result.
|
||||
* @return The job ID of the spawned async task, if any.
|
||||
*/
|
||||
public static int getSizedFaviconForPageFromLocal(final String pageURL, final int targetSize,
|
||||
public static int getSizedFaviconForPageFromLocal(Context context, final String pageURL, final int targetSize,
|
||||
final OnFaviconLoadedListener callback) {
|
||||
// Firstly, try extremely hard to cheat.
|
||||
// Have we cached this favicon URL? If we did, we can consult the memcache right away.
|
||||
@ -223,7 +226,7 @@ public class Favicons {
|
||||
|
||||
// No joy using in-memory resources. Go to background thread and ask the database.
|
||||
final LoadFaviconTask task =
|
||||
new LoadFaviconTask(pageURL, targetURL, 0, callback, targetSize, true);
|
||||
new LoadFaviconTask(context, pageURL, targetURL, 0, callback, targetSize, true);
|
||||
final int taskId = task.getId();
|
||||
synchronized(loadTasks) {
|
||||
loadTasks.put(taskId, task);
|
||||
@ -233,8 +236,8 @@ public class Favicons {
|
||||
return taskId;
|
||||
}
|
||||
|
||||
public static int getSizedFaviconForPageFromLocal(final String pageURL, final OnFaviconLoadedListener callback) {
|
||||
return getSizedFaviconForPageFromLocal(pageURL, defaultFaviconSize, callback);
|
||||
public static int getSizedFaviconForPageFromLocal(Context context, final String pageURL, final OnFaviconLoadedListener callback) {
|
||||
return getSizedFaviconForPageFromLocal(context, pageURL, defaultFaviconSize, callback);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -245,7 +248,7 @@ public class Favicons {
|
||||
* @return The URL of the Favicon used by that webpage, according to either the History database
|
||||
* or a somewhat educated guess.
|
||||
*/
|
||||
public static String getFaviconURLForPageURL(String pageURL) {
|
||||
public static String getFaviconURLForPageURL(Context context, String pageURL) {
|
||||
// Attempt to determine the Favicon URL from the Tabs datastructure. Can dodge having to use
|
||||
// the database sometimes by doing this.
|
||||
String targetURL;
|
||||
@ -283,7 +286,7 @@ public class Favicons {
|
||||
* @param listener The OnFaviconLoadedListener to invoke with the result of this Favicon load.
|
||||
* @return The id of the LoadFaviconTask handling this job.
|
||||
*/
|
||||
private static int loadUncachedFavicon(String pageURL, String faviconURL, int flags,
|
||||
private static int loadUncachedFavicon(Context context, String pageURL, String faviconURL, int flags,
|
||||
int targetSize, OnFaviconLoadedListener listener) {
|
||||
// Handle the case where we have no page url.
|
||||
if (TextUtils.isEmpty(pageURL)) {
|
||||
@ -292,7 +295,7 @@ public class Favicons {
|
||||
}
|
||||
|
||||
final LoadFaviconTask task =
|
||||
new LoadFaviconTask(pageURL, faviconURL, flags, listener, targetSize, false);
|
||||
new LoadFaviconTask(context, pageURL, faviconURL, flags, listener, targetSize, false);
|
||||
final int taskId = task.getId();
|
||||
synchronized(loadTasks) {
|
||||
loadTasks.put(taskId, task);
|
||||
@ -382,14 +385,18 @@ public class Favicons {
|
||||
*
|
||||
* @param context A reference to the GeckoApp instance.
|
||||
*/
|
||||
public static void attachToContext(Context context) throws Exception {
|
||||
public static void initializeWithContext(Context context) throws IllegalStateException {
|
||||
// Prevent multiple-initialisation.
|
||||
if (!isInitialized.compareAndSet(false, true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
final Resources res = context.getResources();
|
||||
Favicons.context = context;
|
||||
|
||||
// Decode the default Favicon ready for use.
|
||||
defaultFavicon = BitmapFactory.decodeResource(res, R.drawable.favicon);
|
||||
if (defaultFavicon == null) {
|
||||
throw new Exception("Null default favicon was returned from the resources system!");
|
||||
throw new IllegalStateException("Null default favicon was returned from the resources system!");
|
||||
}
|
||||
|
||||
defaultFaviconSize = res.getDimensionPixelSize(R.dimen.favicon_bg);
|
||||
@ -412,7 +419,7 @@ public class Favicons {
|
||||
putFaviconsInMemCache(BUILT_IN_FAVICON_URL, toInsert.iterator(), true);
|
||||
|
||||
pageURLMappings.putWithoutEviction(AboutPages.HOME, BUILT_IN_SEARCH_URL);
|
||||
List<Bitmap> searchIcons = Arrays.asList(BitmapFactory.decodeResource(res, R.drawable.favicon_search));
|
||||
List<Bitmap> searchIcons = Collections.singletonList(BitmapFactory.decodeResource(res, R.drawable.favicon_search));
|
||||
putFaviconsInMemCache(BUILT_IN_SEARCH_URL, searchIcons.iterator(), true);
|
||||
}
|
||||
|
||||
@ -491,8 +498,8 @@ public class Favicons {
|
||||
* @param url page URL to get a large favicon image for.
|
||||
* @param onFaviconLoadedListener listener to call back with the result.
|
||||
*/
|
||||
public static void getPreferredSizeFaviconForPage(String url, OnFaviconLoadedListener onFaviconLoadedListener) {
|
||||
public static void getPreferredSizeFaviconForPage(Context context, String url, OnFaviconLoadedListener onFaviconLoadedListener) {
|
||||
int preferredSize = GeckoAppShell.getPreferredIconSize();
|
||||
loadUncachedFavicon(url, null, 0, preferredSize, onFaviconLoadedListener);
|
||||
loadUncachedFavicon(context, url, null, 0, preferredSize, onFaviconLoadedListener);
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ package org.mozilla.gecko.favicons;
|
||||
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.net.http.AndroidHttpClient;
|
||||
import android.text.TextUtils;
|
||||
@ -21,8 +22,6 @@ import org.mozilla.gecko.favicons.decoders.LoadFaviconResult;
|
||||
import org.mozilla.gecko.util.GeckoJarReader;
|
||||
import org.mozilla.gecko.util.ThreadUtils;
|
||||
|
||||
import static org.mozilla.gecko.favicons.Favicons.context;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URI;
|
||||
@ -44,7 +43,7 @@ public class LoadFaviconTask {
|
||||
|
||||
// Access to this map needs to be synchronized prevent multiple jobs loading the same favicon
|
||||
// from executing concurrently.
|
||||
private static final HashMap<String, LoadFaviconTask> loadsInFlight = new HashMap<String, LoadFaviconTask>();
|
||||
private static final HashMap<String, LoadFaviconTask> loadsInFlight = new HashMap<>();
|
||||
|
||||
public static final int FLAG_PERSIST = 1;
|
||||
public static final int FLAG_SCALE = 2;
|
||||
@ -53,12 +52,13 @@ public class LoadFaviconTask {
|
||||
// by the server.
|
||||
private static final int DEFAULT_FAVICON_BUFFER_SIZE = 25000;
|
||||
|
||||
private static AtomicInteger nextFaviconLoadId = new AtomicInteger(0);
|
||||
private int id;
|
||||
private String pageUrl;
|
||||
private static final AtomicInteger nextFaviconLoadId = new AtomicInteger(0);
|
||||
private final Context context;
|
||||
private final int id;
|
||||
private final String pageUrl;
|
||||
private String faviconURL;
|
||||
private OnFaviconLoadedListener listener;
|
||||
private int flags;
|
||||
private final OnFaviconLoadedListener listener;
|
||||
private final int flags;
|
||||
|
||||
private final boolean onlyFromLocal;
|
||||
/* inner-access */ volatile boolean mCancelled;
|
||||
@ -70,14 +70,15 @@ public class LoadFaviconTask {
|
||||
|
||||
static AndroidHttpClient httpClient = AndroidHttpClient.newInstance(GeckoAppShell.getGeckoInterface().getDefaultUAString());
|
||||
|
||||
public LoadFaviconTask(String pageURL, String faviconURL, int flags, OnFaviconLoadedListener listener) {
|
||||
this(pageURL, faviconURL, flags, listener, -1, false);
|
||||
public LoadFaviconTask(Context context, String pageURL, String faviconURL, int flags, OnFaviconLoadedListener listener) {
|
||||
this(context, pageURL, faviconURL, flags, listener, -1, false);
|
||||
}
|
||||
|
||||
public LoadFaviconTask(String pageURL, String faviconURL, int flags, OnFaviconLoadedListener listener,
|
||||
public LoadFaviconTask(Context context, String pageURL, String faviconURL, int flags, OnFaviconLoadedListener listener,
|
||||
int targetWidth, boolean onlyFromLocal) {
|
||||
id = nextFaviconLoadId.incrementAndGet();
|
||||
|
||||
this.context = context;
|
||||
this.pageUrl = pageURL;
|
||||
this.faviconURL = faviconURL;
|
||||
this.listener = listener;
|
||||
@ -112,7 +113,7 @@ public class LoadFaviconTask {
|
||||
* @return The HttpResponse containing the downloaded Favicon if successful, null otherwise.
|
||||
*/
|
||||
private HttpResponse tryDownload(URI faviconURI) throws URISyntaxException, IOException {
|
||||
HashSet<String> visitedLinkSet = new HashSet<String>();
|
||||
HashSet<String> visitedLinkSet = new HashSet<>();
|
||||
visitedLinkSet.add(faviconURI.toString());
|
||||
return tryDownloadRecurse(faviconURI, visitedLinkSet);
|
||||
}
|
||||
@ -183,7 +184,7 @@ public class LoadFaviconTask {
|
||||
* Retrieve the specified favicon from the JAR, returning null if it's not
|
||||
* a JAR URI.
|
||||
*/
|
||||
private static Bitmap fetchJARFavicon(String uri) {
|
||||
private Bitmap fetchJARFavicon(String uri) {
|
||||
if (uri == null) {
|
||||
return null;
|
||||
}
|
||||
@ -370,7 +371,7 @@ public class LoadFaviconTask {
|
||||
|
||||
// If that failed, try to get the URL from the database.
|
||||
if (storedFaviconUrl == null) {
|
||||
storedFaviconUrl = Favicons.getFaviconURLForPageURL(pageUrl);
|
||||
storedFaviconUrl = Favicons.getFaviconURLForPageURL(context, pageUrl);
|
||||
if (storedFaviconUrl != null) {
|
||||
// If that succeeded, cache the URL loaded from the database in memory.
|
||||
Favicons.putFaviconURLForPageURLInCache(pageUrl, storedFaviconUrl);
|
||||
@ -597,7 +598,7 @@ public class LoadFaviconTask {
|
||||
*/
|
||||
private void chainTasks(LoadFaviconTask aChainee) {
|
||||
if (chainees == null) {
|
||||
chainees = new LinkedList<LoadFaviconTask>();
|
||||
chainees = new LinkedList<>();
|
||||
}
|
||||
|
||||
chainees.add(aChainee);
|
||||
|
@ -370,6 +370,11 @@ public final class HomeConfig {
|
||||
return mId.equals(other.mId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return super.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
|
@ -194,7 +194,7 @@ public abstract class HomeFragment extends Fragment {
|
||||
}
|
||||
|
||||
// Fetch an icon big enough for use as a home screen icon.
|
||||
Favicons.getPreferredSizeFaviconForPage(info.url, new GeckoAppShell.CreateShortcutFaviconLoadedListener(info.url, info.getDisplayTitle()));
|
||||
Favicons.getPreferredSizeFaviconForPage(context, info.url, new GeckoAppShell.CreateShortcutFaviconLoadedListener(info.url, info.getDisplayTitle()));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -544,7 +544,7 @@ public class TopSitesPanel extends HomeFragment {
|
||||
|
||||
// If we have no thumbnail, attempt to show a Favicon instead.
|
||||
LoadIDAwareFaviconLoadedListener listener = new LoadIDAwareFaviconLoadedListener(view);
|
||||
final int loadId = Favicons.getSizedFaviconForPageFromLocal(url, listener);
|
||||
final int loadId = Favicons.getSizedFaviconForPageFromLocal(context, url, listener);
|
||||
if (loadId == Favicons.LOADED) {
|
||||
// Great!
|
||||
return;
|
||||
|
@ -50,6 +50,11 @@ public class TwoLinePageRow extends LinearLayout
|
||||
this.view = new WeakReference<FaviconView>(view);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update this row's favicon.
|
||||
* <p>
|
||||
* This method is always invoked on the UI thread.
|
||||
*/
|
||||
@Override
|
||||
public void onFaviconLoaded(String url, String faviconURL, Bitmap favicon) {
|
||||
FaviconView v = view.get();
|
||||
@ -96,24 +101,49 @@ public class TwoLinePageRow extends LinearLayout
|
||||
|
||||
@Override
|
||||
protected void onAttachedToWindow() {
|
||||
super.onAttachedToWindow();
|
||||
|
||||
Tabs.registerOnTabsChangedListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow();
|
||||
|
||||
// Tabs' listener array is safe to modify during use: its
|
||||
// iteration pattern is based on snapshots.
|
||||
Tabs.unregisterOnTabsChangedListener(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the row in response to a tab change event.
|
||||
* <p>
|
||||
* This method is always invoked on the UI thread.
|
||||
*/
|
||||
@Override
|
||||
public void onTabChanged(final Tab tab, final Tabs.TabEvents msg, final Object data) {
|
||||
switch(msg) {
|
||||
// Carefully check if this tab event is relevant to this row.
|
||||
final String pageUrl = mPageUrl;
|
||||
if (pageUrl == null) {
|
||||
return;
|
||||
}
|
||||
final String tabUrl;
|
||||
if (tab == null) {
|
||||
return;
|
||||
}
|
||||
tabUrl = tab.getURL();
|
||||
if (!pageUrl.equals(tabUrl)) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (msg) {
|
||||
case ADDED:
|
||||
case CLOSED:
|
||||
case LOCATION_CHANGE:
|
||||
updateDisplayedUrl();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -181,32 +211,29 @@ public class TwoLinePageRow extends LinearLayout
|
||||
mShowIcons = showIcons;
|
||||
}
|
||||
|
||||
public void updateFromCursor(Cursor cursor) {
|
||||
if (cursor == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
int titleIndex = cursor.getColumnIndexOrThrow(URLColumns.TITLE);
|
||||
final String title = cursor.getString(titleIndex);
|
||||
|
||||
int urlIndex = cursor.getColumnIndexOrThrow(URLColumns.URL);
|
||||
final String url = cursor.getString(urlIndex);
|
||||
/**
|
||||
* Update the data displayed by this row.
|
||||
* <p>
|
||||
* This method must be invoked on the UI thread.
|
||||
*
|
||||
* @param title to display.
|
||||
* @param url to display.
|
||||
*/
|
||||
public void update(String title, String url) {
|
||||
update(title, url, 0);
|
||||
}
|
||||
|
||||
protected void update(String title, String url, long bookmarkId) {
|
||||
if (mShowIcons) {
|
||||
final int bookmarkIdIndex = cursor.getColumnIndex(Combined.BOOKMARK_ID);
|
||||
if (bookmarkIdIndex != -1) {
|
||||
final long bookmarkId = cursor.getLong(bookmarkIdIndex);
|
||||
|
||||
// The bookmark id will be 0 (null in database) when the url
|
||||
// is not a bookmark.
|
||||
if (bookmarkId == 0) {
|
||||
setPageTypeIcon(NO_ICON);
|
||||
} else {
|
||||
setPageTypeIcon(R.drawable.ic_url_bar_star);
|
||||
}
|
||||
} else {
|
||||
// The bookmark id will be 0 (null in database) when the url
|
||||
// is not a bookmark.
|
||||
if (bookmarkId == 0) {
|
||||
setPageTypeIcon(NO_ICON);
|
||||
} else {
|
||||
setPageTypeIcon(R.drawable.ic_url_bar_star);
|
||||
}
|
||||
} else {
|
||||
setPageTypeIcon(NO_ICON);
|
||||
}
|
||||
|
||||
// Use the URL instead of an empty title for consistency with the normal URL
|
||||
@ -220,8 +247,38 @@ public class TwoLinePageRow extends LinearLayout
|
||||
|
||||
// Blank the Favicon, so we don't show the wrong Favicon if we scroll and miss DB.
|
||||
mFavicon.clearImage();
|
||||
mLoadFaviconJobId = Favicons.getSizedFaviconForPageFromLocal(url, mFaviconListener);
|
||||
Favicons.cancelFaviconLoad(mLoadFaviconJobId);
|
||||
mLoadFaviconJobId = Favicons.getSizedFaviconForPageFromLocal(getContext(), url, mFaviconListener);
|
||||
|
||||
updateDisplayedUrl(url);
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the data displayed by this row.
|
||||
* <p>
|
||||
* This method must be invoked on the UI thread.
|
||||
*
|
||||
* @param cursor to extract data from.
|
||||
*/
|
||||
public void updateFromCursor(Cursor cursor) {
|
||||
if (cursor == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
int titleIndex = cursor.getColumnIndexOrThrow(URLColumns.TITLE);
|
||||
final String title = cursor.getString(titleIndex);
|
||||
|
||||
int urlIndex = cursor.getColumnIndexOrThrow(URLColumns.URL);
|
||||
final String url = cursor.getString(urlIndex);
|
||||
|
||||
final long bookmarkId;
|
||||
final int bookmarkIdIndex = cursor.getColumnIndex(Combined.BOOKMARK_ID);
|
||||
if (bookmarkIdIndex != -1) {
|
||||
bookmarkId = cursor.getLong(bookmarkIdIndex);
|
||||
} else {
|
||||
bookmarkId = 0;
|
||||
}
|
||||
|
||||
update(title, url, bookmarkId);
|
||||
}
|
||||
}
|
||||
|
@ -194,6 +194,8 @@ gbjar.sources += [
|
||||
'GeckoBatteryManager.java',
|
||||
'GeckoConnectivityReceiver.java',
|
||||
'GeckoEditable.java',
|
||||
'GeckoEditableClient.java',
|
||||
'GeckoEditableListener.java',
|
||||
'GeckoEvent.java',
|
||||
'GeckoHalDefines.java',
|
||||
'GeckoInputConnection.java',
|
||||
@ -518,6 +520,7 @@ moz_native_devices_jars = [
|
||||
]
|
||||
moz_native_devices_sources = [
|
||||
'ChromeCast.java',
|
||||
'GeckoMediaPlayer.java',
|
||||
'MediaPlayerManager.java',
|
||||
]
|
||||
if CONFIG['MOZ_NATIVE_DEVICES']:
|
||||
|
@ -192,4 +192,9 @@ public class CollectionKeys {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return super.hashCode();
|
||||
}
|
||||
}
|
||||
|
@ -112,6 +112,11 @@ public class ClientRecord extends Record {
|
||||
return this.equalPayloads(o);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return super.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equalPayloads(Object o) {
|
||||
if (!(o instanceof ClientRecord) || !super.equalPayloads(o)) {
|
||||
|
@ -49,6 +49,7 @@ public class SearchEngine {
|
||||
|
||||
private String identifier;
|
||||
private String shortName;
|
||||
private String iconURL;
|
||||
|
||||
// TODO: Make something more robust (like EngineURL in nsSearchService.js)
|
||||
private Uri resultsUri;
|
||||
@ -79,8 +80,8 @@ public class SearchEngine {
|
||||
readShortName(parser);
|
||||
} else if (tag.equals("Url")) {
|
||||
readUrl(parser);
|
||||
// TODO: Support for other tags
|
||||
//} else if (tag.equals("Image")) {
|
||||
} else if (tag.equals("Image")) {
|
||||
readImage(parser);
|
||||
} else {
|
||||
skip(parser);
|
||||
}
|
||||
@ -129,6 +130,19 @@ public class SearchEngine {
|
||||
}
|
||||
}
|
||||
|
||||
private void readImage(XmlPullParser parser) throws XmlPullParserException, IOException {
|
||||
parser.require(XmlPullParser.START_TAG, null, "Image");
|
||||
|
||||
// TODO: Use width and height to get a preferred icon URL.
|
||||
//final int width = Integer.parseInt(parser.getAttributeValue(null, "width"));
|
||||
//final int height = Integer.parseInt(parser.getAttributeValue(null, "height"));
|
||||
|
||||
if (parser.next() == XmlPullParser.TEXT) {
|
||||
iconURL = parser.getText();
|
||||
parser.nextTag();
|
||||
}
|
||||
}
|
||||
|
||||
private void skip(XmlPullParser parser) throws XmlPullParserException, IOException {
|
||||
if (parser.getEventType() != XmlPullParser.START_TAG) {
|
||||
throw new IllegalStateException();
|
||||
@ -176,6 +190,10 @@ public class SearchEngine {
|
||||
return shortName;
|
||||
}
|
||||
|
||||
public String getIconURL() {
|
||||
return iconURL;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether a particular url belongs to this search engine. If not,
|
||||
* the url will be sent to Fennec.
|
||||
|
@ -22,6 +22,6 @@
|
||||
|
||||
<instrumentation
|
||||
android:label="@string/app_name"
|
||||
android:name="org.mozilla.gecko.browser.harness.BrowserInstrumentationTestRunner"
|
||||
android:name="org.mozilla.gecko.harness.BrowserInstrumentationTestRunner"
|
||||
android:targetPackage="@ANDROID_BROWSER_TARGET_PACKAGE_NAME@" />
|
||||
</manifest>
|
||||
|
@ -8,16 +8,16 @@ DEFINES['ANDROID_PACKAGE_NAME'] = CONFIG['ANDROID_PACKAGE_NAME']
|
||||
|
||||
jar = add_java_jar('browser-junit3')
|
||||
jar.sources += [
|
||||
'src/BrowserTestCase.java',
|
||||
'src/harness/BrowserInstrumentationTestRunner.java',
|
||||
'src/harness/BrowserTestListener.java',
|
||||
'src/tests/BrowserTestCase.java',
|
||||
'src/tests/TestDistribution.java',
|
||||
'src/tests/TestGeckoSharedPrefs.java',
|
||||
'src/tests/TestImageDownloader.java',
|
||||
'src/tests/TestJarReader.java',
|
||||
'src/tests/TestRawResource.java',
|
||||
'src/tests/TestSuggestedSites.java',
|
||||
'src/tests/TestTopSitesCursorWrapper.java',
|
||||
'src/TestDistribution.java',
|
||||
'src/TestGeckoSharedPrefs.java',
|
||||
'src/TestImageDownloader.java',
|
||||
'src/TestJarReader.java',
|
||||
'src/TestRawResource.java',
|
||||
'src/TestSuggestedSites.java',
|
||||
'src/TestTopSitesCursorWrapper.java',
|
||||
]
|
||||
jar.generated_sources = [] # None yet -- try to keep it this way.
|
||||
jar.javac_flags += ['-Xlint:all,-unchecked']
|
||||
@ -36,4 +36,4 @@ main.recursive_make_targets += [OBJDIR + '/generated/' + f for f in jar.generate
|
||||
main.referenced_projects += ['Fennec']
|
||||
|
||||
main.add_classpathentry('src', SRCDIR + '/src',
|
||||
dstdir='src/org/mozilla/gecko/browser')
|
||||
dstdir='src/org/mozilla/gecko')
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
package org.mozilla.gecko.browser.tests;
|
||||
package org.mozilla.gecko;
|
||||
|
||||
import org.mozilla.gecko.AppConstants;
|
||||
|
@ -2,7 +2,7 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
package org.mozilla.gecko.browser.tests;
|
||||
package org.mozilla.gecko;
|
||||
|
||||
import org.mozilla.gecko.distribution.ReferrerDescriptor;
|
||||
|
@ -2,7 +2,7 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
package org.mozilla.gecko.browser.tests;
|
||||
package org.mozilla.gecko;
|
||||
|
||||
import org.mozilla.gecko.AppConstants;
|
||||
import org.mozilla.gecko.menu.GeckoMenu;
|
@ -2,7 +2,7 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
package org.mozilla.gecko.browser.tests;
|
||||
package org.mozilla.gecko;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
@ -1,23 +1,19 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
package org.mozilla.gecko.browser.tests;
|
||||
package org.mozilla.gecko;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumSet;
|
||||
import java.util.Map;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.mozilla.gecko.GeckoProfile;
|
||||
import org.mozilla.gecko.GeckoSharedPrefs;
|
||||
import org.mozilla.gecko.GeckoSharedPrefs.Flags;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.SharedPreferences.Editor;
|
||||
import android.os.Build;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.test.RenamingDelegatingContext;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
package org.mozilla.gecko.browser.tests;
|
||||
package org.mozilla.gecko;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
@ -1,7 +1,7 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
package org.mozilla.gecko.browser.tests;
|
||||
package org.mozilla.gecko;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
@ -1,19 +1,18 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
package org.mozilla.gecko.browser.tests;
|
||||
package org.mozilla.gecko;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.mozilla.gecko.util.RawResource;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.test.mock.MockContext;
|
||||
import android.test.mock.MockResources;
|
||||
import android.util.TypedValue;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.mozilla.gecko.util.RawResource;
|
||||
|
||||
/**
|
||||
* Tests whether RawResource.getAsString() produces the right String
|
||||
@ -64,4 +63,4 @@ public class TestRawResource extends BrowserTestCase {
|
||||
|
||||
assertEquals(RAW_CONTENTS, result);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,48 +1,40 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
package org.mozilla.gecko.browser.tests;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.res.Resources;
|
||||
import android.content.SharedPreferences;
|
||||
import android.database.Cursor;
|
||||
import android.database.ContentObserver;
|
||||
import android.net.Uri;
|
||||
import android.os.Handler;
|
||||
import android.os.SystemClock;
|
||||
import android.test.mock.MockResources;
|
||||
import android.test.RenamingDelegatingContext;
|
||||
package org.mozilla.gecko;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URI;
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.jar.JarInputStream;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import org.mozilla.gecko.BrowserLocaleManager;
|
||||
import org.mozilla.gecko.R;
|
||||
import org.mozilla.gecko.db.BrowserContract;
|
||||
import org.mozilla.gecko.db.SuggestedSites;
|
||||
import org.mozilla.gecko.distribution.Distribution;
|
||||
import org.mozilla.gecko.GeckoSharedPrefs;
|
||||
import org.mozilla.gecko.preferences.GeckoPreferences;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.content.res.Resources;
|
||||
import android.database.ContentObserver;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.os.SystemClock;
|
||||
import android.test.RenamingDelegatingContext;
|
||||
import android.test.mock.MockResources;
|
||||
|
||||
public class TestSuggestedSites extends BrowserTestCase {
|
||||
private static class TestContext extends RenamingDelegatingContext {
|
||||
private static final String PREFIX = "TestSuggestedSites-";
|
||||
@ -94,12 +86,10 @@ public class TestSuggestedSites extends BrowserTestCase {
|
||||
}
|
||||
|
||||
private static class TestDistribution extends Distribution {
|
||||
private final Context context;
|
||||
private final Map<Locale, File> filesPerLocale;
|
||||
|
||||
public TestDistribution(Context context) {
|
||||
super(context);
|
||||
this.context = context;
|
||||
this.filesPerLocale = new HashMap<Locale, File>();
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
package org.mozilla.gecko.browser.tests;
|
||||
package org.mozilla.gecko;
|
||||
|
||||
import android.database.Cursor;
|
||||
import android.database.MatrixCursor;
|
||||
@ -385,4 +385,4 @@ public class TestTopSitesCursorWrapper extends BrowserTestCase {
|
||||
|
||||
c.close();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +1,7 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
package org.mozilla.gecko.browser.harness;
|
||||
package org.mozilla.gecko.harness;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.test.AndroidTestRunner;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
package org.mozilla.gecko.browser.harness;
|
||||
package org.mozilla.gecko.harness;
|
||||
|
||||
import junit.framework.AssertionFailedError;
|
||||
import junit.framework.Test;
|
||||
|
@ -254,19 +254,13 @@ Submitter.prototype = {
|
||||
}
|
||||
let serverURL = this.extraKeyVals.ServerURL;
|
||||
|
||||
// Override the submission URL from the environment or prefs.
|
||||
// Override the submission URL from the environment
|
||||
|
||||
var envOverride = Cc['@mozilla.org/process/environment;1'].
|
||||
getService(Ci.nsIEnvironment).get("MOZ_CRASHREPORTER_URL");
|
||||
if (envOverride != '') {
|
||||
serverURL = envOverride;
|
||||
}
|
||||
else if ('PluginHang' in this.extraKeyVals) {
|
||||
try {
|
||||
serverURL = Services.prefs.
|
||||
getCharPref("toolkit.crashreporter.pluginHangSubmitURL");
|
||||
} catch(e) { }
|
||||
}
|
||||
|
||||
let xhr = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]
|
||||
.createInstance(Ci.nsIXMLHttpRequest);
|
||||
|
@ -193,8 +193,8 @@ Connection.prototype = {
|
||||
return;
|
||||
}
|
||||
if (!this._client) {
|
||||
this._transport = transport;
|
||||
if (this._transport) {
|
||||
this._customTransport = transport;
|
||||
if (this._customTransport) {
|
||||
this.log("connecting (custom transport)");
|
||||
} else {
|
||||
this.log("connecting to " + this.host + ":" + this.port);
|
||||
@ -223,12 +223,15 @@ Connection.prototype = {
|
||||
},
|
||||
|
||||
_clientConnect: function () {
|
||||
if (!this._transport) {
|
||||
let transport;
|
||||
if (this._customTransport) {
|
||||
transport = this._customTransport;
|
||||
} else {
|
||||
if (!this.host) {
|
||||
this._transport = DebuggerServer.connectPipe();
|
||||
transport = DebuggerServer.connectPipe();
|
||||
} else {
|
||||
try {
|
||||
this._transport = debuggerSocketConnect(this.host, this.port);
|
||||
transport = debuggerSocketConnect(this.host, this.port);
|
||||
} catch (e) {
|
||||
// In some cases, especially on Mac, the openOutputStream call in
|
||||
// debuggerSocketConnect may throw NS_ERROR_NOT_INITIALIZED.
|
||||
@ -240,7 +243,7 @@ Connection.prototype = {
|
||||
}
|
||||
}
|
||||
}
|
||||
this._client = new DebuggerClient(this._transport);
|
||||
this._client = new DebuggerClient(transport);
|
||||
this._client.addOneTimeListener("closed", this._onDisconnected);
|
||||
this._client.connect(this._onConnected);
|
||||
},
|
||||
@ -259,6 +262,7 @@ Connection.prototype = {
|
||||
|
||||
_onDisconnected: function() {
|
||||
this._client = null;
|
||||
this._customTransport = null;
|
||||
|
||||
if (this._status == Connection.Status.CONNECTING && this.keepConnecting) {
|
||||
setTimeout(() => this._clientConnect(), 100);
|
||||
|
@ -37,8 +37,8 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
nsresult RegisterForSleepWakeNotifcations();
|
||||
void RemoveSleepWakeNotifcations();
|
||||
nsresult RegisterForSleepWakeNotifications();
|
||||
void RemoveSleepWakeNotifications();
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -48,13 +48,13 @@ nsToolkit::nsToolkit()
|
||||
, mEventTapRLS(nullptr)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsToolkit);
|
||||
RegisterForSleepWakeNotifcations();
|
||||
RegisterForSleepWakeNotifications();
|
||||
}
|
||||
|
||||
nsToolkit::~nsToolkit()
|
||||
{
|
||||
MOZ_COUNT_DTOR(nsToolkit);
|
||||
RemoveSleepWakeNotifcations();
|
||||
RemoveSleepWakeNotifications();
|
||||
UnregisterAllProcessMouseEventHandlers();
|
||||
}
|
||||
|
||||
@ -98,7 +98,7 @@ static void ToolkitSleepWakeCallback(void *refCon, io_service_t service, natural
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsToolkit::RegisterForSleepWakeNotifcations()
|
||||
nsToolkit::RegisterForSleepWakeNotifications()
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
@ -123,7 +123,7 @@ nsToolkit::RegisterForSleepWakeNotifcations()
|
||||
}
|
||||
|
||||
void
|
||||
nsToolkit::RemoveSleepWakeNotifcations()
|
||||
nsToolkit::RemoveSleepWakeNotifications()
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user