Merge b2ginbound to central, a=merge

This commit is contained in:
Wes Kocher 2015-10-05 13:09:32 -07:00
commit ca45c06709
26 changed files with 250 additions and 57 deletions

View File

@ -313,30 +313,48 @@ setUpdateTrackingId();
// modify them, that's where we need to make our changes.
let defaultBranch = Services.prefs.getDefaultBranch(null);
function syncCharPref(prefName) {
SettingsListener.observe(prefName, null, function(value) {
// If set, propagate setting value to pref.
if (value) {
defaultBranch.setCharPref(prefName, value);
function syncPrefDefault(prefName) {
// The pref value at boot-time will serve as default for the setting.
let defaultValue = defaultBranch.getCharPref(prefName);
let defaultSetting = {};
defaultSetting[prefName] = defaultValue;
// We back up that value in order to detect pref changes across reboots.
// Such a change can happen e.g. when the user installs an OTA update that
// changes the update URL format.
let backupName = prefName + '.old';
try {
// Everything relies on the comparison below: When pushing a new Gecko
// that changes app.update.url or app.update.channel, we overwrite any
// existing setting with the new pref value.
let backupValue = Services.prefs.getCharPref(backupName);
if (defaultValue !== backupValue) {
// If the pref has changed since our last backup, overwrite the setting.
navigator.mozSettings.createLock().set(defaultSetting);
}
} catch(e) {
// There was no backup: Overwrite the setting and create a backup below.
navigator.mozSettings.createLock().set(defaultSetting);
}
// Initialize or update the backup value.
Services.prefs.setCharPref(backupName, defaultValue);
// Propagate setting changes to the pref.
SettingsListener.observe(prefName, defaultValue, value => {
if (!value) {
// If the setting value is invalid, reset it to its default.
navigator.mozSettings.createLock().set(defaultSetting);
return;
}
// If unset, initialize setting to pref value.
try {
let value = defaultBranch.getCharPref(prefName);
if (value) {
let setting = {};
setting[prefName] = value;
window.navigator.mozSettings.createLock().set(setting);
}
} catch(e) {
console.log('Unable to read pref ' + prefName + ': ' + e);
}
// Here we will overwrite the pref with the setting value.
defaultBranch.setCharPref(prefName, value);
});
}
syncCharPref(AppConstants.MOZ_B2GDROID ? 'app.update.url.android'
: 'app.update.url');
syncCharPref('app.update.channel');
syncPrefDefault(AppConstants.MOZ_B2GDROID ? 'app.update.url.android'
: 'app.update.url');
syncPrefDefault('app.update.channel');
})();
// ================ Debug ================

View File

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

View File

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

View File

@ -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="b994cedaa7ef9bfadcbe841601d9dc8d2e5379f9"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="1f226126dcba8af16c8db08556130b0bb04bb8d3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="27eb2f04e149fc2c9976d881b1b5984bbe7ee089"/>

View File

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="b994cedaa7ef9bfadcbe841601d9dc8d2e5379f9"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="1f226126dcba8af16c8db08556130b0bb04bb8d3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="31a7849fe9a8b743d6f5e5facc212f0ef9d57499"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f004530b30a63c08a16d82536858600446b2abf5"/>

View File

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

View File

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

View File

@ -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="b994cedaa7ef9bfadcbe841601d9dc8d2e5379f9"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="1f226126dcba8af16c8db08556130b0bb04bb8d3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="27eb2f04e149fc2c9976d881b1b5984bbe7ee089"/>

View File

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

View File

@ -1,9 +1,9 @@
{
"git": {
"git_revision": "b994cedaa7ef9bfadcbe841601d9dc8d2e5379f9",
"git_revision": "1f226126dcba8af16c8db08556130b0bb04bb8d3",
"remote": "https://git.mozilla.org/releases/gaia.git",
"branch": ""
},
"revision": "2112488412d044b4b466f97e4e268b0f73a3c862",
"revision": "44cf4f0a2b14c88e117d9c8cf76779d0a7c26999",
"repo_path": "integration/gaia-central"
}

View File

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

View File

@ -18,7 +18,7 @@
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="b994cedaa7ef9bfadcbe841601d9dc8d2e5379f9"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="1f226126dcba8af16c8db08556130b0bb04bb8d3"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="7e0fe55ac52323eace5a6119ab2b911fc4f64495"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="31a7849fe9a8b743d6f5e5facc212f0ef9d57499"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f004530b30a63c08a16d82536858600446b2abf5"/>

View File

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

View File

@ -63,8 +63,7 @@ function hasExpectedFlavors() {
cb.kGlobalClipboard);
}
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(function nextTest() {
function nextTest() {
var div = document.querySelector("#content>div");
if (!div) {
SimpleTest.finish();
@ -85,6 +84,11 @@ SimpleTest.waitForFocus(function nextTest() {
ok(false, "failed to copy the expected content to the clipboard");
SimpleTest.finish();
});
}
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(function() {
SpecialPowers.pushPrefEnv({"set": [["clipboard.plainTextOnly", false]]}, nextTest);
});
</script>

View File

@ -77,7 +77,9 @@ function testCopyImage () {
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(testCopyImage);
addLoadEvent(function() {
SpecialPowers.pushPrefEnv({"set": [["clipboard.plainTextOnly", false]]}, testCopyImage);
});
</script>
</pre>

View File

@ -837,6 +837,10 @@ function cleanUp() {
function startBluetoothTestBase(aPermissions, aTestCaseMain) {
ensureBluetoothManager(aPermissions)
.then(function() {
log("Wait for creating bluetooth adapter...");
return waitForManagerStateChanged(bluetoothManager);
})
.then(aTestCaseMain)
.then(cleanUp, function() {
ok(false, "Unhandled rejected promise.");
@ -885,3 +889,22 @@ function startBluetoothTest(aReenable, aTestCaseMain) {
});
});
}
function waitForManagerStateChanged(aManager) {
let deferred = Promise.defer();
aManager.onattributechanged = function(evt) {
for (var i in evt.attrs) {
switch (evt.attrs[i]) {
case 'defaultAdapter':
deferred.resolve(evt);
break;
default:
break;
}
}
}
return deferred.promise;
}

View File

@ -6,15 +6,21 @@ qemu = false
# Hint: "disabled = xxxxx" statement should be added *below* the test that
# we want to disable.
[test_dom_BluetoothManager_API2.js]
[test_dom_BluetoothManager.js]
disabled = Bug 1175389
[test_dom_BluetoothAdapter_enable_API2.js]
[test_dom_BluetoothAdapter_enable.js]
disabled = Bug 1175389
[test_dom_BluetoothAdapter_setters_API2.js]
[test_dom_BluetoothAdapter_setters.js]
disabled = Bug 1175389
[test_dom_BluetoothAdapter_discovery_API2.js]
[test_dom_BluetoothDevice.js]
disabled = Bug 1175389
[test_dom_BluetoothDevice_API2.js]
[test_dom_BluetoothAdapter_discovery.js]
disabled = Bug 1175389
[test_dom_BluetoothAdapter_pair_API2.js]
[test_dom_BluetoothAdapter_pair.js]
disabled = Bug 1175389

View File

@ -869,6 +869,7 @@ BrowserElementChild.prototype = {
var elem = e.target;
var menuData = {systemTargets: [], contextmenu: null};
var ctxMenuId = null;
var clipboardPlainTextOnly = Services.prefs.getBoolPref('clipboard.plainTextOnly');
var copyableElements = {
image: false,
link: false,
@ -896,7 +897,7 @@ BrowserElementChild.prototype = {
// Enable copy image/link option
if (elem.nodeName == 'IMG') {
copyableElements.image = true;
copyableElements.image = !clipboardPlainTextOnly;
} else if (elem.nodeName == 'A') {
copyableElements.link = true;
}

View File

@ -57,6 +57,10 @@ const browserElementTestHelpers = {
);
},
setClipboardPlainTextOnlyPref: function(value) {
this._setPref('clipboard.plainTextOnly', value);
},
setEnabledPref: function(value) {
this._setPref('dom.mozBrowserFramesEnabled', value);
},

View File

@ -2,6 +2,7 @@
SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.setClipboardPlainTextOnlyPref(false);
browserElementTestHelpers.addPermission();
var audioUrl = 'http://mochi.test:8888/tests/dom/browser-element/mochitest/audio.ogg';

View File

@ -4099,8 +4099,11 @@ MobileMessageDB.prototype = {
* @param {boolean} value
* The updated <code>read</code> value.
* @param {boolean} aSendReadReport
* <code>true</code> to update the <code>isReadReportSent</code>
* property if the message is MMS.
* <code>true</code> to reply the read report of an incoming MMS
* message whose <code>isReadReportSent</code> is 'false'.
* Note: <code>isReadReportSent</code> will be set to 'true' no
* matter aSendReadReport is true or not when a message was marked
* from UNREAD to READ. See bug 1180470 for the new UX policy.
* @param {nsIMobileMessageCallback} aRequest
* The callback object.
*/
@ -4153,17 +4156,18 @@ MobileMessageDB.prototype = {
messageRecord.read = value ? FILTER_READ_READ : FILTER_READ_UNREAD;
messageRecord.readIndex = [messageRecord.read, messageRecord.timestamp];
let readReportMessageId, readReportTo;
if (aSendReadReport &&
messageRecord.type == "mms" &&
if (messageRecord.type == "mms" &&
messageRecord.delivery == DELIVERY_RECEIVED &&
messageRecord.read == FILTER_READ_READ &&
messageRecord.headers["x-mms-read-report"] &&
!messageRecord.isReadReportSent) {
messageRecord.isReadReportSent = true;
let from = messageRecord.headers["from"];
readReportTo = from && from.address;
readReportMessageId = messageRecord.headers["message-id"];
if (aSendReadReport) {
let from = messageRecord.headers["from"];
readReportTo = from && from.address;
readReportMessageId = messageRecord.headers["message-id"];
}
}
if (DEBUG) debug("Message.read set to: " + value);

View File

@ -35,6 +35,10 @@ XPCOMUtils.defineLazyServiceGetter(this, "gPACGenerator",
"@mozilla.org/pac-generator;1",
"nsIPACGenerator");
XPCOMUtils.defineLazyServiceGetter(this, "gTetheringService",
"@mozilla.org/tethering/service;1",
"nsITetheringService");
const TOPIC_INTERFACE_REGISTERED = "network-interface-registered";
const TOPIC_INTERFACE_UNREGISTERED = "network-interface-unregistered";
const TOPIC_ACTIVE_CHANGED = "network-active-changed";
@ -855,7 +859,9 @@ NetworkManager.prototype = {
}
if (this._manageOfflineStatus) {
Services.io.offline = !anyConnected;
Services.io.offline = !anyConnected &&
(gTetheringService.state ===
Ci.nsITetheringService.TETHERING_STATE_INACTIVE);
}
});
},

View File

@ -43,6 +43,7 @@ const TOPIC_MOZSETTINGS_CHANGED = "mozsettings-changed";
const TOPIC_CONNECTION_STATE_CHANGED = "network-connection-state-changed";
const TOPIC_PREF_CHANGED = "nsPref:changed";
const TOPIC_XPCOM_SHUTDOWN = "xpcom-shutdown";
const PREF_MANAGE_OFFLINE_STATUS = "network.gonk.manage-offline-status";
const PREF_NETWORK_DEBUG_ENABLED = "network.debugging.enabled";
const POSSIBLE_USB_INTERFACE_NAME = "rndis0,usb0";
@ -125,6 +126,14 @@ function TetheringService() {
Services.obs.addObserver(this, TOPIC_MOZSETTINGS_CHANGED, false);
Services.obs.addObserver(this, TOPIC_CONNECTION_STATE_CHANGED, false);
Services.prefs.addObserver(PREF_NETWORK_DEBUG_ENABLED, this, false);
Services.prefs.addObserver(PREF_MANAGE_OFFLINE_STATUS, this, false);
try {
this._manageOfflineStatus =
Services.prefs.getBoolPref(PREF_MANAGE_OFFLINE_STATUS);
} catch(ex) {
// Ignore.
}
this._dataDefaultServiceId = 0;
@ -230,6 +239,12 @@ TetheringService.prototype = {
// Arguments for pending wifi tethering request.
_pendingWifiTetheringRequestArgs: null,
// The state of tethering.
state: Ci.nsITetheringService.TETHERING_STATE_INACTIVE,
// Flag to check if we can modify the Services.io.offline.
_manageOfflineStatus: true,
// nsIObserver
observe: function(aSubject, aTopic, aData) {
@ -258,10 +273,19 @@ TetheringService.prototype = {
Services.obs.removeObserver(this, TOPIC_MOZSETTINGS_CHANGED);
Services.obs.removeObserver(this, TOPIC_CONNECTION_STATE_CHANGED);
Services.prefs.removeObserver(PREF_NETWORK_DEBUG_ENABLED, this);
Services.prefs.removeObserver(PREF_MANAGE_OFFLINE_STATUS, this);
this.dunConnectTimer.cancel();
this.dunRetryTimer.cancel();
break;
case PREF_MANAGE_OFFLINE_STATUS:
try {
this._manageOfflineStatus =
Services.prefs.getBoolPref(PREF_MANAGE_OFFLINE_STATUS);
} catch(ex) {
// Ignore.
}
break;
}
},
@ -582,10 +606,31 @@ TetheringService.prototype = {
this._wifiTetheringRequestOngoing = true;
gNetworkService.setWifiTethering(aEnable, aConfig, (aError) => {
// Disconnect dun on error or when wifi tethering is disabled.
if (this.tetheringSettings[SETTINGS_DUN_REQUIRED] &&
(!aEnable || aError)) {
this.handleDunConnection(false);
// Change the tethering state to WIFI if there is no error.
if (aEnable && !aError) {
this.state = Ci.nsITetheringService.TETHERING_STATE_WIFI;
} else {
// If wifi thethering is disable, or any error happens,
// then consider the following statements.
// Check whether the state is USB now or not. If no then just change
// it to INACTIVE, if yes then just keep it.
// It means that don't let the disable or error of WIFI affect
// the original active state.
if (this.state != Ci.nsITetheringService.TETHERING_STATE_USB) {
this.state = Ci.nsITetheringService.TETHERING_STATE_INACTIVE;
}
// Disconnect dun on error or when wifi tethering is disabled.
if (this.tetheringSettings[SETTINGS_DUN_REQUIRED]) {
this.handleDunConnection(false);
}
}
if (this._manageOfflineStatus) {
Services.io.offline = !this.isAnyConnected() &&
(this.state ===
Ci.nsITetheringService.TETHERING_STATE_INACTIVE);
}
let resetSettings = aError;
@ -720,19 +765,36 @@ TetheringService.prototype = {
// Skip others request when we found an error.
this._usbTetheringRequestCount = 0;
this._usbTetheringAction = TETHERING_STATE_IDLE;
// If the thethering state is WIFI now, then just keep it,
// if not, just change the state to INACTIVE.
// It means that don't let the error of USB affect the original active state.
if (this.state != Ci.nsITetheringService.TETHERING_STATE_WIFI) {
this.state = Ci.nsITetheringService.TETHERING_STATE_INACTIVE;
}
if (this.tetheringSettings[SETTINGS_DUN_REQUIRED]) {
this.handleDunConnection(false);
}
} else {
if (aEnable) {
this._usbTetheringAction = TETHERING_STATE_ACTIVE;
this.state = Ci.nsITetheringService.TETHERING_STATE_USB;
} else {
this._usbTetheringAction = TETHERING_STATE_IDLE;
// If the state is now WIFI, don't let the disable of USB affect it.
if (this.state != Ci.nsITetheringService.TETHERING_STATE_WIFI) {
this.state = Ci.nsITetheringService.TETHERING_STATE_INACTIVE;
}
if (this.tetheringSettings[SETTINGS_DUN_REQUIRED]) {
this.handleDunConnection(false);
}
}
if (this._manageOfflineStatus) {
Services.io.offline = !this.isAnyConnected() &&
(this.state ===
Ci.nsITetheringService.TETHERING_STATE_INACTIVE);
}
this.handleLastUsbTetheringRequest();
}
},
@ -812,6 +874,17 @@ TetheringService.prototype = {
callback.call(this);
},
isAnyConnected: function() {
let allNetworkInfo = gNetworkManager.allNetworkInfo;
for (let networkId in allNetworkInfo) {
if (allNetworkInfo.hasOwnProperty(networkId) &&
allNetworkInfo[networkId].state === Ci.nsINetworkInfo.NETWORK_STATE_CONNECTED) {
return true;
}
}
return false;
},
};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([TetheringService]);

View File

@ -7,11 +7,20 @@
interface nsINetworkInterface;
interface nsIWifiTetheringCallback;
[scriptable, uuid(993b79df-f10e-4697-a5dc-5981cf8ff7e6)]
[scriptable, uuid(779de2d3-6d29-4ee6-b069-6251839f757a)]
interface nsITetheringService : nsISupports
{
const long TETHERING_STATE_INACTIVE = 0;
const long TETHERING_STATE_WIFI = 1;
const long TETHERING_STATE_USB = 2;
/**
* Enable or disable Wifi Tethering
* Current tethering state. One of the TETHERING_STATE_* constants.
*/
readonly attribute long state;
/**
* Enable or disable Wifi Tethering.
*
* @param enabled
* Boolean that indicates whether tethering should be enabled (true) or

View File

@ -2006,6 +2006,9 @@ pref("middlemouse.scrollbarPosition", false);
// Clipboard behavior
pref("clipboard.autocopy", false);
// Clipboard only supports text/plain
pref("clipboard.plainTextOnly", false);
// mouse wheel scroll transaction period of time (in milliseconds)
pref("mousewheel.transaction.timeout", 1500);
// mouse wheel scroll transaction is held even if the mouse cursor is moved.

View File

@ -10,6 +10,7 @@
#include "imgIContainer.h"
#include "imgTools.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/Preferences.h"
#include "nsClipboardProxy.h"
#include "nsISupportsPrimitives.h"
#include "nsComponentManagerUtils.h"
@ -48,9 +49,29 @@ nsClipboard::SetData(nsITransferable *aTransferable,
return clipboardProxy->SetData(aTransferable, anOwner, aWhichClipboard);
}
// Clear out the clipboard in order to set the new data
// Clear out the clipboard in order to set the new data.
EmptyClipboard(aWhichClipboard);
// Use a pref to toggle rich text/non-text support.
if (Preferences::GetBool("clipboard.plainTextOnly")) {
nsCOMPtr<nsISupports> clip;
uint32_t len;
nsresult rv = aTransferable->GetTransferData(kUnicodeMime,
getter_AddRefs(clip),
&len);
if (NS_FAILED(rv)) {
return rv;
}
nsCOMPtr<nsISupportsString> wideString = do_QueryInterface(clip);
if (!wideString) {
return NS_ERROR_NOT_IMPLEMENTED;
}
nsAutoString utf16string;
wideString->GetData(utf16string);
mClipboard->SetText(utf16string);
return NS_OK;
}
// Get the types of supported flavors.
nsCOMPtr<nsISupportsArray> flavorList;
nsresult rv = aTransferable->FlavorsTransferableCanExport(getter_AddRefs(flavorList));
@ -161,6 +182,24 @@ nsClipboard::GetData(nsITransferable *aTransferable,
return clipboardProxy->GetData(aTransferable, aWhichClipboard);
}
// Use a pref to toggle rich text/non-text support.
if (Preferences::GetBool("clipboard.plainTextOnly")) {
nsresult rv;
nsCOMPtr<nsISupportsString> dataWrapper =
do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID, &rv);
rv = dataWrapper->SetData(mClipboard->GetText());
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
nsCOMPtr<nsISupports> genericDataWrapper = do_QueryInterface(dataWrapper);
uint32_t len = mClipboard->GetText().Length() * sizeof(char16_t);
rv = aTransferable->SetTransferData(kUnicodeMime, genericDataWrapper, len);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
return NS_OK;
}
// Get flavor list that includes all acceptable flavors (including
// ones obtained through conversion).
// Note: We don't need to call nsITransferable::AddDataFlavor here