mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge m-c to fx-team, a=merge
This commit is contained in:
commit
0fd8937d9f
@ -1160,5 +1160,8 @@ pref("dom.serviceWorkers.enabled", false);
|
||||
// Retain at most 10 processes' layers buffers
|
||||
pref("layers.compositor-lru-size", 10);
|
||||
|
||||
// Enable Cardboard VR on mobile, assuming VR at all is enabled
|
||||
pref("dom.vr.cardboard.enabled", true);
|
||||
|
||||
// In B2G by deafult any AudioChannelAgent is muted when created.
|
||||
pref("dom.audiochannel.mutedByDefault", true);
|
||||
|
@ -201,9 +201,9 @@ var shell = {
|
||||
debugCrashReport('Not online, postponing.');
|
||||
|
||||
Services.obs.addObserver(function observer(subject, topic, state) {
|
||||
let network = subject.QueryInterface(Ci.nsINetworkInterface);
|
||||
if (network.state == Ci.nsINetworkInterface.NETWORK_STATE_CONNECTED
|
||||
&& network.type == Ci.nsINetworkInterface.NETWORK_TYPE_WIFI) {
|
||||
let network = subject.QueryInterface(Ci.nsINetworkInfo);
|
||||
if (network.state == Ci.nsINetworkInfo.NETWORK_STATE_CONNECTED
|
||||
&& network.type == Ci.nsINetworkInfo.NETWORK_TYPE_WIFI) {
|
||||
shell.submitQueuedCrashes();
|
||||
|
||||
Services.obs.removeObserver(observer, topic);
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="088f350b39baf8f86c7c1161fd4be178ce822b7b"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="bf8565e0c3ad216ccb3f109c17f8a2eb2c42f6b8"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="088f350b39baf8f86c7c1161fd4be178ce822b7b"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="bf8565e0c3ad216ccb3f109c17f8a2eb2c42f6b8"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -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="088f350b39baf8f86c7c1161fd4be178ce822b7b"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="bf8565e0c3ad216ccb3f109c17f8a2eb2c42f6b8"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="8bc59310552179f9a8bc6cdd0188e2475df52fb7"/>
|
||||
|
@ -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="088f350b39baf8f86c7c1161fd4be178ce822b7b"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="bf8565e0c3ad216ccb3f109c17f8a2eb2c42f6b8"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="657894b4a1dc0a926117f4812e0940229f9f676f"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="5bb657ada461be666c35f419dbe072ed2ce632fc"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="088f350b39baf8f86c7c1161fd4be178ce822b7b"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="bf8565e0c3ad216ccb3f109c17f8a2eb2c42f6b8"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="07c383a786f188904311a37f6062c2cb84c9b61d">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="088f350b39baf8f86c7c1161fd4be178ce822b7b"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="bf8565e0c3ad216ccb3f109c17f8a2eb2c42f6b8"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -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="088f350b39baf8f86c7c1161fd4be178ce822b7b"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="bf8565e0c3ad216ccb3f109c17f8a2eb2c42f6b8"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="8bc59310552179f9a8bc6cdd0188e2475df52fb7"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="e862ab9177af664f00b4522e2350f4cb13866d73">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="088f350b39baf8f86c7c1161fd4be178ce822b7b"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="bf8565e0c3ad216ccb3f109c17f8a2eb2c42f6b8"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
"git": {
|
||||
"git_revision": "088f350b39baf8f86c7c1161fd4be178ce822b7b",
|
||||
"git_revision": "bf8565e0c3ad216ccb3f109c17f8a2eb2c42f6b8",
|
||||
"remote": "https://git.mozilla.org/releases/gaia.git",
|
||||
"branch": ""
|
||||
},
|
||||
"revision": "97666dae0fe5da2a0da4f57f41fcb12e9c2fe709",
|
||||
"revision": "3b5be8b229de20ea6cdcd3089558bf631c184c58",
|
||||
"repo_path": "integration/gaia-central"
|
||||
}
|
||||
|
@ -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="088f350b39baf8f86c7c1161fd4be178ce822b7b"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="bf8565e0c3ad216ccb3f109c17f8a2eb2c42f6b8"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="657894b4a1dc0a926117f4812e0940229f9f676f"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="5bb657ada461be666c35f419dbe072ed2ce632fc"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="07c383a786f188904311a37f6062c2cb84c9b61d">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="088f350b39baf8f86c7c1161fd4be178ce822b7b"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="bf8565e0c3ad216ccb3f109c17f8a2eb2c42f6b8"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9f45c1988fe72749f0659409e6e3320fabf7b79a"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -3432,6 +3432,13 @@
|
||||
|
||||
finishTabSwitch: function () {
|
||||
if (this.requestedTab && this.getTabState(this.requestedTab) == this.STATE_LOADED) {
|
||||
// After this point the tab has switched from the content thread's point of view.
|
||||
// The changes will be visible after the next refresh driver tick + composite.
|
||||
let event = new CustomEvent("TabSwitched", {
|
||||
bubbles: true,
|
||||
cancelable: true
|
||||
});
|
||||
this.tabbrowser.dispatchEvent(event);
|
||||
let time = TelemetryStopwatch.timeElapsed("FX_TAB_SWITCH_TOTAL_E10S_MS", window);
|
||||
if (time != -1) {
|
||||
TelemetryStopwatch.finish("FX_TAB_SWITCH_TOTAL_E10S_MS", window);
|
||||
|
@ -56,7 +56,6 @@ skip-if = !crashreporter
|
||||
[browser_CTP_drag_drop.js]
|
||||
[browser_CTP_hide_overlay.js]
|
||||
[browser_CTP_iframe.js]
|
||||
skip-if = os == 'linux' || os == 'mac' # Bug 984821
|
||||
[browser_CTP_multi_allow.js]
|
||||
[browser_CTP_nonplugins.js]
|
||||
[browser_CTP_notificationBar.js]
|
||||
|
@ -2076,8 +2076,6 @@ this.UITour.init();
|
||||
/**
|
||||
* UITour Health Report
|
||||
*/
|
||||
const DAILY_DISCRETE_TEXT_FIELD = Metrics.Storage.FIELD_DAILY_DISCRETE_TEXT;
|
||||
|
||||
/**
|
||||
* Public API to be called by the UITour code
|
||||
*/
|
||||
@ -2115,6 +2113,9 @@ const UITourHealthReport = {
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef MOZ_SERVICES_HEALTHREPORT
|
||||
const DAILY_DISCRETE_TEXT_FIELD = Metrics.Storage.FIELD_DAILY_DISCRETE_TEXT;
|
||||
|
||||
this.UITourMetricsProvider = function() {
|
||||
Metrics.Provider.call(this);
|
||||
}
|
||||
@ -2184,3 +2185,4 @@ UITourTreatmentMeasurement1.prototype = Object.freeze({
|
||||
return result;
|
||||
}
|
||||
});
|
||||
#endif
|
||||
|
@ -116,18 +116,15 @@ public class AnnotationProcessor {
|
||||
}
|
||||
|
||||
implementationFile.append(
|
||||
"\n" +
|
||||
"} /* widget */\n" +
|
||||
"} /* mozilla */\n");
|
||||
|
||||
headerFile.append(
|
||||
"\n" +
|
||||
"} /* widget */\n" +
|
||||
"} /* mozilla */\n" +
|
||||
"#endif // " + getHeaderGuardName(HEADER_FILE) + "\n");
|
||||
|
||||
nativesFile.append(
|
||||
"\n" +
|
||||
"} /* widget */\n" +
|
||||
"} /* mozilla */\n" +
|
||||
"#endif // " + getHeaderGuardName(NATIVES_FILE) + "\n");
|
||||
|
@ -527,7 +527,8 @@ public class CodeGenerator {
|
||||
"};\n" +
|
||||
"\n" +
|
||||
"template<class Impl>\n" +
|
||||
"constexpr JNINativeMethod " + clsName + "::Natives<Impl>::methods[];\n");
|
||||
"constexpr JNINativeMethod " + clsName + "::Natives<Impl>::methods[];\n" +
|
||||
"\n");
|
||||
return natives.toString();
|
||||
}
|
||||
}
|
||||
|
@ -125,7 +125,21 @@ public class SDKProcessor {
|
||||
System.out.println("SDK processing complete in " + (e - s) + "ms");
|
||||
}
|
||||
|
||||
private static Member[] sortAndFilterMembers(Member[] members) {
|
||||
private static int getAPIVersion(Class<?> cls, Member m) {
|
||||
if (m instanceof Method || m instanceof Constructor) {
|
||||
return sApiLookup.getCallVersion(
|
||||
cls.getName().replace('.', '/'),
|
||||
Utils.getMemberName(m),
|
||||
Utils.getSignature(m));
|
||||
} else if (m instanceof Field) {
|
||||
return sApiLookup.getFieldVersion(
|
||||
Utils.getClassDescriptor(m.getDeclaringClass()), m.getName());
|
||||
} else {
|
||||
throw new IllegalArgumentException("expected member to be Method, Constructor, or Field");
|
||||
}
|
||||
}
|
||||
|
||||
private static Member[] sortAndFilterMembers(Class<?> cls, Member[] members) {
|
||||
Arrays.sort(members, new Comparator<Member>() {
|
||||
@Override
|
||||
public int compare(Member a, Member b) {
|
||||
@ -135,20 +149,13 @@ public class SDKProcessor {
|
||||
|
||||
ArrayList<Member> list = new ArrayList<>();
|
||||
for (Member m : members) {
|
||||
int version = 0;
|
||||
|
||||
if (m instanceof Method || m instanceof Constructor) {
|
||||
version = sApiLookup.getCallVersion(
|
||||
Utils.getClassDescriptor(m.getDeclaringClass()),
|
||||
m.getName(),
|
||||
Utils.getSignature(m));
|
||||
} else if (m instanceof Field) {
|
||||
version = sApiLookup.getFieldVersion(
|
||||
Utils.getClassDescriptor(m.getDeclaringClass()), m.getName());
|
||||
} else {
|
||||
throw new IllegalArgumentException("expected member to be Method, Constructor, or Field");
|
||||
// Sometimes (e.g. Bundle) has methods that moved to/from a superclass in a later SDK
|
||||
// version, so we check for both classes and see if we can find a minimum SDK version.
|
||||
int version = getAPIVersion(cls, m);
|
||||
final int version2 = getAPIVersion(m.getDeclaringClass(), m);
|
||||
if (version2 > 0 && version2 < version) {
|
||||
version = version2;
|
||||
}
|
||||
|
||||
if (version > sMaxSdkVersion) {
|
||||
System.out.println("Skipping " + m.getDeclaringClass().getName() + "." + m.getName() +
|
||||
", version " + version + " > " + sMaxSdkVersion);
|
||||
@ -168,9 +175,9 @@ public class SDKProcessor {
|
||||
|
||||
CodeGenerator generator = new CodeGenerator(new ClassWithOptions(clazz, generatedName));
|
||||
|
||||
generator.generateMembers(sortAndFilterMembers(clazz.getDeclaredConstructors()));
|
||||
generator.generateMembers(sortAndFilterMembers(clazz.getDeclaredMethods()));
|
||||
generator.generateMembers(sortAndFilterMembers(clazz.getDeclaredFields()));
|
||||
generator.generateMembers(sortAndFilterMembers(clazz, clazz.getConstructors()));
|
||||
generator.generateMembers(sortAndFilterMembers(clazz, clazz.getMethods()));
|
||||
generator.generateMembers(sortAndFilterMembers(clazz, clazz.getFields()));
|
||||
|
||||
headerFile.append(generator.getHeaderFileContents());
|
||||
implementationFile.append(generator.getWrapperFileContents());
|
||||
|
@ -31,7 +31,7 @@ public class GeneratableElementIterator implements Iterator<AnnotatableEntity> {
|
||||
// Get all the elements of this class as AccessibleObjects.
|
||||
Member[] aMethods = aClass.getDeclaredMethods();
|
||||
Member[] aFields = aClass.getDeclaredFields();
|
||||
Member[] aCtors = aClass.getConstructors();
|
||||
Member[] aCtors = aClass.getDeclaredConstructors();
|
||||
|
||||
// Shove them all into one buffer.
|
||||
Member[] objs = new Member[aMethods.length + aFields.length + aCtors.length];
|
||||
|
75
configure.in
75
configure.in
@ -1711,46 +1711,6 @@ else
|
||||
_DEFINES_CXXFLAGS='-DMOZILLA_CLIENT -D_MOZILLA_CONFIG_H_ $(ACDEFINES)'
|
||||
fi
|
||||
|
||||
dnl gcc can come with its own linker so it is better to use the pass-thru calls
|
||||
dnl MKSHLIB_FORCE_ALL is used to force the linker to include all object
|
||||
dnl files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker to
|
||||
dnl normal behavior.
|
||||
dnl ========================================================
|
||||
MKSHLIB_FORCE_ALL=
|
||||
MKSHLIB_UNFORCE_ALL=
|
||||
|
||||
if test "$COMPILE_ENVIRONMENT"; then
|
||||
if test "$GNU_CC"; then
|
||||
AC_MSG_CHECKING(whether ld has archive extraction flags)
|
||||
AC_CACHE_VAL(ac_cv_mkshlib_force_and_unforce,
|
||||
[_SAVE_LDFLAGS=$LDFLAGS; _SAVE_LIBS=$LIBS
|
||||
ac_cv_mkshlib_force_and_unforce="no"
|
||||
exec 3<&0 <<LOOP_INPUT
|
||||
force="-Wl,--whole-archive"; unforce="-Wl,--no-whole-archive"
|
||||
force="-Wl,-z -Wl,allextract"; unforce="-Wl,-z -Wl,defaultextract"
|
||||
force="-Wl,-all"; unforce="-Wl,-none"
|
||||
LOOP_INPUT
|
||||
while read line
|
||||
do
|
||||
eval $line
|
||||
LDFLAGS=$force
|
||||
LIBS=$unforce
|
||||
AC_TRY_LINK(,, ac_cv_mkshlib_force_and_unforce=$line; break)
|
||||
done
|
||||
exec 0<&3 3<&-
|
||||
LDFLAGS=$_SAVE_LDFLAGS; LIBS=$_SAVE_LIBS
|
||||
])
|
||||
if test "$ac_cv_mkshlib_force_and_unforce" = "no"; then
|
||||
AC_MSG_RESULT(no)
|
||||
else
|
||||
AC_MSG_RESULT(yes)
|
||||
eval $ac_cv_mkshlib_force_and_unforce
|
||||
MKSHLIB_FORCE_ALL=$force
|
||||
MKSHLIB_UNFORCE_ALL=$unforce
|
||||
fi
|
||||
fi # GNU_CC
|
||||
fi # COMPILE_ENVIRONMENT
|
||||
|
||||
dnl ========================================================
|
||||
dnl Checking for 64-bit OS
|
||||
dnl ========================================================
|
||||
@ -2276,8 +2236,6 @@ ia64*-hpux*)
|
||||
IMPORT_LIB_SUFFIX=lib
|
||||
MKSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
|
||||
MKCSHLIB='$(LD) -NOLOGO -DLL -OUT:$@ -PDB:$(LINK_PDBFILE) $(DSO_LDOPTS)'
|
||||
MKSHLIB_FORCE_ALL=
|
||||
MKSHLIB_UNFORCE_ALL=
|
||||
dnl Set subsystem version 5 for Windows XP.
|
||||
if test "$CPU_ARCH" = "x86"; then
|
||||
WIN32_SUBSYSTEM_VERSION=5.01
|
||||
@ -2456,8 +2414,6 @@ ia64*-hpux*)
|
||||
DSO_LDOPTS='-shared'
|
||||
fi
|
||||
# This will fail on a.out systems prior to 1.5.1_ALPHA.
|
||||
MKSHLIB_FORCE_ALL='-Wl,--whole-archive'
|
||||
MKSHLIB_UNFORCE_ALL='-Wl,--no-whole-archive'
|
||||
if test "$LIBRUNPATH"; then
|
||||
DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS"
|
||||
fi
|
||||
@ -2507,8 +2463,6 @@ ia64*-hpux*)
|
||||
MOZ_OPTIMIZE_FLAGS="-xO4"
|
||||
MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
|
||||
MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $(DSO_SONAME) -o $@'
|
||||
MKSHLIB_FORCE_ALL='-z allextract'
|
||||
MKSHLIB_UNFORCE_ALL='-z defaultextract'
|
||||
DSO_LDOPTS='-G'
|
||||
AR_LIST="$AR t"
|
||||
AR_EXTRACT="$AR x"
|
||||
@ -2549,8 +2503,6 @@ ia64*-hpux*)
|
||||
else
|
||||
LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
|
||||
LIBS="-lc $LIBS"
|
||||
MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
|
||||
MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
|
||||
ASFLAGS="$ASFLAGS -fPIC"
|
||||
DSO_LDOPTS='-shared'
|
||||
WARNINGS_AS_ERRORS='-Werror'
|
||||
@ -2600,31 +2552,6 @@ dnl Only one oddball right now (QNX), but this gives us flexibility
|
||||
dnl if any other platforms need to override this in the future.
|
||||
AC_DEFINE_UNQUOTED(D_INO,$DIRENT_INO)
|
||||
|
||||
dnl ========================================================
|
||||
dnl Any platform that doesn't have MKSHLIB_FORCE_ALL defined
|
||||
dnl by now will not have any way to link most binaries (tests
|
||||
dnl as well as viewer, apprunner, etc.), because some symbols
|
||||
dnl will be left out of the "composite" .so's by ld as unneeded.
|
||||
dnl So, by defining NO_LD_ARCHIVE_FLAGS for these platforms,
|
||||
dnl they can link in the static libs that provide the missing
|
||||
dnl symbols.
|
||||
dnl ========================================================
|
||||
NO_LD_ARCHIVE_FLAGS=
|
||||
if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
|
||||
NO_LD_ARCHIVE_FLAGS=1
|
||||
fi
|
||||
case "$target" in
|
||||
*-aix4.3*|*-aix5*)
|
||||
NO_LD_ARCHIVE_FLAGS=
|
||||
;;
|
||||
*-mingw*)
|
||||
if test -z "$GNU_CC"; then
|
||||
NO_LD_ARCHIVE_FLAGS=
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
AC_SUBST(NO_LD_ARCHIVE_FLAGS)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Flags to strip unused symbols from .so components and
|
||||
dnl = to export jemalloc symbols when linking a program
|
||||
@ -9003,8 +8930,6 @@ AC_SUBST(MOZ_CHROME_FILE_FORMAT)
|
||||
AC_SUBST(WRAP_LDFLAGS)
|
||||
AC_SUBST(MKSHLIB)
|
||||
AC_SUBST(MKCSHLIB)
|
||||
AC_SUBST(MKSHLIB_FORCE_ALL)
|
||||
AC_SUBST(MKSHLIB_UNFORCE_ALL)
|
||||
AC_SUBST(DSO_CFLAGS)
|
||||
AC_SUBST(DSO_PIC_CFLAGS)
|
||||
AC_SUBST(DSO_LDOPTS)
|
||||
|
@ -8,7 +8,7 @@
|
||||
#define mozilla_AutoGlobalTimelineMarker_h_
|
||||
|
||||
#include "mozilla/GuardObjects.h"
|
||||
#include "nsRefPtr.h"
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
|
||||
class nsDocShell;
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
#define mozilla_AutoTimelineMarker_h_
|
||||
|
||||
#include "mozilla/GuardObjects.h"
|
||||
#include "nsRefPtr.h"
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
|
||||
class nsIDocShell;
|
||||
class nsDocShell;
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#include "GeckoProfiler.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsRefPtr.h"
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
|
||||
class nsDocShell;
|
||||
class TimelineMarker;
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#include "mozilla/dom/StructuredCloneHelper.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsRefPtr.h"
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
#define mozilla_dom_SameProcessMessageQueue_h
|
||||
|
||||
#include "nsIRunnable.h"
|
||||
#include "nsRefPtr.h"
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -147,7 +147,7 @@ nsCOMPtr<T>::operator=(const mozilla::dom::OwningNonNull<U>& aOther)
|
||||
return operator=(aOther.get());
|
||||
}
|
||||
|
||||
// Declared in nsRefPtr.h
|
||||
// Declared in mozilla/nsRefPtr.h
|
||||
template<class T> template<class U>
|
||||
nsRefPtr<T>::nsRefPtr(const mozilla::dom::OwningNonNull<U>& aOther)
|
||||
: nsRefPtr(aOther.get())
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "nsIIPCBackgroundChildCreateCallback.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsRefPtr.h"
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
|
||||
class nsPIDOMWindow;
|
||||
|
||||
|
2
dom/cache/ActorChild.h
vendored
2
dom/cache/ActorChild.h
vendored
@ -7,7 +7,7 @@
|
||||
#ifndef mozilla_dom_cache_ActioChild_h
|
||||
#define mozilla_dom_cache_ActioChild_h
|
||||
|
||||
#include "nsRefPtr.h"
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
2
dom/cache/CacheOpChild.h
vendored
2
dom/cache/CacheOpChild.h
vendored
@ -10,7 +10,7 @@
|
||||
#include "mozilla/dom/cache/ActorChild.h"
|
||||
#include "mozilla/dom/cache/PCacheOpChild.h"
|
||||
#include "mozilla/dom/cache/TypeUtils.h"
|
||||
#include "nsRefPtr.h"
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
|
||||
class nsIGlobalObject;
|
||||
|
||||
|
2
dom/cache/DBAction.h
vendored
2
dom/cache/DBAction.h
vendored
@ -8,7 +8,7 @@
|
||||
#define mozilla_dom_cache_DBAction_h
|
||||
|
||||
#include "mozilla/dom/cache/Action.h"
|
||||
#include "nsRefPtr.h"
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
#include "nsString.h"
|
||||
|
||||
class mozIStorageConnection;
|
||||
|
2
dom/cache/Manager.h
vendored
2
dom/cache/Manager.h
vendored
@ -10,7 +10,7 @@
|
||||
#include "mozilla/dom/cache/Types.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsRefPtr.h"
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
|
2
dom/cache/ManagerId.cpp
vendored
2
dom/cache/ManagerId.cpp
vendored
@ -7,7 +7,7 @@
|
||||
#include "mozilla/dom/cache/ManagerId.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsProxyRelease.h"
|
||||
#include "nsRefPtr.h"
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
2
dom/cache/ReadStream.h
vendored
2
dom/cache/ReadStream.h
vendored
@ -12,7 +12,7 @@
|
||||
#include "nsID.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsRefPtr.h"
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
#include "nsTArrayForwardDeclare.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
2
dom/cache/StreamControl.h
vendored
2
dom/cache/StreamControl.h
vendored
@ -8,7 +8,7 @@
|
||||
#define mozilla_dom_cache_StreamControl_h
|
||||
|
||||
#include "mozilla/dom/cache/ReadStream.h"
|
||||
#include "nsRefPtr.h"
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
#include "nsTObserverArray.h"
|
||||
|
||||
struct nsID;
|
||||
|
2
dom/cache/StreamList.h
vendored
2
dom/cache/StreamList.h
vendored
@ -9,7 +9,7 @@
|
||||
|
||||
#include "mozilla/dom/cache/Context.h"
|
||||
#include "mozilla/dom/cache/Types.h"
|
||||
#include "nsRefPtr.h"
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
class nsIInputStream;
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
#include "GLContext.h"
|
||||
#include "mozilla/dom/WebGL2RenderingContextBinding.h"
|
||||
#include "nsRefPtr.h"
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
#include "WebGLBuffer.h"
|
||||
#include "WebGLContext.h"
|
||||
#include "WebGLProgram.h"
|
||||
|
@ -21,7 +21,6 @@
|
||||
|
||||
#include "nsDebug.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "../../xpcom/base/nsRefPtr.h"
|
||||
#include "nsString.h"
|
||||
|
||||
#include "gfxContext.h"
|
||||
@ -51,6 +50,7 @@
|
||||
#include "mozilla/dom/ImageData.h"
|
||||
#include "mozilla/dom/ToJSValue.h"
|
||||
#include "mozilla/Endian.h"
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
#define WEBGLCONTEXTUNCHECKED_H
|
||||
|
||||
#include "GLDefs.h"
|
||||
#include "nsRefPtr.h"
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
#include "WebGLTypes.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -9,7 +9,7 @@
|
||||
#include "mozilla/CheckedInt.h"
|
||||
#include "mozilla/dom/WebGL2RenderingContextBinding.h"
|
||||
#include "mozilla/dom/WebGLRenderingContextBinding.h"
|
||||
#include "nsRefPtr.h"
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
#include "WebGLActiveInfo.h"
|
||||
#include "WebGLContext.h"
|
||||
#include "WebGLShader.h"
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "nsIChannelEventSink.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsRefPtr.h"
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/net/ReferrerPolicy.h"
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "mozilla/layers/APZCTreeManager.h"
|
||||
#include "mozilla/layers/APZEventState.h"
|
||||
#include "mozilla/layers/CompositorChild.h"
|
||||
#include "mozilla/layers/DoubleTapToZoom.h"
|
||||
#include "mozilla/layers/ImageBridgeChild.h"
|
||||
#include "mozilla/layers/ShadowLayers.h"
|
||||
#include "mozilla/layout/RenderFrameChild.h"
|
||||
@ -116,7 +117,6 @@ NS_IMPL_ISUPPORTS(ContentListener, nsIDOMEventListener)
|
||||
|
||||
static const CSSSize kDefaultViewportSize(980, 480);
|
||||
|
||||
static const char BROWSER_ZOOM_TO_RECT[] = "browser-zoom-to-rect";
|
||||
static const char BEFORE_FIRST_PAINT[] = "before-first-paint";
|
||||
|
||||
typedef nsDataHashtable<nsUint64HashKey, TabChild*> TabChildMap;
|
||||
@ -283,39 +283,6 @@ TabChildBase::ProcessUpdateFrame(const FrameMetrics& aFrameMetrics)
|
||||
|
||||
FrameMetrics newMetrics = aFrameMetrics;
|
||||
APZCCallbackHelper::UpdateRootFrame(newMetrics);
|
||||
|
||||
CSSSize cssCompositedSize = newMetrics.CalculateCompositedSizeInCssPixels();
|
||||
// The BrowserElementScrolling helper must know about these updated metrics
|
||||
// for other functions it performs, such as double tap handling.
|
||||
// Note, %f must not be used because it is locale specific!
|
||||
nsString data;
|
||||
data.AppendPrintf("{ \"x\" : %d", NS_lround(newMetrics.GetScrollOffset().x));
|
||||
data.AppendPrintf(", \"y\" : %d", NS_lround(newMetrics.GetScrollOffset().y));
|
||||
data.AppendLiteral(", \"viewport\" : ");
|
||||
data.AppendLiteral("{ \"width\" : ");
|
||||
data.AppendFloat(newMetrics.GetViewport().width);
|
||||
data.AppendLiteral(", \"height\" : ");
|
||||
data.AppendFloat(newMetrics.GetViewport().height);
|
||||
data.AppendLiteral(" }");
|
||||
data.AppendLiteral(", \"cssPageRect\" : ");
|
||||
data.AppendLiteral("{ \"x\" : ");
|
||||
data.AppendFloat(newMetrics.GetScrollableRect().x);
|
||||
data.AppendLiteral(", \"y\" : ");
|
||||
data.AppendFloat(newMetrics.GetScrollableRect().y);
|
||||
data.AppendLiteral(", \"width\" : ");
|
||||
data.AppendFloat(newMetrics.GetScrollableRect().width);
|
||||
data.AppendLiteral(", \"height\" : ");
|
||||
data.AppendFloat(newMetrics.GetScrollableRect().height);
|
||||
data.AppendLiteral(" }");
|
||||
data.AppendLiteral(", \"cssCompositedRect\" : ");
|
||||
data.AppendLiteral("{ \"width\" : ");
|
||||
data.AppendFloat(cssCompositedSize.width);
|
||||
data.AppendLiteral(", \"height\" : ");
|
||||
data.AppendFloat(cssCompositedSize.height);
|
||||
data.AppendLiteral(" }");
|
||||
data.AppendLiteral(" }");
|
||||
|
||||
DispatchMessageManagerMessage(NS_LITERAL_STRING("Viewport:Change"), data);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
@ -638,23 +605,7 @@ TabChild::Observe(nsISupports *aSubject,
|
||||
const char *aTopic,
|
||||
const char16_t *aData)
|
||||
{
|
||||
if (!strcmp(aTopic, BROWSER_ZOOM_TO_RECT)) {
|
||||
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(aSubject));
|
||||
nsCOMPtr<nsITabChild> tabChild(TabChild::GetFrom(docShell));
|
||||
if (tabChild == this) {
|
||||
nsCOMPtr<nsIDocument> doc(GetDocument());
|
||||
uint32_t presShellId;
|
||||
ViewID viewId;
|
||||
if (APZCCallbackHelper::GetOrCreateScrollIdentifiers(doc->GetDocumentElement(),
|
||||
&presShellId, &viewId)) {
|
||||
CSSRect rect;
|
||||
sscanf(NS_ConvertUTF16toUTF8(aData).get(),
|
||||
"{\"x\":%f,\"y\":%f,\"w\":%f,\"h\":%f}",
|
||||
&rect.x, &rect.y, &rect.width, &rect.height);
|
||||
SendZoomToRect(presShellId, viewId, rect);
|
||||
}
|
||||
}
|
||||
} else if (!strcmp(aTopic, BEFORE_FIRST_PAINT)) {
|
||||
if (!strcmp(aTopic, BEFORE_FIRST_PAINT)) {
|
||||
if (AsyncPanZoomEnabled()) {
|
||||
nsCOMPtr<nsIDocument> subject(do_QueryInterface(aSubject));
|
||||
nsCOMPtr<nsIDocument> doc(GetDocument());
|
||||
@ -1764,14 +1715,18 @@ TabChild::RecvHandleDoubleTap(const CSSPoint& aPoint, const Modifiers& aModifier
|
||||
// Note: there is nothing to do with the modifiers here, as we are not
|
||||
// synthesizing any sort of mouse event.
|
||||
CSSPoint point = APZCCallbackHelper::ApplyCallbackTransform(aPoint, aGuid);
|
||||
nsString data;
|
||||
data.AppendLiteral("{ \"x\" : ");
|
||||
data.AppendFloat(point.x);
|
||||
data.AppendLiteral(", \"y\" : ");
|
||||
data.AppendFloat(point.y);
|
||||
data.AppendLiteral(" }");
|
||||
|
||||
DispatchMessageManagerMessage(NS_LITERAL_STRING("Gesture:DoubleTap"), data);
|
||||
nsCOMPtr<nsIDocument> document = GetDocument();
|
||||
CSSRect zoomToRect = CalculateRectToZoomTo(document, point);
|
||||
// The double-tap can be dispatched by any scroll frame (so |aGuid| could be
|
||||
// the guid of any scroll frame), but the zoom-to-rect operation must be
|
||||
// performed by the root content scroll frame, so query its identifiers
|
||||
// for the SendZoomToRect() call rather than using the ones from |aGuid|.
|
||||
uint32_t presShellId;
|
||||
ViewID viewId;
|
||||
if (APZCCallbackHelper::GetOrCreateScrollIdentifiers(
|
||||
document->GetDocumentElement(), &presShellId, &viewId)) {
|
||||
SendZoomToRect(presShellId, viewId, zoomToRect);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -2454,7 +2409,6 @@ TabChild::RecvDestroy()
|
||||
nsCOMPtr<nsIObserverService> observerService =
|
||||
mozilla::services::GetObserverService();
|
||||
|
||||
observerService->RemoveObserver(this, BROWSER_ZOOM_TO_RECT);
|
||||
observerService->RemoveObserver(this, BEFORE_FIRST_PAINT);
|
||||
|
||||
const nsAttrValue::EnumTable* table =
|
||||
@ -2656,9 +2610,6 @@ TabChild::InitRenderingState(const TextureFactoryIdentifier& aTextureFactoryIden
|
||||
mozilla::services::GetObserverService();
|
||||
|
||||
if (observerService) {
|
||||
observerService->AddObserver(this,
|
||||
BROWSER_ZOOM_TO_RECT,
|
||||
false);
|
||||
observerService->AddObserver(this,
|
||||
BEFORE_FIRST_PAINT,
|
||||
false);
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "nsIRunnable.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsIThread.h"
|
||||
#include "nsRefPtr.h"
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
|
||||
#include "mozilla/ThreadLocal.h"
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
#define AudioSink_h__
|
||||
|
||||
#include "MediaInfo.h"
|
||||
#include "nsRefPtr.h"
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
|
||||
#include "mozilla/dom/AudioChannelBinding.h"
|
||||
|
@ -7,7 +7,7 @@
|
||||
#ifndef DecodedStream_h_
|
||||
#define DecodedStream_h_
|
||||
|
||||
#include "nsRefPtr.h"
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
#include "nsTArray.h"
|
||||
#include "MediaInfo.h"
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "AudioSampleFormat.h"
|
||||
#include "nsIMemoryReporter.h"
|
||||
#include "SharedBuffer.h"
|
||||
#include "nsRefPtr.h"
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "MediaInfo.h"
|
||||
#include "TimeUnits.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsRefPtr.h"
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "nsRect.h"
|
||||
#include "nsRefPtr.h"
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
#include "nsSize.h"
|
||||
#include "nsString.h"
|
||||
#include "nsTArray.h"
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "nsWrapperCache.h"
|
||||
#include "js/TypeDecls.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsRefPtr.h"
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
|
||||
#if defined(XP_WIN) && defined(GetMessage)
|
||||
#undef GetMessage
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include <queue>
|
||||
|
||||
#include "nsITimer.h"
|
||||
#include "nsRefPtr.h"
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
#ifndef MOZILLA_CONTAINERPARSER_H_
|
||||
#define MOZILLA_CONTAINERPARSER_H_
|
||||
|
||||
#include "nsRefPtr.h"
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "MediaResource.h"
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
#include "mozilla/media/MediaSystemResourceClient.h"
|
||||
#include "mozilla/Monitor.h"
|
||||
#include "nsRefPtr.h"
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
|
||||
namespace android {
|
||||
// This class is intended to be a proxy for MediaCodec with codec resource
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include <utils/threads.h>
|
||||
|
||||
#include "mozilla/media/MediaSystemResourceClient.h"
|
||||
#include "nsRefPtr.h"
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
|
||||
namespace android {
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include "GonkNativeWindow.h"
|
||||
#include "GonkNativeWindowClient.h"
|
||||
#include "mozilla/media/MediaSystemResourceClient.h"
|
||||
#include "nsRefPtr.h"
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
|
||||
#include <speex/speex_resampler.h>
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
#define MediaDataDecoderProxy_h_
|
||||
|
||||
#include "PlatformDecoderModule.h"
|
||||
#include "nsRefPtr.h"
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nscore.h"
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "mozilla/Atomics.h"
|
||||
#include "mozilla/media/MediaSystemResourceTypes.h"
|
||||
#include "mozilla/Monitor.h"
|
||||
#include "nsRefPtr.h"
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -25,7 +25,7 @@ function isNetworkReady() {
|
||||
for (var i = 0; i < num; i++) {
|
||||
var ips = {};
|
||||
var prefixLengths = {};
|
||||
var length = itfList.getInterface(i).getAddresses(ips, prefixLengths);
|
||||
var length = itfList.getInterfaceInfo(i).getAddresses(ips, prefixLengths);
|
||||
|
||||
for (var j = 0; j < length; j++) {
|
||||
var ip = ips.value[j];
|
||||
|
@ -6,7 +6,7 @@
|
||||
#ifndef RTCIDENTITYPROVIDER_H_
|
||||
#define RTCIDENTITYPROVIDER_H_
|
||||
|
||||
#include "nsRefPtr.h"
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsIGlobalObject.h"
|
||||
|
@ -708,10 +708,10 @@ MobileConnectionProvider.prototype = {
|
||||
updateDataInfo: function(aNewInfo, aBatch = false) {
|
||||
// For the data connection, the `connected` flag indicates whether
|
||||
// there's an active data call. We get correct `connected` state here.
|
||||
let active = gNetworkManager.active;
|
||||
let active = gNetworkManager.activeNetworkInfo;
|
||||
aNewInfo.connected = false;
|
||||
if (active &&
|
||||
active.type === Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE &&
|
||||
active.type === Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE &&
|
||||
active.serviceId === this._clientId) {
|
||||
aNewInfo.connected = true;
|
||||
}
|
||||
@ -1599,11 +1599,10 @@ MobileConnectionService.prototype = {
|
||||
}
|
||||
break;
|
||||
case NS_DATA_CALL_ERROR_TOPIC_ID:
|
||||
let network = aSubject;
|
||||
try {
|
||||
if (network instanceof Ci.nsIRilNetworkInterface) {
|
||||
let rilNetwork = network.QueryInterface(Ci.nsIRilNetworkInterface);
|
||||
this.notifyDataError(rilNetwork.serviceId, rilNetwork);
|
||||
if (aSubject instanceof Ci.nsIRilNetworkInfo) {
|
||||
let rilInfo = aSubject.QueryInterface(Ci.nsIRilNetworkInfo);
|
||||
this.notifyDataError(rilInfo.serviceId, aData);
|
||||
}
|
||||
} catch (e) {}
|
||||
break;
|
||||
|
@ -227,10 +227,10 @@ MmsConnection.prototype = {
|
||||
mmsProxy: "",
|
||||
mmsPort: -1,
|
||||
|
||||
setApnSetting: function(network) {
|
||||
this.mmsc = network.mmsc;
|
||||
this.mmsProxy = network.mmsProxy;
|
||||
this.mmsPort = network.mmsPort;
|
||||
setApnSetting: function(networkInfo) {
|
||||
this.mmsc = networkInfo.mmsc;
|
||||
this.mmsProxy = networkInfo.mmsProxy;
|
||||
this.mmsPort = networkInfo.mmsPort;
|
||||
},
|
||||
|
||||
get proxyInfo() {
|
||||
@ -268,8 +268,8 @@ MmsConnection.prototype = {
|
||||
// cache of hosts to be accessed when this connection is alive.
|
||||
hostsToRoute: null,
|
||||
|
||||
// cache of the networkInterface acquired during this connection.
|
||||
networkInterface: null,
|
||||
// cache of the networkInfo acquired during this connection.
|
||||
networkInfo: null,
|
||||
|
||||
connectTimer: null,
|
||||
|
||||
@ -303,14 +303,14 @@ MmsConnection.prototype = {
|
||||
|
||||
// Clear cache.
|
||||
this.hostsToRoute = [];
|
||||
this.networkInterface = null;
|
||||
this.networkInfo = null;
|
||||
|
||||
this.radioInterface.deactivateDataCallByType(Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS);
|
||||
this.radioInterface.deactivateDataCallByType(Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE_MMS);
|
||||
};
|
||||
|
||||
let promises =
|
||||
this.hostsToRoute.map((aHost) => {
|
||||
return gNetworkManager.removeHostRoute(this.networkInterface, aHost);
|
||||
return gNetworkManager.removeHostRoute(this.networkInfo, aHost);
|
||||
});
|
||||
|
||||
return Promise.all(promises)
|
||||
@ -442,7 +442,7 @@ MmsConnection.prototype = {
|
||||
|
||||
// Bug 1059110: Ensure all the initialization are done before setup data call.
|
||||
if (DEBUG) debug("acquire: buffer the MMS request and setup the MMS data call.");
|
||||
this.radioInterface.setupDataCallByType(Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS);
|
||||
this.radioInterface.setupDataCallByType(Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE_MMS);
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -494,7 +494,7 @@ MmsConnection.prototype = {
|
||||
host = uri.host;
|
||||
} catch (e) {}
|
||||
|
||||
return gNetworkManager.addHostRoute(this.networkInterface, host)
|
||||
return gNetworkManager.addHostRoute(this.networkInfo, host)
|
||||
.then(() => {
|
||||
if (this.hostsToRoute.indexOf(host) < 0) {
|
||||
this.hostsToRoute.push(host);
|
||||
@ -517,20 +517,20 @@ MmsConnection.prototype = {
|
||||
observe: function(subject, topic, data) {
|
||||
switch (topic) {
|
||||
case kNetworkConnStateChangedTopic: {
|
||||
// The network for MMS connection must be nsIRilNetworkInterface.
|
||||
if (!(subject instanceof Ci.nsIRilNetworkInterface)) {
|
||||
// The network info for MMS connection must be nsIRilNetworkInfo.
|
||||
if (!(subject instanceof Ci.nsIRilNetworkInfo)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if the network state change belongs to this service.
|
||||
let network = subject.QueryInterface(Ci.nsIRilNetworkInterface);
|
||||
if (network.serviceId != this.serviceId ||
|
||||
network.type != Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS) {
|
||||
let networkInfo = subject.QueryInterface(Ci.nsIRilNetworkInfo);
|
||||
if (networkInfo.serviceId != this.serviceId ||
|
||||
networkInfo.type != Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE_MMS) {
|
||||
return;
|
||||
}
|
||||
|
||||
let connected =
|
||||
network.state == Ci.nsINetworkInterface.NETWORK_STATE_CONNECTED;
|
||||
networkInfo.state == Ci.nsINetworkInfo.NETWORK_STATE_CONNECTED;
|
||||
|
||||
// Return if the MMS network state doesn't change, where the network
|
||||
// state change can come from other non-MMS networks.
|
||||
@ -541,16 +541,16 @@ MmsConnection.prototype = {
|
||||
this.connected = connected;
|
||||
if (!this.connected) {
|
||||
this.hostsToRoute = [];
|
||||
this.networkInterface = null;
|
||||
this.networkInfo = null;
|
||||
return;
|
||||
}
|
||||
|
||||
// Set up the MMS APN setting based on the connected MMS network,
|
||||
// which is going to be used for the HTTP requests later.
|
||||
this.setApnSetting(network);
|
||||
this.setApnSetting(networkInfo);
|
||||
|
||||
// Cache connected network.
|
||||
this.networkInterface = network;
|
||||
// Cache connected network info.
|
||||
this.networkInfo = networkInfo;
|
||||
|
||||
if (DEBUG) debug("Got the MMS network connected! Resend the buffered " +
|
||||
"MMS requests: number: " + this.pendingCallbacks.length);
|
||||
@ -745,7 +745,7 @@ XPCOMUtils.defineLazyGetter(this, "gMmsTransactionHelper", function() {
|
||||
// TODO: |getNetId| will be implemented as a sync call in nsINetworkManager
|
||||
// once Bug 1141903 is landed.
|
||||
mmsConnection.ensureRouting(url)
|
||||
.then(() => gNetworkService.getNetId(mmsConnection.networkInterface.name))
|
||||
.then(() => gNetworkService.getNetId(mmsConnection.networkInfo.name))
|
||||
.then((netId) => startTransaction(netId))
|
||||
.catch((aReason) => onRejected(aReason));
|
||||
});
|
||||
|
@ -26,8 +26,8 @@ const NET_NETWORKSTATSSERVICE_CID = Components.ID("{18725604-e9ac-488a-8aa0-2471
|
||||
const TOPIC_BANDWIDTH_CONTROL = "netd-bandwidth-control"
|
||||
|
||||
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;
|
||||
const NET_TYPE_WIFI = Ci.nsINetworkInfo.NETWORK_TYPE_WIFI;
|
||||
const NET_TYPE_MOBILE = Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE;
|
||||
|
||||
// Networks have different status that NetworkStats API needs to be aware of.
|
||||
// Network is present and ready, so NetworkManager provides the whole info.
|
||||
@ -192,10 +192,10 @@ this.NetworkStatsService = {
|
||||
// the stats are updated for the new interface without waiting to
|
||||
// complete the updating period.
|
||||
|
||||
let network = aSubject.QueryInterface(Ci.nsINetworkInterface);
|
||||
debug("Network " + network.name + " of type " + network.type + " status change");
|
||||
let networkInfo = aSubject.QueryInterface(Ci.nsINetworkInfo);
|
||||
debug("Network " + networkInfo.name + " of type " + networkInfo.type + " status change");
|
||||
|
||||
let netId = this.convertNetworkInterface(network);
|
||||
let netId = this.convertNetworkInfo(networkInfo);
|
||||
if (!netId) {
|
||||
break;
|
||||
}
|
||||
@ -269,33 +269,33 @@ this.NetworkStatsService = {
|
||||
return networks;
|
||||
},
|
||||
|
||||
convertNetworkInterface: function(aNetwork) {
|
||||
if (aNetwork.type != NET_TYPE_MOBILE &&
|
||||
aNetwork.type != NET_TYPE_WIFI) {
|
||||
convertNetworkInfo: function(aNetworkInfo) {
|
||||
if (aNetworkInfo.type != NET_TYPE_MOBILE &&
|
||||
aNetworkInfo.type != NET_TYPE_WIFI) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let id = '0';
|
||||
if (aNetwork.type == NET_TYPE_MOBILE) {
|
||||
if (!(aNetwork instanceof Ci.nsIRilNetworkInterface)) {
|
||||
debug("Error! Mobile network should be an nsIRilNetworkInterface!");
|
||||
if (aNetworkInfo.type == NET_TYPE_MOBILE) {
|
||||
if (!(aNetworkInfo instanceof Ci.nsIRilNetworkInfo)) {
|
||||
debug("Error! Mobile network should be an nsIRilNetworkInfo!");
|
||||
return null;
|
||||
}
|
||||
|
||||
let rilNetwork = aNetwork.QueryInterface(Ci.nsIRilNetworkInterface);
|
||||
let rilNetwork = aNetworkInfo.QueryInterface(Ci.nsIRilNetworkInfo);
|
||||
id = rilNetwork.iccId;
|
||||
}
|
||||
|
||||
let netId = this.getNetworkId(id, aNetwork.type);
|
||||
let netId = this.getNetworkId(id, aNetworkInfo.type);
|
||||
|
||||
if (!this._networks[netId]) {
|
||||
this._networks[netId] = Object.create(null);
|
||||
this._networks[netId].network = { id: id,
|
||||
type: aNetwork.type };
|
||||
type: aNetworkInfo.type };
|
||||
}
|
||||
|
||||
this._networks[netId].status = NETWORK_STATUS_READY;
|
||||
this._networks[netId].interfaceName = aNetwork.name;
|
||||
this._networks[netId].interfaceName = aNetworkInfo.name;
|
||||
return netId;
|
||||
},
|
||||
|
||||
@ -738,10 +738,10 @@ this.NetworkStatsService = {
|
||||
/*
|
||||
* Function responsible for receiving stats which are not from netd.
|
||||
*/
|
||||
saveStats: function saveStats(aAppId, aIsInBrowser, aServiceType, aNetwork,
|
||||
saveStats: function saveStats(aAppId, aIsInBrowser, aServiceType, aNetworkInfo,
|
||||
aTimeStamp, aRxBytes, aTxBytes, aIsAccumulative,
|
||||
aCallback) {
|
||||
let netId = this.convertNetworkInterface(aNetwork);
|
||||
let netId = this.convertNetworkInfo(aNetworkInfo);
|
||||
if (!netId) {
|
||||
if (aCallback) {
|
||||
aCallback(false, "Invalid network type");
|
||||
|
@ -29,19 +29,19 @@ NetworkStatsServiceProxy.prototype = {
|
||||
* Function called in the protocol layer (HTTP, FTP, WebSocket ...etc)
|
||||
* to pass the per-app stats to NetworkStatsService.
|
||||
*/
|
||||
saveAppStats: function saveAppStats(aAppId, aIsInBrowser, aNetwork, aTimeStamp,
|
||||
saveAppStats: function saveAppStats(aAppId, aIsInBrowser, aNetworkInfo, aTimeStamp,
|
||||
aRxBytes, aTxBytes, aIsAccumulative,
|
||||
aCallback) {
|
||||
if (!aNetwork) {
|
||||
if (!aNetworkInfo) {
|
||||
if (DEBUG) {
|
||||
debug("|aNetwork| is not specified. Failed to save stats. Returning.");
|
||||
debug("|aNetworkInfo| is not specified. Failed to save stats. Returning.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (DEBUG) {
|
||||
debug("saveAppStats: " + aAppId + " " + aIsInBrowser + " " +
|
||||
aNetwork.type + " " + aTimeStamp + " " +
|
||||
aNetworkInfo.type + " " + aTimeStamp + " " +
|
||||
aRxBytes + " " + aTxBytes + " " + aIsAccumulative);
|
||||
}
|
||||
|
||||
@ -49,7 +49,7 @@ NetworkStatsServiceProxy.prototype = {
|
||||
aCallback = aCallback.notify;
|
||||
}
|
||||
|
||||
NetworkStatsService.saveStats(aAppId, aIsInBrowser, "", aNetwork,
|
||||
NetworkStatsService.saveStats(aAppId, aIsInBrowser, "", aNetworkInfo,
|
||||
aTimeStamp, aRxBytes, aTxBytes,
|
||||
aIsAccumulative, aCallback);
|
||||
},
|
||||
@ -58,18 +58,18 @@ NetworkStatsServiceProxy.prototype = {
|
||||
* Function called in the points of different system services
|
||||
* to pass the per-service stats to NetworkStatsService.
|
||||
*/
|
||||
saveServiceStats: function saveServiceStats(aServiceType, aNetwork,
|
||||
saveServiceStats: function saveServiceStats(aServiceType, aNetworkInfo,
|
||||
aTimeStamp, aRxBytes, aTxBytes,
|
||||
aIsAccumulative, aCallback) {
|
||||
if (!aNetwork) {
|
||||
if (!aNetworkInfo) {
|
||||
if (DEBUG) {
|
||||
debug("|aNetwork| is not specified. Failed to save stats. Returning.");
|
||||
debug("|aNetworkInfo| is not specified. Failed to save stats. Returning.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (DEBUG) {
|
||||
debug("saveServiceStats: " + aServiceType + " " + aNetwork.type + " " +
|
||||
debug("saveServiceStats: " + aServiceType + " " + aNetworkInfo.type + " " +
|
||||
aTimeStamp + " " + aRxBytes + " " + aTxBytes + " " +
|
||||
aIsAccumulative);
|
||||
}
|
||||
@ -78,7 +78,7 @@ NetworkStatsServiceProxy.prototype = {
|
||||
aCallback = aCallback.notify;
|
||||
}
|
||||
|
||||
NetworkStatsService.saveStats(0, false, aServiceType ,aNetwork, aTimeStamp,
|
||||
NetworkStatsService.saveStats(0, false, aServiceType , aNetworkInfo, aTimeStamp,
|
||||
aRxBytes, aTxBytes, aIsAccumulative,
|
||||
aCallback);
|
||||
},
|
||||
|
@ -185,7 +185,7 @@ TCPSocket.prototype = {
|
||||
_rxBytes: 0,
|
||||
_appId: Ci.nsIScriptSecurityManager.NO_APP_ID,
|
||||
_inBrowser: false,
|
||||
_activeNetwork: null,
|
||||
_activeNetworkInfo: null,
|
||||
#endif
|
||||
|
||||
// Public accessors.
|
||||
@ -374,7 +374,7 @@ TCPSocket.prototype = {
|
||||
LOG("Error: Ci.nsINetworkStatsServiceProxy service is not available.");
|
||||
return;
|
||||
}
|
||||
nssProxy.saveAppStats(this._appId, this._inBrowser, this._activeNetwork,
|
||||
nssProxy.saveAppStats(this._appId, this._inBrowser, this._activeNetworkInfo,
|
||||
Date.now(), this._rxBytes, this._txBytes, false);
|
||||
|
||||
// Reset the counters once the statistics is saved to NetworkStatsServiceProxy.
|
||||
@ -616,12 +616,12 @@ TCPSocket.prototype = {
|
||||
that._initStream(that._binaryType);
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
// Set _activeNetwork, which is only required for network statistics.
|
||||
// Set _activeNetworkInfo, which is only required for network statistics.
|
||||
// Note that nsINetworkManager, as well as nsINetworkStatsServiceProxy, is
|
||||
// Gonk-specific.
|
||||
let networkManager = Cc["@mozilla.org/network/manager;1"].getService(Ci.nsINetworkManager);
|
||||
if (networkManager) {
|
||||
that._activeNetwork = networkManager.active;
|
||||
that._activeNetworkInfo = networkManager.activeNetworkInfo;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsINetworkInterface;
|
||||
interface nsINetworkInfo;
|
||||
|
||||
[scriptable, function, uuid(5f821529-1d80-4ab5-a933-4e1b3585b6bc)]
|
||||
interface nsINetworkStatsServiceProxyCallback : nsISupports
|
||||
@ -16,7 +16,7 @@ interface nsINetworkStatsServiceProxyCallback : nsISupports
|
||||
void notify(in boolean aResult, in jsval aMessage);
|
||||
};
|
||||
|
||||
[scriptable, uuid(98fd8f69-784e-4626-aa59-56d6436a3c24)]
|
||||
[scriptable, uuid(f4f3e901-e102-499d-9d37-dc9951f52df7)]
|
||||
interface nsINetworkStatsServiceProxy : nsISupports
|
||||
{
|
||||
/*
|
||||
@ -32,7 +32,7 @@ interface nsINetworkStatsServiceProxy : nsISupports
|
||||
*/
|
||||
void saveAppStats(in unsigned long aAppId,
|
||||
in boolean aIsInBrowser,
|
||||
in nsINetworkInterface aNetwork,
|
||||
in nsINetworkInfo aNetworkInfo,
|
||||
in unsigned long long aTimeStamp,
|
||||
in unsigned long long aRxBytes,
|
||||
in unsigned long long aTxBytes,
|
||||
@ -50,7 +50,7 @@ interface nsINetworkStatsServiceProxy : nsISupports
|
||||
* @param aCallback an optional callback
|
||||
*/
|
||||
void saveServiceStats(in string aServiceType,
|
||||
in nsINetworkInterface aNetwork,
|
||||
in nsINetworkInfo aNetworkInfo,
|
||||
in unsigned long long aTimeStamp,
|
||||
in unsigned long long aRxBytes,
|
||||
in unsigned long long aTxBytes,
|
||||
|
@ -936,7 +936,7 @@ add_test(function test_addAlarm() {
|
||||
netStatsDb.addAlarm(alarms[0], function(error, result) {
|
||||
do_check_eq(error, null);
|
||||
alarmsDbId = result;
|
||||
netStatsDb.getAlarms(Ci.nsINetworkInterface.NETWORK_TYPE_WIFI, exampleManifestURL, function(error, result) {
|
||||
netStatsDb.getAlarms(Ci.nsINetworkInfo.NETWORK_TYPE_WIFI, exampleManifestURL, function(error, result) {
|
||||
do_check_eq(error, null);
|
||||
do_check_eq(result.length, 1);
|
||||
do_check_eq(result[0].id, alarmsDbId);
|
||||
|
@ -260,7 +260,7 @@ add_test(function test_fireAlarm() {
|
||||
NetworkStatsService._networks[wifiId].status = NETWORK_STATUS_STANDBY;
|
||||
|
||||
NetworkStatsService._db.addAlarm(alarm, function addSuccessCb(error, newId) {
|
||||
NetworkStatsService._db.getAlarms(Ci.nsINetworkInterface.NETWORK_TYPE_WIFI,
|
||||
NetworkStatsService._db.getAlarms(Ci.nsINetworkInfo.NETWORK_TYPE_WIFI,
|
||||
testManifestURL, function onGet(error, result) {
|
||||
do_check_eq(error, null);
|
||||
do_check_eq(result.length, 1);
|
||||
@ -272,7 +272,7 @@ add_test(function test_fireAlarm() {
|
||||
result[0].manifestURL = testManifestURL;
|
||||
|
||||
NetworkStatsService._fireAlarm(result[0], false);
|
||||
NetworkStatsService._db.getAlarms(Ci.nsINetworkInterface.NETWORK_TYPE_WIFI,
|
||||
NetworkStatsService._db.getAlarms(Ci.nsINetworkInfo.NETWORK_TYPE_WIFI,
|
||||
testManifestURL, function onGet(error, result) {
|
||||
do_check_eq(error, undefined);
|
||||
do_check_eq(result.length, 0);
|
||||
|
@ -9,24 +9,24 @@ XPCOMUtils.defineLazyServiceGetter(this, "nssProxy",
|
||||
"@mozilla.org/networkstatsServiceProxy;1",
|
||||
"nsINetworkStatsServiceProxy");
|
||||
|
||||
function mokConvertNetworkInterface() {
|
||||
NetworkStatsService.convertNetworkInterface = function(aNetwork) {
|
||||
if (aNetwork.type != Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE &&
|
||||
aNetwork.type != Ci.nsINetworkInterface.NETWORK_TYPE_WIFI) {
|
||||
function mokConvertNetworkInfo() {
|
||||
NetworkStatsService.convertNetworkInfo = function(aNetworkInfo) {
|
||||
if (aNetworkInfo.type != Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE &&
|
||||
aNetworkInfo.type != Ci.nsINetworkInfo.NETWORK_TYPE_WIFI) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let id = '0';
|
||||
if (aNetwork.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE) {
|
||||
if (aNetworkInfo.type == Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE) {
|
||||
id = '1234'
|
||||
}
|
||||
|
||||
let netId = this.getNetworkId(id, aNetwork.type);
|
||||
let netId = this.getNetworkId(id, aNetworkInfo.type);
|
||||
|
||||
if (!this._networks[netId]) {
|
||||
this._networks[netId] = Object.create(null);
|
||||
this._networks[netId].network = { id: id,
|
||||
type: aNetwork.type };
|
||||
type: aNetworkInfo.type };
|
||||
}
|
||||
|
||||
return netId;
|
||||
@ -37,13 +37,12 @@ add_test(function test_saveAppStats() {
|
||||
var cachedStats = NetworkStatsService.cachedStats;
|
||||
var timestamp = NetworkStatsService.cachedStatsDate.getTime();
|
||||
|
||||
// Create to fake nsINetworkInterfaces. As nsINetworkInterface can not
|
||||
// be instantiated, these two vars will emulate it by filling the properties
|
||||
// that will be used.
|
||||
var wifi = {type: Ci.nsINetworkInterface.NETWORK_TYPE_WIFI, id: "0"};
|
||||
var mobile = {type: Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE, id: "1234"};
|
||||
// Create to fake nsINetworkInfos. As nsINetworkInfo can not be instantiated,
|
||||
// these two vars will emulate it by filling the properties that will be used.
|
||||
var wifi = {type: Ci.nsINetworkInfo.NETWORK_TYPE_WIFI, id: "0"};
|
||||
var mobile = {type: Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE, id: "1234"};
|
||||
|
||||
// Insert fake mobile network interface in NetworkStatsService
|
||||
// Insert fake mobile network info in NetworkStatsService
|
||||
var mobileNetId = NetworkStatsService.getNetworkId(mobile.id, mobile.type);
|
||||
|
||||
do_check_eq(Object.keys(cachedStats).length, 0);
|
||||
@ -83,13 +82,12 @@ add_test(function test_saveAppStats() {
|
||||
add_test(function test_saveServiceStats() {
|
||||
var timestamp = NetworkStatsService.cachedStatsDate.getTime();
|
||||
|
||||
// Create to fake nsINetworkInterfaces. As nsINetworkInterface can not
|
||||
// be instantiated, these two vars will emulate it by filling the properties
|
||||
// that will be used.
|
||||
var wifi = {type: Ci.nsINetworkInterface.NETWORK_TYPE_WIFI, id: "0"};
|
||||
var mobile = {type: Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE, id: "1234"};
|
||||
// Create to fake nsINetworkInfos. As nsINetworkInfo can not be instantiated,
|
||||
// these two vars will emulate it by filling the properties that will be used.
|
||||
var wifi = {type: Ci.nsINetworkInfo.NETWORK_TYPE_WIFI, id: "0"};
|
||||
var mobile = {type: Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE, id: "1234"};
|
||||
|
||||
// Insert fake mobile network interface in NetworkStatsService
|
||||
// Insert fake mobile network info in NetworkStatsService
|
||||
var mobileNetId = NetworkStatsService.getNetworkId(mobile.id, mobile.type);
|
||||
|
||||
NetworkStatsService.updateCachedStats(function (success, msg) {
|
||||
@ -138,7 +136,7 @@ add_test(function test_saveStatsWithDifferentDates() {
|
||||
var today = NetworkStatsService.cachedStatsDate;
|
||||
var tomorrow = new Date(today.getTime() + (24 * 60 * 60 * 1000));
|
||||
|
||||
var mobile = {type: Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE, id: "1234"};
|
||||
var mobile = {type: Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE, id: "1234"};
|
||||
|
||||
NetworkStatsService.updateCachedStats(function (success, message) {
|
||||
do_check_eq(success, true);
|
||||
@ -173,7 +171,7 @@ add_test(function test_saveStatsWithDifferentDates() {
|
||||
add_test(function test_saveStatsWithMaxCachedTraffic() {
|
||||
var timestamp = NetworkStatsService.cachedStatsDate.getTime();
|
||||
var maxtraffic = NetworkStatsService.maxCachedTraffic;
|
||||
var wifi = {type: Ci.nsINetworkInterface.NETWORK_TYPE_WIFI, id: "0"};
|
||||
var wifi = {type: Ci.nsINetworkInfo.NETWORK_TYPE_WIFI, id: "0"};
|
||||
|
||||
NetworkStatsService.updateCachedStats(function (success, message) {
|
||||
do_check_eq(success, true);
|
||||
@ -199,11 +197,11 @@ add_test(function test_saveAppStats() {
|
||||
var cachedStats = NetworkStatsService.cachedStats;
|
||||
var timestamp = NetworkStatsService.cachedStatsDate.getTime();
|
||||
|
||||
// Create to fake nsINetworkInterfaces. As nsINetworkInterface can not
|
||||
// Create to fake nsINetworkInfo. As nsINetworkInfo can not
|
||||
// be instantiated, these two vars will emulate it by filling the properties
|
||||
// that will be used.
|
||||
var wifi = {type: Ci.nsINetworkInterface.NETWORK_TYPE_WIFI, id: "0"};
|
||||
var mobile = {type: Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE, id: "1234"};
|
||||
var wifi = {type: Ci.nsINetworkInfo.NETWORK_TYPE_WIFI, id: "0"};
|
||||
var mobile = {type: Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE, id: "1234"};
|
||||
|
||||
// Insert fake mobile network interface in NetworkStatsService
|
||||
var mobileNetId = NetworkStatsService.getNetworkId(mobile.id, mobile.type);
|
||||
@ -232,9 +230,9 @@ function run_test() {
|
||||
|
||||
Cu.import("resource://gre/modules/NetworkStatsService.jsm");
|
||||
|
||||
// Function convertNetworkInterface of NetworkStatsService causes errors when dealing
|
||||
// Function convertNetworkInfo of NetworkStatsService causes errors when dealing
|
||||
// with RIL to get the iccid, so overwrite it.
|
||||
mokConvertNetworkInterface();
|
||||
mokConvertNetworkInfo();
|
||||
|
||||
run_next_test();
|
||||
}
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "nsIDNSServiceDiscovery.h"
|
||||
#include "nsIPresentationDeviceProvider.h"
|
||||
#include "nsITCPPresentationServer.h"
|
||||
#include "nsRefPtr.h"
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "nsWeakPtr.h"
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#include "js/TypeDecls.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsRefPtr.h"
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -38,7 +38,7 @@
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsRefPtr.h"
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
#include "jsapi.h"
|
||||
|
||||
class nsIGlobalObject;
|
||||
|
@ -1256,8 +1256,8 @@ let PushNetworkInfo = {
|
||||
|
||||
let nm = Cc["@mozilla.org/network/manager;1"]
|
||||
.getService(Ci.nsINetworkManager);
|
||||
if (nm.active &&
|
||||
nm.active.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE) {
|
||||
if (nm.activeNetworkInfo &&
|
||||
nm.activeNetworkInfo.type == Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE) {
|
||||
let iccService = Cc["@mozilla.org/icc/iccservice;1"]
|
||||
.getService(Ci.nsIIccService);
|
||||
// TODO: Bug 927721 - PushService for multi-sim
|
||||
@ -1273,7 +1273,7 @@ let PushNetworkInfo = {
|
||||
|
||||
let ips = {};
|
||||
let prefixLengths = {};
|
||||
nm.active.getAddresses(ips, prefixLengths);
|
||||
nm.activeNetworkInfo.getAddresses(ips, prefixLengths);
|
||||
|
||||
return {
|
||||
mcc: iccInfo.mcc,
|
||||
|
@ -1774,7 +1774,8 @@ this.PushService = {
|
||||
}
|
||||
|
||||
let nm = Cc["@mozilla.org/network/manager;1"].getService(Ci.nsINetworkManager);
|
||||
if (nm.active && nm.active.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE) {
|
||||
if (nm.activeNetworkInfo &&
|
||||
nm.activeNetworkInfo.type == Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE) {
|
||||
let iccService = Cc["@mozilla.org/icc/iccservice;1"].getService(Ci.nsIIccService);
|
||||
// TODO: Bug 927721 - PushService for multi-sim
|
||||
// In Multi-sim, there is more than one client in iccService. Each
|
||||
@ -1789,7 +1790,7 @@ this.PushService = {
|
||||
|
||||
let ips = {};
|
||||
let prefixLengths = {};
|
||||
nm.active.getAddresses(ips, prefixLengths);
|
||||
nm.activeNetworkInfo.getAddresses(ips, prefixLengths);
|
||||
|
||||
return {
|
||||
mcc: iccInfo.mcc,
|
||||
|
@ -53,7 +53,9 @@ const DATACALLMANAGER_CID =
|
||||
const DATACALLHANDLER_CID =
|
||||
Components.ID("{132b650f-c4d8-4731-96c5-83785cb31dee}");
|
||||
const RILNETWORKINTERFACE_CID =
|
||||
Components.ID("{8c11bef9-9b4f-4d96-bed7-f5a1f48eabda}");
|
||||
Components.ID("{9574ee84-5d0d-4814-b9e6-8b279e03dcf4}");
|
||||
const RILNETWORKINFO_CID =
|
||||
Components.ID("{dd6cf2f0-f0e3-449f-a69e-7c34fdcb8d4b}");
|
||||
|
||||
const TOPIC_XPCOM_SHUTDOWN = "xpcom-shutdown";
|
||||
const TOPIC_MOZSETTINGS_CHANGED = "mozsettings-changed";
|
||||
@ -61,20 +63,20 @@ const TOPIC_PREF_CHANGED = "nsPref:changed";
|
||||
const TOPIC_DATA_CALL_ERROR = "data-call-error";
|
||||
const PREF_RIL_DEBUG_ENABLED = "ril.debugging.enabled";
|
||||
|
||||
const NETWORK_TYPE_UNKNOWN = Ci.nsINetworkInterface.NETWORK_TYPE_UNKNOWN;
|
||||
const NETWORK_TYPE_WIFI = Ci.nsINetworkInterface.NETWORK_TYPE_WIFI;
|
||||
const NETWORK_TYPE_MOBILE = Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE;
|
||||
const NETWORK_TYPE_MOBILE_MMS = Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS;
|
||||
const NETWORK_TYPE_MOBILE_SUPL = Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_SUPL;
|
||||
const NETWORK_TYPE_MOBILE_IMS = Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_IMS;
|
||||
const NETWORK_TYPE_MOBILE_DUN = Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_DUN;
|
||||
const NETWORK_TYPE_MOBILE_FOTA = Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_FOTA;
|
||||
const NETWORK_TYPE_UNKNOWN = Ci.nsINetworkInfo.NETWORK_TYPE_UNKNOWN;
|
||||
const NETWORK_TYPE_WIFI = Ci.nsINetworkInfo.NETWORK_TYPE_WIFI;
|
||||
const NETWORK_TYPE_MOBILE = Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE;
|
||||
const NETWORK_TYPE_MOBILE_MMS = Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE_MMS;
|
||||
const NETWORK_TYPE_MOBILE_SUPL = Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE_SUPL;
|
||||
const NETWORK_TYPE_MOBILE_IMS = Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE_IMS;
|
||||
const NETWORK_TYPE_MOBILE_DUN = Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE_DUN;
|
||||
const NETWORK_TYPE_MOBILE_FOTA = Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE_FOTA;
|
||||
|
||||
const NETWORK_STATE_UNKNOWN = Ci.nsINetworkInterface.NETWORK_STATE_UNKNOWN;
|
||||
const NETWORK_STATE_CONNECTING = Ci.nsINetworkInterface.NETWORK_STATE_CONNECTING;
|
||||
const NETWORK_STATE_CONNECTED = Ci.nsINetworkInterface.NETWORK_STATE_CONNECTED;
|
||||
const NETWORK_STATE_DISCONNECTING = Ci.nsINetworkInterface.NETWORK_STATE_DISCONNECTING;
|
||||
const NETWORK_STATE_DISCONNECTED = Ci.nsINetworkInterface.NETWORK_STATE_DISCONNECTED;
|
||||
const NETWORK_STATE_UNKNOWN = Ci.nsINetworkInfo.NETWORK_STATE_UNKNOWN;
|
||||
const NETWORK_STATE_CONNECTING = Ci.nsINetworkInfo.NETWORK_STATE_CONNECTING;
|
||||
const NETWORK_STATE_CONNECTED = Ci.nsINetworkInfo.NETWORK_STATE_CONNECTED;
|
||||
const NETWORK_STATE_DISCONNECTING = Ci.nsINetworkInfo.NETWORK_STATE_DISCONNECTING;
|
||||
const NETWORK_STATE_DISCONNECTED = Ci.nsINetworkInfo.NETWORK_STATE_DISCONNECTED;
|
||||
|
||||
const INT32_MAX = 2147483647;
|
||||
|
||||
@ -415,7 +417,7 @@ DataCallHandler.prototype = {
|
||||
this._dataCalls = [];
|
||||
this.clientId = null;
|
||||
|
||||
this.dataCallinterface.unregisterListener(this);
|
||||
this.dataCallInterface.unregisterListener(this);
|
||||
this.dataCallInterface = null;
|
||||
|
||||
let mobileConnection =
|
||||
@ -625,8 +627,8 @@ DataCallHandler.prototype = {
|
||||
return;
|
||||
}
|
||||
let wifi_active = false;
|
||||
if (gNetworkManager.active &&
|
||||
gNetworkManager.active.type == NETWORK_TYPE_WIFI) {
|
||||
if (gNetworkManager.activeNetworkInfo &&
|
||||
gNetworkManager.activeNetworkInfo.type == NETWORK_TYPE_WIFI) {
|
||||
wifi_active = true;
|
||||
}
|
||||
|
||||
@ -709,7 +711,7 @@ DataCallHandler.prototype = {
|
||||
if (!networkInterface) {
|
||||
return NETWORK_STATE_UNKNOWN;
|
||||
}
|
||||
return networkInterface.state;
|
||||
return networkInterface.info.state;
|
||||
},
|
||||
|
||||
setupDataCallByType: function(aNetworkType) {
|
||||
@ -760,8 +762,8 @@ DataCallHandler.prototype = {
|
||||
let dataDisconnecting = false;
|
||||
this.dataNetworkInterfaces.forEach(function(networkInterface) {
|
||||
if (networkInterface.enabled) {
|
||||
if (networkInterface.state != NETWORK_STATE_UNKNOWN &&
|
||||
networkInterface.state != NETWORK_STATE_DISCONNECTED) {
|
||||
if (networkInterface.info.state != NETWORK_STATE_UNKNOWN &&
|
||||
networkInterface.info.state != NETWORK_STATE_DISCONNECTED) {
|
||||
dataDisconnecting = true;
|
||||
}
|
||||
networkInterface.disconnect();
|
||||
@ -836,23 +838,14 @@ DataCallHandler.prototype = {
|
||||
/**
|
||||
* Notify about data call setup error, called from DataCall.
|
||||
*/
|
||||
notifyDataCallError: function(aMessage) {
|
||||
notifyDataCallError: function(aDataCall, aErrorMsg) {
|
||||
// Notify data call error only for data APN
|
||||
let networkInterface = this.dataNetworkInterfaces.get(NETWORK_TYPE_MOBILE);
|
||||
if (networkInterface && networkInterface.enabled) {
|
||||
let dataCall = networkInterface.dataCall;
|
||||
// If there is a cid, compare cid; otherwise it is probably an error on
|
||||
// data call setup.
|
||||
if (aMessage.cid !== undefined) {
|
||||
if (aMessage.linkInfo.cid == dataCall.linkInfo.cid) {
|
||||
Services.obs.notifyObservers(networkInterface, TOPIC_DATA_CALL_ERROR,
|
||||
null);
|
||||
}
|
||||
} else {
|
||||
if (this._compareDataCallOptions(dataCall, aMessage)) {
|
||||
Services.obs.notifyObservers(networkInterface, TOPIC_DATA_CALL_ERROR,
|
||||
null);
|
||||
}
|
||||
if (this._compareDataCallOptions(dataCall, aDataCall)) {
|
||||
Services.obs.notifyObservers(networkInterface.info,
|
||||
TOPIC_DATA_CALL_ERROR, aErrorMsg);
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -1065,7 +1058,7 @@ DataCall.prototype = {
|
||||
}
|
||||
|
||||
// Let DataCallHandler notify MobileConnectionService
|
||||
this.dataCallHandler.notifyDataCallError(this);
|
||||
this.dataCallHandler.notifyDataCallError(this, errorMsg);
|
||||
|
||||
// For suggestedRetryTime, the value of INT32_MAX(0x7fffffff) means no retry.
|
||||
if (aDataCall.suggestedRetryTime === INT32_MAX ||
|
||||
@ -1242,7 +1235,7 @@ DataCall.prototype = {
|
||||
|
||||
inRequestedTypes: function(aType) {
|
||||
for (let i = 0; i < this.requestedNetworkIfaces.length; i++) {
|
||||
if (this.requestedNetworkIfaces[i].type == aType) {
|
||||
if (this.requestedNetworkIfaces[i].info.type == aType) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -1279,7 +1272,7 @@ DataCall.prototype = {
|
||||
},
|
||||
|
||||
connect: function(aNetworkInterface) {
|
||||
if (DEBUG) this.debug("connect: " + aNetworkInterface.type);
|
||||
if (DEBUG) this.debug("connect: " + aNetworkInterface.info.type);
|
||||
|
||||
if (this.requestedNetworkIfaces.indexOf(aNetworkInterface) == -1) {
|
||||
this.requestedNetworkIfaces.push(aNetworkInterface);
|
||||
@ -1295,7 +1288,7 @@ DataCall.prototype = {
|
||||
Services.tm.currentThread.dispatch(() => {
|
||||
// Do not notify if state changed while this event was being dispatched,
|
||||
// the state probably was notified already or need not to be notified.
|
||||
if (aNetworkInterface.state == RIL.GECKO_NETWORK_STATE_CONNECTED) {
|
||||
if (aNetworkInterface.info.state == RIL.GECKO_NETWORK_STATE_CONNECTED) {
|
||||
aNetworkInterface.notifyRILNetworkInterface();
|
||||
}
|
||||
}, Ci.nsIEventTarget.DISPATCH_NORMAL);
|
||||
@ -1405,7 +1398,7 @@ DataCall.prototype = {
|
||||
},
|
||||
|
||||
disconnect: function(aNetworkInterface) {
|
||||
if (DEBUG) this.debug("disconnect: " + aNetworkInterface.type);
|
||||
if (DEBUG) this.debug("disconnect: " + aNetworkInterface.info.type);
|
||||
|
||||
let index = this.requestedNetworkIfaces.indexOf(aNetworkInterface);
|
||||
if (index != -1) {
|
||||
@ -1426,7 +1419,7 @@ DataCall.prototype = {
|
||||
Services.tm.currentThread.dispatch(() => {
|
||||
// Do not notify if state changed while this event was being dispatched,
|
||||
// the state probably was notified already or need not to be notified.
|
||||
if (aNetworkInterface.state == RIL.GECKO_NETWORK_STATE_DISCONNECTED) {
|
||||
if (aNetworkInterface.info.state == RIL.GECKO_NETWORK_STATE_DISCONNECTED) {
|
||||
aNetworkInterface.notifyRILNetworkInterface();
|
||||
|
||||
// Clear link info after notifying NetworkManager.
|
||||
@ -1449,7 +1442,7 @@ DataCall.prototype = {
|
||||
},
|
||||
|
||||
deactivate: function() {
|
||||
let reason = Ci.nsINetworkInterface.DATACALL_DEACTIVATE_NO_REASON;
|
||||
let reason = Ci.nsIDataCallInterface.DATACALL_DEACTIVATE_NO_REASON;
|
||||
if (DEBUG) {
|
||||
this.debug("Going to disconnect data connection cid " + this.linkInfo.cid);
|
||||
}
|
||||
@ -1481,61 +1474,56 @@ DataCall.prototype = {
|
||||
}
|
||||
};
|
||||
|
||||
function RILNetworkInterface(aDataCallHandler, aType, aApnSetting, aDataCall) {
|
||||
if (!aDataCall) {
|
||||
throw new Error("No dataCall for RILNetworkInterface: " + type);
|
||||
}
|
||||
|
||||
this.dataCallHandler = aDataCallHandler;
|
||||
function RILNetworkInfo(aClientId, aType, aNetworkInterface)
|
||||
{
|
||||
this.serviceId = aClientId;
|
||||
this.type = aType;
|
||||
this.apnSetting = aApnSetting;
|
||||
this.dataCall = aDataCall;
|
||||
|
||||
this.enabled = false;
|
||||
this.networkInterface = aNetworkInterface;
|
||||
}
|
||||
RILNetworkInfo.prototype = {
|
||||
classID: RILNETWORKINFO_CID,
|
||||
classInfo: XPCOMUtils.generateCI({classID: RILNETWORKINFO_CID,
|
||||
classDescription: "RILNetworkInfo",
|
||||
interfaces: [Ci.nsINetworkInfo,
|
||||
Ci.nsIRilNetworkInfo]}),
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsINetworkInfo,
|
||||
Ci.nsIRilNetworkInfo]),
|
||||
|
||||
RILNetworkInterface.prototype = {
|
||||
classID: RILNETWORKINTERFACE_CID,
|
||||
classInfo: XPCOMUtils.generateCI({classID: RILNETWORKINTERFACE_CID,
|
||||
classDescription: "RILNetworkInterface",
|
||||
interfaces: [Ci.nsINetworkInterface,
|
||||
Ci.nsIRilNetworkInterface]}),
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsINetworkInterface,
|
||||
Ci.nsIRilNetworkInterface]),
|
||||
networkInterface: null,
|
||||
|
||||
// Hold reference to DataCall object which is determined at initilization.
|
||||
dataCall: null,
|
||||
getDataCall: function() {
|
||||
return this.networkInterface.dataCall;
|
||||
},
|
||||
|
||||
// If this RILNetworkInterface type is enabled or not.
|
||||
enabled: null,
|
||||
getApnSetting: function() {
|
||||
return this.networkInterface.apnSetting;
|
||||
},
|
||||
|
||||
debug: function(aMsg) {
|
||||
dump("-*- RILNetworkInfo[" + this.serviceId + ":" + this.type + "]: " +
|
||||
aMsg + "\n");
|
||||
},
|
||||
|
||||
/**
|
||||
* nsINetworkInterface Implementation
|
||||
* nsINetworkInfo Implementation
|
||||
*/
|
||||
|
||||
get state() {
|
||||
if (!this.dataCall.inRequestedTypes(this.type)) {
|
||||
let dataCall = this.getDataCall();
|
||||
if (!dataCall.inRequestedTypes(this.type)) {
|
||||
return NETWORK_STATE_DISCONNECTED;
|
||||
}
|
||||
return this.dataCall.state;
|
||||
return dataCall.state;
|
||||
},
|
||||
|
||||
type: null,
|
||||
|
||||
get name() {
|
||||
return this.dataCall.linkInfo.ifname;
|
||||
},
|
||||
|
||||
get httpProxyHost() {
|
||||
return this.apnSetting.proxy || "";
|
||||
},
|
||||
|
||||
get httpProxyPort() {
|
||||
return this.apnSetting.port || "";
|
||||
return this.getDataCall().linkInfo.ifname;
|
||||
},
|
||||
|
||||
getAddresses: function(aIps, aPrefixLengths) {
|
||||
let addresses = this.dataCall.linkInfo.addresses;
|
||||
let addresses = this.getDataCall().linkInfo.addresses;
|
||||
|
||||
let ips = [];
|
||||
let prefixLengths = [];
|
||||
@ -1552,33 +1540,33 @@ RILNetworkInterface.prototype = {
|
||||
},
|
||||
|
||||
getGateways: function(aCount) {
|
||||
let linkInfo = this.dataCall.linkInfo;
|
||||
let linkInfo = this.getDataCall().linkInfo;
|
||||
|
||||
if (aCount) {
|
||||
aCount.value = linkInfo.gateways.length;
|
||||
}
|
||||
|
||||
return linkInfo.gateways.slice();
|
||||
},
|
||||
|
||||
getDnses: function(aCount) {
|
||||
let linkInfo = this.dataCall.linkInfo;
|
||||
let linkInfo = this.getDataCall().linkInfo;
|
||||
|
||||
if (aCount) {
|
||||
aCount.value = linkInfo.dnses.length;
|
||||
}
|
||||
|
||||
return linkInfo.dnses.slice();
|
||||
},
|
||||
|
||||
/**
|
||||
* nsIRilNetworkInterface Implementation
|
||||
* nsIRilNetworkInfo Implementation
|
||||
*/
|
||||
|
||||
get serviceId() {
|
||||
return this.dataCallHandler.clientId;
|
||||
},
|
||||
serviceId: 0,
|
||||
|
||||
get iccId() {
|
||||
let icc = gIccService.getIccByServiceId(this.dataCallHandler.clientId);
|
||||
let icc = gIccService.getIccByServiceId(this.serviceId);
|
||||
let iccInfo = icc && icc.iccInfo;
|
||||
|
||||
return iccInfo && iccInfo.iccid;
|
||||
@ -1590,7 +1578,7 @@ RILNetworkInterface.prototype = {
|
||||
throw Cr.NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
return this.apnSetting.mmsc || "";
|
||||
return this.getApnSetting().mmsc || "";
|
||||
},
|
||||
|
||||
get mmsProxy() {
|
||||
@ -1599,7 +1587,7 @@ RILNetworkInterface.prototype = {
|
||||
throw Cr.NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
return this.apnSetting.mmsproxy || "";
|
||||
return this.getApnSetting().mmsproxy || "";
|
||||
},
|
||||
|
||||
get mmsPort() {
|
||||
@ -1610,26 +1598,66 @@ RILNetworkInterface.prototype = {
|
||||
|
||||
// Note: Port 0 is reserved, so we treat it as invalid as well.
|
||||
// See http://www.iana.org/assignments/port-numbers
|
||||
return this.apnSetting.mmsport || -1;
|
||||
return this.getApnSetting().mmsport || -1;
|
||||
},
|
||||
};
|
||||
|
||||
function RILNetworkInterface(aDataCallHandler, aType, aApnSetting, aDataCall) {
|
||||
if (!aDataCall) {
|
||||
throw new Error("No dataCall for RILNetworkInterface: " + type);
|
||||
}
|
||||
|
||||
this.dataCallHandler = aDataCallHandler;
|
||||
this.enabled = false;
|
||||
this.dataCall = aDataCall;
|
||||
this.apnSetting = aApnSetting;
|
||||
|
||||
this.info = new RILNetworkInfo(aDataCallHandler.clientId, aType, this);
|
||||
}
|
||||
|
||||
RILNetworkInterface.prototype = {
|
||||
classID: RILNETWORKINTERFACE_CID,
|
||||
classInfo: XPCOMUtils.generateCI({classID: RILNETWORKINTERFACE_CID,
|
||||
classDescription: "RILNetworkInterface",
|
||||
interfaces: [Ci.nsINetworkInterface]}),
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsINetworkInterface]),
|
||||
|
||||
// If this RILNetworkInterface type is enabled or not.
|
||||
enabled: null,
|
||||
|
||||
apnSetting: null,
|
||||
|
||||
dataCall: null,
|
||||
|
||||
/**
|
||||
* nsINetworkInterface Implementation
|
||||
*/
|
||||
|
||||
info: null,
|
||||
|
||||
get httpProxyHost() {
|
||||
return this.apnSetting.proxy || "";
|
||||
},
|
||||
|
||||
get httpProxyPort() {
|
||||
return this.apnSetting.port || "";
|
||||
},
|
||||
|
||||
// Helpers
|
||||
|
||||
debug: function(aMsg) {
|
||||
dump("-*- RILNetworkInterface[" + this.dataCallHandler.clientId + ":" +
|
||||
this.type + "]: " + aMsg + "\n");
|
||||
this.info.type + "]: " + aMsg + "\n");
|
||||
},
|
||||
|
||||
apnSetting: null,
|
||||
|
||||
get connected() {
|
||||
return this.state == NETWORK_STATE_CONNECTED;
|
||||
return this.info.state == NETWORK_STATE_CONNECTED;
|
||||
},
|
||||
|
||||
notifyRILNetworkInterface: function() {
|
||||
if (DEBUG) {
|
||||
this.debug("notifyRILNetworkInterface type: " + this.type + ", state: " +
|
||||
this.state);
|
||||
this.debug("notifyRILNetworkInterface type: " + this.info.type +
|
||||
", state: " + this.info.state);
|
||||
}
|
||||
|
||||
gNetworkManager.updateNetworkInterface(this);
|
||||
|
@ -25,7 +25,7 @@
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsGeoPosition.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsINetworkManager.h"
|
||||
#include "nsINetworkInterface.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsJSUtils.h"
|
||||
#include "nsPrintfCString.h"
|
||||
@ -359,12 +359,12 @@ int32_t
|
||||
GonkGPSGeolocationProvider::GetDataConnectionState()
|
||||
{
|
||||
if (!mRadioInterface) {
|
||||
return nsINetworkInterface::NETWORK_STATE_UNKNOWN;
|
||||
return nsINetworkInfo::NETWORK_STATE_UNKNOWN;
|
||||
}
|
||||
|
||||
int32_t state;
|
||||
mRadioInterface->GetDataCallStateByType(
|
||||
nsINetworkInterface::NETWORK_TYPE_MOBILE_SUPL, &state);
|
||||
nsINetworkInfo::NETWORK_TYPE_MOBILE_SUPL, &state);
|
||||
return state;
|
||||
}
|
||||
|
||||
@ -383,7 +383,7 @@ GonkGPSGeolocationProvider::SetAGpsDataConn(nsAString& aApn)
|
||||
|
||||
int32_t connectionState = GetDataConnectionState();
|
||||
NS_ConvertUTF16toUTF8 apn(aApn);
|
||||
if (connectionState == nsINetworkInterface::NETWORK_STATE_CONNECTED) {
|
||||
if (connectionState == nsINetworkInfo::NETWORK_STATE_CONNECTED) {
|
||||
// The definition of availability is
|
||||
// 1. The device is connected to the home network
|
||||
// 2. The device is connected to a foreign network and data
|
||||
@ -400,7 +400,7 @@ GonkGPSGeolocationProvider::SetAGpsDataConn(nsAString& aApn)
|
||||
#else
|
||||
mAGpsInterface->data_conn_open(apn.get());
|
||||
#endif
|
||||
} else if (connectionState == nsINetworkInterface::NETWORK_STATE_DISCONNECTED) {
|
||||
} else if (connectionState == nsINetworkInfo::NETWORK_STATE_DISCONNECTED) {
|
||||
if (hasUpdateNetworkAvailability) {
|
||||
mAGpsRilInterface->update_network_availability(false, apn.get());
|
||||
}
|
||||
@ -450,12 +450,12 @@ GonkGPSGeolocationProvider::RequestDataConnection()
|
||||
return;
|
||||
}
|
||||
|
||||
if (GetDataConnectionState() == nsINetworkInterface::NETWORK_STATE_CONNECTED) {
|
||||
if (GetDataConnectionState() == nsINetworkInfo::NETWORK_STATE_CONNECTED) {
|
||||
// Connection is already established, we don't need to setup again.
|
||||
// We just get supl APN and make AGPS data connection state updated.
|
||||
RequestSettingValue("ril.supl.apn");
|
||||
} else {
|
||||
mRadioInterface->SetupDataCallByType(nsINetworkInterface::NETWORK_TYPE_MOBILE_SUPL);
|
||||
mRadioInterface->SetupDataCallByType(nsINetworkInfo::NETWORK_TYPE_MOBILE_SUPL);
|
||||
}
|
||||
}
|
||||
|
||||
@ -468,7 +468,7 @@ GonkGPSGeolocationProvider::ReleaseDataConnection()
|
||||
return;
|
||||
}
|
||||
|
||||
mRadioInterface->DeactivateDataCallByType(nsINetworkInterface::NETWORK_TYPE_MOBILE_SUPL);
|
||||
mRadioInterface->DeactivateDataCallByType(nsINetworkInfo::NETWORK_TYPE_MOBILE_SUPL);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1010,15 +1010,15 @@ int
|
||||
ConvertToGpsNetworkType(int aNetworkInterfaceType)
|
||||
{
|
||||
switch (aNetworkInterfaceType) {
|
||||
case nsINetworkInterface::NETWORK_TYPE_WIFI:
|
||||
case nsINetworkInfo::NETWORK_TYPE_WIFI:
|
||||
return AGPS_RIL_NETWORK_TYPE_WIFI;
|
||||
case nsINetworkInterface::NETWORK_TYPE_MOBILE:
|
||||
case nsINetworkInfo::NETWORK_TYPE_MOBILE:
|
||||
return AGPS_RIL_NETWORK_TYPE_MOBILE;
|
||||
case nsINetworkInterface::NETWORK_TYPE_MOBILE_MMS:
|
||||
case nsINetworkInfo::NETWORK_TYPE_MOBILE_MMS:
|
||||
return AGPS_RIL_NETWORK_TYPE_MOBILE_MMS;
|
||||
case nsINetworkInterface::NETWORK_TYPE_MOBILE_SUPL:
|
||||
case nsINetworkInfo::NETWORK_TYPE_MOBILE_SUPL:
|
||||
return AGPS_RIL_NETWORK_TYPE_MOBILE_SUPL;
|
||||
case nsINetworkInterface::NETWORK_TYPE_MOBILE_DUN:
|
||||
case nsINetworkInfo::NETWORK_TYPE_MOBILE_DUN:
|
||||
return AGPS_RIL_NETWORK_TTYPE_MOBILE_DUN;
|
||||
default:
|
||||
NS_WARNING(nsPrintfCString("Unknown network type mapping %d",
|
||||
@ -1037,21 +1037,21 @@ GonkGPSGeolocationProvider::Observe(nsISupports* aSubject,
|
||||
|
||||
#ifdef MOZ_B2G_RIL
|
||||
if (!strcmp(aTopic, kNetworkConnStateChangedTopic)) {
|
||||
nsCOMPtr<nsINetworkInterface> iface = do_QueryInterface(aSubject);
|
||||
if (!iface) {
|
||||
nsCOMPtr<nsINetworkInfo> info = do_QueryInterface(aSubject);
|
||||
if (!info) {
|
||||
return NS_OK;
|
||||
}
|
||||
nsCOMPtr<nsIRilNetworkInterface> rilface = do_QueryInterface(aSubject);
|
||||
nsCOMPtr<nsIRilNetworkInfo> rilInfo = do_QueryInterface(aSubject);
|
||||
if (mAGpsRilInterface && mAGpsRilInterface->update_network_state) {
|
||||
int32_t state;
|
||||
int32_t type;
|
||||
iface->GetState(&state);
|
||||
iface->GetType(&type);
|
||||
bool connected = (state == nsINetworkInterface::NETWORK_STATE_CONNECTED);
|
||||
info->GetState(&state);
|
||||
info->GetType(&type);
|
||||
bool connected = (state == nsINetworkInfo::NETWORK_STATE_CONNECTED);
|
||||
bool roaming = false;
|
||||
int gpsNetworkType = ConvertToGpsNetworkType(type);
|
||||
if (gpsNetworkType >= 0) {
|
||||
if (rilface) {
|
||||
if (rilInfo) {
|
||||
do {
|
||||
nsCOMPtr<nsIMobileConnectionService> service =
|
||||
do_GetService(NS_MOBILE_CONNECTION_SERVICE_CONTRACTID);
|
||||
@ -1080,7 +1080,7 @@ GonkGPSGeolocationProvider::Observe(nsISupports* aSubject,
|
||||
}
|
||||
}
|
||||
// No data connection
|
||||
if (!rilface) {
|
||||
if (!rilInfo) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ NetworkInterfaceListService.prototype = {
|
||||
}
|
||||
};
|
||||
|
||||
function FakeNetworkInterface(aAttributes) {
|
||||
function FakeNetworkInfo(aAttributes) {
|
||||
this.state = aAttributes.state;
|
||||
this.type = aAttributes.type;
|
||||
this.name = aAttributes.name;
|
||||
@ -58,11 +58,9 @@ function FakeNetworkInterface(aAttributes) {
|
||||
this.prefixLengths = aAttributes.prefixLengths;
|
||||
this.gateways = aAttributes.gateways;
|
||||
this.dnses = aAttributes.dnses;
|
||||
this.httpProxyHost = aAttributes.httpProxyHost;
|
||||
this.httpProxyPort = aAttributes.httpProxyPort;
|
||||
}
|
||||
FakeNetworkInterface.prototype = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsINetworkInterface]),
|
||||
FakeNetworkInfo.prototype = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsINetworkInfo]),
|
||||
|
||||
getAddresses: function (ips, prefixLengths) {
|
||||
ips.value = this.ips.slice();
|
||||
@ -89,7 +87,7 @@ FakeNetworkInterface.prototype = {
|
||||
function NetworkInterfaceList (aInterfaceLiterals) {
|
||||
this._interfaces = [];
|
||||
for (let entry of aInterfaceLiterals) {
|
||||
this._interfaces.push(new FakeNetworkInterface(entry));
|
||||
this._interfaces.push(new FakeNetworkInfo(entry));
|
||||
}
|
||||
}
|
||||
|
||||
@ -100,7 +98,7 @@ NetworkInterfaceList.prototype = {
|
||||
return this._interfaces.length;
|
||||
},
|
||||
|
||||
getInterface: function(index) {
|
||||
getInterfaceInfo: function(index) {
|
||||
if (!this._interfaces) {
|
||||
return null;
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ const NETWORKMANAGER_CONTRACTID = "@mozilla.org/network/manager;1";
|
||||
const NETWORKMANAGER_CID =
|
||||
Components.ID("{33901e46-33b8-11e1-9869-f46d04d25bcc}");
|
||||
|
||||
const DEFAULT_PREFERRED_NETWORK_TYPE = Ci.nsINetworkInterface.NETWORK_TYPE_WIFI;
|
||||
const DEFAULT_PREFERRED_NETWORK_TYPE = Ci.nsINetworkInfo.NETWORK_TYPE_WIFI;
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "ppmm", function() {
|
||||
return Cc["@mozilla.org/parentprocessmessagemanager;1"]
|
||||
@ -85,24 +85,22 @@ function defineLazyRegExp(obj, name, pattern) {
|
||||
});
|
||||
}
|
||||
|
||||
function NetworkInterface(aNetwork) {
|
||||
function ExtraNetworkInfo(aNetwork) {
|
||||
let ips = {};
|
||||
let prefixLengths = {};
|
||||
aNetwork.getAddresses(ips, prefixLengths);
|
||||
aNetwork.info.getAddresses(ips, prefixLengths);
|
||||
|
||||
this.state = aNetwork.state;
|
||||
this.type = aNetwork.type;
|
||||
this.name = aNetwork.name;
|
||||
this.state = aNetwork.info.state;
|
||||
this.type = aNetwork.info.type;
|
||||
this.name = aNetwork.info.name;
|
||||
this.ips = ips.value;
|
||||
this.prefixLengths = prefixLengths.value;
|
||||
this.gateways = aNetwork.getGateways();
|
||||
this.dnses = aNetwork.getDnses();
|
||||
this.gateways = aNetwork.info.getGateways();
|
||||
this.dnses = aNetwork.info.getDnses();
|
||||
this.httpProxyHost = aNetwork.httpProxyHost;
|
||||
this.httpProxyPort = aNetwork.httpProxyPort;
|
||||
}
|
||||
NetworkInterface.prototype = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsINetworkInterface]),
|
||||
|
||||
ExtraNetworkInfo.prototype = {
|
||||
getAddresses: function(aIps, aPrefixLengths) {
|
||||
aIps.value = this.ips.slice();
|
||||
aPrefixLengths.value = this.prefixLengths.slice();
|
||||
@ -114,6 +112,7 @@ NetworkInterface.prototype = {
|
||||
if (aCount) {
|
||||
aCount.value = this.gateways.length;
|
||||
}
|
||||
|
||||
return this.gateways.slice();
|
||||
},
|
||||
|
||||
@ -121,6 +120,7 @@ NetworkInterface.prototype = {
|
||||
if (aCount) {
|
||||
aCount.value = this.dnses.length;
|
||||
}
|
||||
|
||||
return this.dnses.slice();
|
||||
}
|
||||
};
|
||||
@ -231,12 +231,13 @@ NetworkManager.prototype = {
|
||||
let excludeFota = aMsg.json.excludeFota;
|
||||
let interfaces = [];
|
||||
|
||||
for each (let i in this.networkInterfaces) {
|
||||
if ((i.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS && excludeMms) ||
|
||||
(i.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_SUPL && excludeSupl) ||
|
||||
(i.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_IMS && excludeIms) ||
|
||||
(i.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_DUN && excludeDun) ||
|
||||
(i.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_FOTA && excludeFota)) {
|
||||
for each (let network in this.networkInterfaces) {
|
||||
let i = network.info;
|
||||
if ((i.type == Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE_MMS && excludeMms) ||
|
||||
(i.type == Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE_SUPL && excludeSupl) ||
|
||||
(i.type == Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE_IMS && excludeIms) ||
|
||||
(i.type == Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE_DUN && excludeDun) ||
|
||||
(i.type == Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE_FOTA && excludeFota)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -251,9 +252,7 @@ NetworkManager.prototype = {
|
||||
ips: ips.value,
|
||||
prefixLengths: prefixLengths.value,
|
||||
gateways: i.getGateways(),
|
||||
dnses: i.getDnses(),
|
||||
httpProxyHost: i.httpProxyHost,
|
||||
httpProxyPort: i.httpProxyPort
|
||||
dnses: i.getDnses()
|
||||
});
|
||||
}
|
||||
return interfaces;
|
||||
@ -261,16 +260,16 @@ NetworkManager.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
getNetworkId: function(network) {
|
||||
getNetworkId: function(aNetworkInfo) {
|
||||
let id = "device";
|
||||
try {
|
||||
if (network instanceof Ci.nsIRilNetworkInterface) {
|
||||
let rilNetwork = network.QueryInterface(Ci.nsIRilNetworkInterface);
|
||||
id = "ril" + rilNetwork.serviceId;
|
||||
if (aNetworkInfo instanceof Ci.nsIRilNetworkInfo) {
|
||||
let rilInfo = aNetworkInfo.QueryInterface(Ci.nsIRilNetworkInfo);
|
||||
id = "ril" + rilInfo.serviceId;
|
||||
}
|
||||
} catch (e) {}
|
||||
|
||||
return id + "-" + network.type;
|
||||
return id + "-" + aNetworkInfo.type;
|
||||
},
|
||||
|
||||
// nsINetworkManager
|
||||
@ -280,7 +279,7 @@ NetworkManager.prototype = {
|
||||
throw Components.Exception("Argument must be nsINetworkInterface.",
|
||||
Cr.NS_ERROR_INVALID_ARG);
|
||||
}
|
||||
let networkId = this.getNetworkId(network);
|
||||
let networkId = this.getNetworkId(network.info);
|
||||
if (networkId in this.networkInterfaces) {
|
||||
throw Components.Exception("Network with that type already registered!",
|
||||
Cr.NS_ERROR_INVALID_ARG);
|
||||
@ -288,7 +287,7 @@ NetworkManager.prototype = {
|
||||
this.networkInterfaces[networkId] = network;
|
||||
this.networkInterfaceLinks[networkId] = new NetworkInterfaceLinks();
|
||||
|
||||
Services.obs.notifyObservers(network, TOPIC_INTERFACE_REGISTERED, null);
|
||||
Services.obs.notifyObservers(network.info, TOPIC_INTERFACE_REGISTERED, null);
|
||||
debug("Network '" + networkId + "' registered.");
|
||||
},
|
||||
|
||||
@ -316,65 +315,65 @@ NetworkManager.prototype = {
|
||||
throw Components.Exception("Argument must be nsINetworkInterface.",
|
||||
Cr.NS_ERROR_INVALID_ARG);
|
||||
}
|
||||
let networkId = this.getNetworkId(network);
|
||||
let networkId = this.getNetworkId(network.info);
|
||||
if (!(networkId in this.networkInterfaces)) {
|
||||
throw Components.Exception("No network with that type registered.",
|
||||
Cr.NS_ERROR_INVALID_ARG);
|
||||
}
|
||||
debug("Network " + network.type + "/" + network.name +
|
||||
" changed state to " + network.state);
|
||||
debug("Network " + network.info.type + "/" + network.info.name +
|
||||
" changed state to " + network.info.state);
|
||||
|
||||
// Keep a copy of network in case it is modified while we are updating.
|
||||
let networkInterface = new NetworkInterface(network);
|
||||
let extNetworkInfo = new ExtraNetworkInfo(network);
|
||||
|
||||
// Note that since Lollipop we need to allocate and initialize
|
||||
// something through netd, so we add createNetwork/destroyNetwork
|
||||
// to deal with that explicitly.
|
||||
|
||||
switch (networkInterface.state) {
|
||||
case Ci.nsINetworkInterface.NETWORK_STATE_CONNECTED:
|
||||
switch (extNetworkInfo.state) {
|
||||
case Ci.nsINetworkInfo.NETWORK_STATE_CONNECTED:
|
||||
|
||||
this._createNetwork(networkInterface.name)
|
||||
this._createNetwork(extNetworkInfo.name)
|
||||
// Remove pre-created default route and let setAndConfigureActive()
|
||||
// to set default route only on preferred network
|
||||
.then(() => this._removeDefaultRoute(networkInterface))
|
||||
.then(() => this._removeDefaultRoute(extNetworkInfo))
|
||||
// Set DNS server as early as possible to prevent from
|
||||
// premature domain name lookup.
|
||||
.then(() => this._setDNS(networkInterface))
|
||||
.then(() => this._setDNS(extNetworkInfo))
|
||||
.then(() => {
|
||||
// Add host route for data calls
|
||||
if (!this.isNetworkTypeMobile(networkInterface.type)) {
|
||||
if (!this.isNetworkTypeMobile(extNetworkInfo.type)) {
|
||||
return;
|
||||
}
|
||||
|
||||
let currentInterfaceLinks = this.networkInterfaceLinks[networkId];
|
||||
let newLinkRoutes = networkInterface.getDnses().concat(
|
||||
networkInterface.httpProxyHost);
|
||||
let newLinkRoutes = extNetworkInfo.getDnses().concat(
|
||||
extNetworkInfo.httpProxyHost);
|
||||
// If gateways have changed, remove all old routes first.
|
||||
return this._handleGateways(networkId, networkInterface.getGateways())
|
||||
return this._handleGateways(networkId, extNetworkInfo.getGateways())
|
||||
.then(() => this._updateRoutes(currentInterfaceLinks.linkRoutes,
|
||||
newLinkRoutes,
|
||||
networkInterface.getGateways(),
|
||||
networkInterface.name))
|
||||
extNetworkInfo.getGateways(),
|
||||
extNetworkInfo.name))
|
||||
.then(() => currentInterfaceLinks.setLinks(newLinkRoutes,
|
||||
networkInterface.getGateways(),
|
||||
networkInterface.name));
|
||||
extNetworkInfo.getGateways(),
|
||||
extNetworkInfo.name));
|
||||
})
|
||||
.then(() => {
|
||||
if (networkInterface.type !=
|
||||
Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_DUN) {
|
||||
if (extNetworkInfo.type !=
|
||||
Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE_DUN) {
|
||||
return;
|
||||
}
|
||||
// Dun type is a special case where we add the default route to a
|
||||
// secondary table.
|
||||
return this.setSecondaryDefaultRoute(networkInterface);
|
||||
return this.setSecondaryDefaultRoute(extNetworkInfo);
|
||||
})
|
||||
.then(() => this._addSubnetRoutes(networkInterface))
|
||||
.then(() => this._addSubnetRoutes(extNetworkInfo))
|
||||
.then(() => this.setAndConfigureActive())
|
||||
.then(() => {
|
||||
// Update data connection when Wifi connected/disconnected
|
||||
if (networkInterface.type ==
|
||||
Ci.nsINetworkInterface.NETWORK_TYPE_WIFI && this.mRil) {
|
||||
if (extNetworkInfo.type ==
|
||||
Ci.nsINetworkInfo.NETWORK_TYPE_WIFI && this.mRil) {
|
||||
for (let i = 0; i < this.mRil.numRadioInterfaces; i++) {
|
||||
this.mRil.getRadioInterface(i).updateRILNetworkInterface();
|
||||
}
|
||||
@ -382,70 +381,74 @@ NetworkManager.prototype = {
|
||||
|
||||
// Probing the public network accessibility after routing table is ready
|
||||
CaptivePortalDetectionHelper
|
||||
.notify(CaptivePortalDetectionHelper.EVENT_CONNECT, this.active);
|
||||
.notify(CaptivePortalDetectionHelper.EVENT_CONNECT,
|
||||
this.activeNetworkInfo);
|
||||
})
|
||||
.then(() => {
|
||||
// Notify outer modules like MmsService to start the transaction after
|
||||
// the configuration of the network interface is done.
|
||||
Services.obs.notifyObservers(network, TOPIC_CONNECTION_STATE_CHANGED,
|
||||
this.convertConnectionType(network));
|
||||
Services.obs.notifyObservers(network.info,
|
||||
TOPIC_CONNECTION_STATE_CHANGED,
|
||||
this.convertConnectionType(network.info));
|
||||
})
|
||||
.catch(aError => {
|
||||
debug("updateNetworkInterface error: " + aError);
|
||||
});
|
||||
break;
|
||||
case Ci.nsINetworkInterface.NETWORK_STATE_DISCONNECTED:
|
||||
case Ci.nsINetworkInfo.NETWORK_STATE_DISCONNECTED:
|
||||
Promise.resolve()
|
||||
.then(() => {
|
||||
if (!this.isNetworkTypeMobile(networkInterface.type)) {
|
||||
if (!this.isNetworkTypeMobile(extNetworkInfo.type)) {
|
||||
return;
|
||||
}
|
||||
// Remove host route for data calls
|
||||
return this._cleanupAllHostRoutes(networkId);
|
||||
})
|
||||
.then(() => {
|
||||
if (networkInterface.type !=
|
||||
Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_DUN) {
|
||||
if (extNetworkInfo.type !=
|
||||
Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE_DUN) {
|
||||
return;
|
||||
}
|
||||
// Remove secondary default route for dun.
|
||||
return this.removeSecondaryDefaultRoute(networkInterface);
|
||||
return this.removeSecondaryDefaultRoute(extNetworkInfo);
|
||||
})
|
||||
.then(() => {
|
||||
if (networkInterface.type == Ci.nsINetworkInterface.NETWORK_TYPE_WIFI) {
|
||||
if (extNetworkInfo.type == Ci.nsINetworkInfo.NETWORK_TYPE_WIFI) {
|
||||
// Remove routing table in /proc/net/route
|
||||
return this._resetRoutingTable(networkInterface.name);
|
||||
return this._resetRoutingTable(extNetworkInfo.name);
|
||||
}
|
||||
if (networkInterface.type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE) {
|
||||
return this._removeDefaultRoute(networkInterface)
|
||||
if (extNetworkInfo.type == Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE) {
|
||||
return this._removeDefaultRoute(extNetworkInfo)
|
||||
}
|
||||
})
|
||||
.then(() => {
|
||||
// Clear http proxy on active network.
|
||||
if (this.active && networkInterface.type == this.active.type) {
|
||||
if (this.activeNetworkInfo &&
|
||||
extNetworkInfo.type == this.activeNetworkInfo.type) {
|
||||
this.clearNetworkProxy();
|
||||
}
|
||||
|
||||
// Abort ongoing captive portal detection on the wifi interface
|
||||
CaptivePortalDetectionHelper
|
||||
.notify(CaptivePortalDetectionHelper.EVENT_DISCONNECT, networkInterface);
|
||||
.notify(CaptivePortalDetectionHelper.EVENT_DISCONNECT, extNetworkInfo);
|
||||
})
|
||||
.then(() => this.setAndConfigureActive())
|
||||
.then(() => {
|
||||
// Update data connection when Wifi connected/disconnected
|
||||
if (networkInterface.type ==
|
||||
Ci.nsINetworkInterface.NETWORK_TYPE_WIFI && this.mRil) {
|
||||
if (extNetworkInfo.type ==
|
||||
Ci.nsINetworkInfo.NETWORK_TYPE_WIFI && this.mRil) {
|
||||
for (let i = 0; i < this.mRil.numRadioInterfaces; i++) {
|
||||
this.mRil.getRadioInterface(i).updateRILNetworkInterface();
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(() => this._destroyNetwork(networkInterface.name))
|
||||
.then(() => this._destroyNetwork(extNetworkInfo.name))
|
||||
.then(() => {
|
||||
// Notify outer modules like MmsService to start the transaction after
|
||||
// the configuration of the network interface is done.
|
||||
Services.obs.notifyObservers(network, TOPIC_CONNECTION_STATE_CHANGED,
|
||||
this.convertConnectionType(network));
|
||||
Services.obs.notifyObservers(network.info,
|
||||
TOPIC_CONNECTION_STATE_CHANGED,
|
||||
this.convertConnectionType(network.info));
|
||||
})
|
||||
.catch(aError => {
|
||||
debug("updateNetworkInterface error: " + aError);
|
||||
@ -459,7 +462,7 @@ NetworkManager.prototype = {
|
||||
throw Components.Exception("Argument must be nsINetworkInterface.",
|
||||
Cr.NS_ERROR_INVALID_ARG);
|
||||
}
|
||||
let networkId = this.getNetworkId(network);
|
||||
let networkId = this.getNetworkId(network.info);
|
||||
if (!(networkId in this.networkInterfaces)) {
|
||||
throw Components.Exception("No network with that type registered.",
|
||||
Cr.NS_ERROR_INVALID_ARG);
|
||||
@ -467,13 +470,13 @@ NetworkManager.prototype = {
|
||||
|
||||
// This is for in case a network gets unregistered without being
|
||||
// DISCONNECTED.
|
||||
if (this.isNetworkTypeMobile(network.type)) {
|
||||
if (this.isNetworkTypeMobile(network.info.type)) {
|
||||
this._cleanupAllHostRoutes(networkId);
|
||||
}
|
||||
|
||||
delete this.networkInterfaces[networkId];
|
||||
|
||||
Services.obs.notifyObservers(network, TOPIC_INTERFACE_UNREGISTERED, null);
|
||||
Services.obs.notifyObservers(network.info, TOPIC_INTERFACE_UNREGISTERED, null);
|
||||
debug("Network '" + networkId + "' unregistered.");
|
||||
},
|
||||
|
||||
@ -488,19 +491,25 @@ NetworkManager.prototype = {
|
||||
return this._preferredNetworkType;
|
||||
},
|
||||
set preferredNetworkType(val) {
|
||||
if ([Ci.nsINetworkInterface.NETWORK_TYPE_WIFI,
|
||||
Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE].indexOf(val) == -1) {
|
||||
if ([Ci.nsINetworkInfo.NETWORK_TYPE_WIFI,
|
||||
Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE].indexOf(val) == -1) {
|
||||
throw "Invalid network type";
|
||||
}
|
||||
this._preferredNetworkType = val;
|
||||
},
|
||||
|
||||
active: null,
|
||||
_activeNetwork: null,
|
||||
|
||||
get activeNetworkInfo() {
|
||||
return this._activeNetwork && this._activeNetwork.info;
|
||||
},
|
||||
|
||||
_overriddenActive: null,
|
||||
|
||||
overrideActive: function(network) {
|
||||
if ([Ci.nsINetworkInterface.NETWORK_TYPE_WIFI,
|
||||
Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE].indexOf(val) == -1) {
|
||||
let type = network.info.type;
|
||||
if ([Ci.nsINetworkInfo.NETWORK_TYPE_WIFI,
|
||||
Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE].indexOf(type) == -1) {
|
||||
throw "Invalid network type";
|
||||
}
|
||||
|
||||
@ -548,10 +557,10 @@ NetworkManager.prototype = {
|
||||
return Promise.all(promises);
|
||||
},
|
||||
|
||||
isValidatedNetwork: function(network) {
|
||||
isValidatedNetwork: function(aNetworkInfo) {
|
||||
let isValid = false;
|
||||
try {
|
||||
isValid = (this.getNetworkId(network) in this.networkInterfaces);
|
||||
isValid = (this.getNetworkId(aNetworkInfo) in this.networkInterfaces);
|
||||
} catch (e) {
|
||||
debug("Invalid network interface: " + e);
|
||||
}
|
||||
@ -559,19 +568,19 @@ NetworkManager.prototype = {
|
||||
return isValid;
|
||||
},
|
||||
|
||||
addHostRoute: function(network, host) {
|
||||
if (!this.isValidatedNetwork(network)) {
|
||||
return Promise.reject("Invalid network interface.");
|
||||
addHostRoute: function(aNetworkInfo, aHost) {
|
||||
if (!this.isValidatedNetwork(aNetworkInfo)) {
|
||||
return Promise.reject("Invalid network info.");
|
||||
}
|
||||
|
||||
return this.resolveHostname(network, host)
|
||||
return this.resolveHostname(aNetworkInfo, aHost)
|
||||
.then((ipAddresses) => {
|
||||
let promises = [];
|
||||
let networkId = this.getNetworkId(network);
|
||||
let networkId = this.getNetworkId(aNetworkInfo);
|
||||
|
||||
ipAddresses.forEach((aIpAddress) => {
|
||||
let promise =
|
||||
this._setHostRoutes(true, [aIpAddress], network.name, network.getGateways())
|
||||
this._setHostRoutes(true, [aIpAddress], aNetworkInfo.name, aNetworkInfo.getGateways())
|
||||
.then(() => this.networkInterfaceLinks[networkId].extraRoutes.push(aIpAddress));
|
||||
|
||||
promises.push(promise);
|
||||
@ -581,15 +590,15 @@ NetworkManager.prototype = {
|
||||
});
|
||||
},
|
||||
|
||||
removeHostRoute: function(network, host) {
|
||||
if (!this.isValidatedNetwork(network)) {
|
||||
return Promise.reject("Invalid network interface.");
|
||||
removeHostRoute: function(aNetworkInfo, aHost) {
|
||||
if (!this.isValidatedNetwork(aNetworkInfo)) {
|
||||
return Promise.reject("Invalid network info.");
|
||||
}
|
||||
|
||||
return this.resolveHostname(network, host)
|
||||
return this.resolveHostname(aNetworkInfo, aHost)
|
||||
.then((ipAddresses) => {
|
||||
let promises = [];
|
||||
let networkId = this.getNetworkId(network);
|
||||
let networkId = this.getNetworkId(aNetworkInfo);
|
||||
|
||||
ipAddresses.forEach((aIpAddress) => {
|
||||
let found = this.networkInterfaceLinks[networkId].extraRoutes.indexOf(aIpAddress);
|
||||
@ -598,7 +607,7 @@ NetworkManager.prototype = {
|
||||
}
|
||||
|
||||
let promise =
|
||||
this._setHostRoutes(false, [aIpAddress], network.name, network.getGateways())
|
||||
this._setHostRoutes(false, [aIpAddress], aNetworkInfo.name, aNetworkInfo.getGateways())
|
||||
.then(() => {
|
||||
this.networkInterfaceLinks[networkId].extraRoutes.splice(found, 1);
|
||||
}, () => {
|
||||
@ -613,15 +622,15 @@ NetworkManager.prototype = {
|
||||
},
|
||||
|
||||
isNetworkTypeSecondaryMobile: function(type) {
|
||||
return (type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS ||
|
||||
type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_SUPL ||
|
||||
type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_IMS ||
|
||||
type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_DUN ||
|
||||
type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_FOTA);
|
||||
return (type == Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE_MMS ||
|
||||
type == Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE_SUPL ||
|
||||
type == Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE_IMS ||
|
||||
type == Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE_DUN ||
|
||||
type == Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE_FOTA);
|
||||
},
|
||||
|
||||
isNetworkTypeMobile: function(type) {
|
||||
return (type == Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE ||
|
||||
return (type == Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE ||
|
||||
this.isNetworkTypeSecondaryMobile(type));
|
||||
},
|
||||
|
||||
@ -765,62 +774,64 @@ NetworkManager.prototype = {
|
||||
*/
|
||||
setAndConfigureActive: function() {
|
||||
debug("Evaluating whether active network needs to be changed.");
|
||||
let oldActive = this.active;
|
||||
let oldActive = this._activeNetwork;
|
||||
|
||||
if (this._overriddenActive) {
|
||||
debug("We have an override for the active network: " +
|
||||
this._overriddenActive.name);
|
||||
this._overriddenActive.info.name);
|
||||
// The override was just set, so reconfigure the network.
|
||||
if (this.active != this._overriddenActive) {
|
||||
this.active = this._overriddenActive;
|
||||
this._setDefaultRouteAndProxy(this.active, oldActive);
|
||||
Services.obs.notifyObservers(this.active, TOPIC_ACTIVE_CHANGED, null);
|
||||
if (this._activeNetwork != this._overriddenActive) {
|
||||
this._activeNetwork = this._overriddenActive;
|
||||
this._setDefaultRouteAndProxy(this._activeNetwork, oldActive);
|
||||
Services.obs.notifyObservers(this.activeNetworkInfo,
|
||||
TOPIC_ACTIVE_CHANGED, null);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// The active network is already our preferred type.
|
||||
if (this.active &&
|
||||
this.active.state == Ci.nsINetworkInterface.NETWORK_STATE_CONNECTED &&
|
||||
this.active.type == this._preferredNetworkType) {
|
||||
if (this.activeNetworkInfo &&
|
||||
this.activeNetworkInfo.state == Ci.nsINetworkInfo.NETWORK_STATE_CONNECTED &&
|
||||
this.activeNetworkInfo.type == this._preferredNetworkType) {
|
||||
debug("Active network is already our preferred type.");
|
||||
return this._setDefaultRouteAndProxy(this.active, oldActive);
|
||||
return this._setDefaultRouteAndProxy(this._activeNetwork, oldActive);
|
||||
}
|
||||
|
||||
// Find a suitable network interface to activate.
|
||||
this.active = null;
|
||||
this._activeNetwork = null;
|
||||
let anyConnected = false;
|
||||
|
||||
for each (let network in this.networkInterfaces) {
|
||||
if (network.state != Ci.nsINetworkInterface.NETWORK_STATE_CONNECTED) {
|
||||
if (network.info.state != Ci.nsINetworkInfo.NETWORK_STATE_CONNECTED) {
|
||||
continue;
|
||||
}
|
||||
anyConnected = true;
|
||||
|
||||
// Set active only for default connections.
|
||||
if (network.type != Ci.nsINetworkInterface.NETWORK_TYPE_WIFI &&
|
||||
network.type != Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE) {
|
||||
if (network.info.type != Ci.nsINetworkInfo.NETWORK_TYPE_WIFI &&
|
||||
network.info.type != Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE) {
|
||||
continue;
|
||||
}
|
||||
|
||||
this.active = network;
|
||||
if (network.type == this.preferredNetworkType) {
|
||||
debug("Found our preferred type of network: " + network.name);
|
||||
this._activeNetwork = network;
|
||||
if (network.info.type == this.preferredNetworkType) {
|
||||
debug("Found our preferred type of network: " + network.info.name);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return Promise.resolve()
|
||||
.then(() => {
|
||||
if (!this.active) {
|
||||
if (!this._activeNetwork) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
return this._setDefaultRouteAndProxy(this.active, oldActive);
|
||||
return this._setDefaultRouteAndProxy(this._activeNetwork, oldActive);
|
||||
})
|
||||
.then(() => {
|
||||
if (this.active != oldActive) {
|
||||
Services.obs.notifyObservers(this.active, TOPIC_ACTIVE_CHANGED, null);
|
||||
if (this._activeNetwork != oldActive) {
|
||||
Services.obs.notifyObservers(this.activeNetworkInfo,
|
||||
TOPIC_ACTIVE_CHANGED, null);
|
||||
}
|
||||
|
||||
if (this._manageOfflineStatus) {
|
||||
@ -829,15 +840,15 @@ NetworkManager.prototype = {
|
||||
});
|
||||
},
|
||||
|
||||
resolveHostname: function(network, hostname) {
|
||||
resolveHostname: function(aNetworkInfo, aHostname) {
|
||||
// Sanity check for null, undefined and empty string... etc.
|
||||
if (!hostname) {
|
||||
return Promise.reject(new Error("hostname is empty: " + hostname));
|
||||
if (!aHostname) {
|
||||
return Promise.reject(new Error("hostname is empty: " + aHostname));
|
||||
}
|
||||
|
||||
if (hostname.match(this.REGEXP_IPV4) ||
|
||||
hostname.match(this.REGEXP_IPV6)) {
|
||||
return Promise.resolve([hostname]);
|
||||
if (aHostname.match(this.REGEXP_IPV4) ||
|
||||
aHostname.match(this.REGEXP_IPV6)) {
|
||||
return Promise.resolve([aHostname]);
|
||||
}
|
||||
|
||||
// Wrap gDNSService.asyncResolveExtended to a promise, which
|
||||
@ -848,7 +859,7 @@ NetworkManager.prototype = {
|
||||
// Callback for gDNSService.asyncResolveExtended.
|
||||
let onLookupComplete = (aRequest, aRecord, aStatus) => {
|
||||
if (!Components.isSuccessCode(aStatus)) {
|
||||
aReject(new Error("Failed to resolve '" + hostname +
|
||||
aReject(new Error("Failed to resolve '" + aHostname +
|
||||
"', with status: " + aStatus));
|
||||
return;
|
||||
}
|
||||
@ -863,14 +874,14 @@ NetworkManager.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
debug("hostname is resolved: " + hostname);
|
||||
debug("hostname is resolved: " + aHostname);
|
||||
debug("Addresses: " + JSON.stringify(retval));
|
||||
|
||||
aResolve(retval);
|
||||
};
|
||||
|
||||
debug('Calling gDNSService.asyncResolveExtended: ' + aNetId + ', ' + hostname);
|
||||
gDNSService.asyncResolveExtended(hostname,
|
||||
debug('Calling gDNSService.asyncResolveExtended: ' + aNetId + ', ' + aHostname);
|
||||
gDNSService.asyncResolveExtended(aHostname,
|
||||
0,
|
||||
aNetId,
|
||||
onLookupComplete,
|
||||
@ -880,36 +891,36 @@ NetworkManager.prototype = {
|
||||
|
||||
// TODO: |getNetId| will be implemented as a sync call in nsINetworkManager
|
||||
// once Bug 1141903 is landed.
|
||||
return gNetworkService.getNetId(network.name)
|
||||
return gNetworkService.getNetId(aNetworkInfo.name)
|
||||
.then(aNetId => hostResolveWrapper(aNetId));
|
||||
},
|
||||
|
||||
convertConnectionType: function(network) {
|
||||
convertConnectionType: function(aNetworkInfo) {
|
||||
// If there is internal interface change (e.g., MOBILE_MMS, MOBILE_SUPL),
|
||||
// the function will return null so that it won't trigger type change event
|
||||
// in NetworkInformation API.
|
||||
if (network.type != Ci.nsINetworkInterface.NETWORK_TYPE_WIFI &&
|
||||
network.type != Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE) {
|
||||
if (aNetworkInfo.type != Ci.nsINetworkInfo.NETWORK_TYPE_WIFI &&
|
||||
aNetworkInfo.type != Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (network.state == Ci.nsINetworkInterface.NETWORK_STATE_DISCONNECTED) {
|
||||
if (aNetworkInfo.state == Ci.nsINetworkInfo.NETWORK_STATE_DISCONNECTED) {
|
||||
return CONNECTION_TYPE_NONE;
|
||||
}
|
||||
|
||||
switch (network.type) {
|
||||
case Ci.nsINetworkInterface.NETWORK_TYPE_WIFI:
|
||||
switch (aNetworkInfo.type) {
|
||||
case Ci.nsINetworkInfo.NETWORK_TYPE_WIFI:
|
||||
return CONNECTION_TYPE_WIFI;
|
||||
case Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE:
|
||||
case Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE:
|
||||
return CONNECTION_TYPE_CELLULAR;
|
||||
}
|
||||
},
|
||||
|
||||
_setDNS: function(aNetwork) {
|
||||
_setDNS: function(aNetworkInfo) {
|
||||
return new Promise((aResolve, aReject) => {
|
||||
let dnses = aNetwork.getDnses();
|
||||
let gateways = aNetwork.getGateways();
|
||||
gNetworkService.setDNS(aNetwork.name, dnses.length, dnses,
|
||||
let dnses = aNetworkInfo.getDnses();
|
||||
let gateways = aNetworkInfo.getGateways();
|
||||
gNetworkService.setDNS(aNetworkInfo.name, dnses.length, dnses,
|
||||
gateways.length, gateways, (aError) => {
|
||||
if (aError) {
|
||||
aReject("setDNS failed");
|
||||
@ -956,10 +967,10 @@ NetworkManager.prototype = {
|
||||
});
|
||||
},
|
||||
|
||||
_removeDefaultRoute: function(aNetwork) {
|
||||
_removeDefaultRoute: function(aNetworkInfo) {
|
||||
return new Promise((aResolve, aReject) => {
|
||||
let gateways = aNetwork.getGateways();
|
||||
gNetworkService.removeDefaultRoute(aNetwork.name, gateways.length,
|
||||
let gateways = aNetworkInfo.getGateways();
|
||||
gNetworkService.removeDefaultRoute(aNetworkInfo.name, gateways.length,
|
||||
gateways, (aSuccess) => {
|
||||
if (!aSuccess) {
|
||||
debug("removeDefaultRoute failed");
|
||||
@ -972,12 +983,13 @@ NetworkManager.prototype = {
|
||||
|
||||
_setDefaultRouteAndProxy: function(aNetwork, aOldInterface) {
|
||||
return new Promise((aResolve, aReject) => {
|
||||
let gateways = aNetwork.getGateways();
|
||||
let oldInterfaceName = (aOldInterface ? aOldInterface.name : "");
|
||||
gNetworkService.setDefaultRoute(aNetwork.name, gateways.length, gateways,
|
||||
let networkInfo = aNetwork.info;
|
||||
let gateways = networkInfo.getGateways();
|
||||
let oldInterfaceName = (aOldInterface ? aOldInterface.info.name : "");
|
||||
gNetworkService.setDefaultRoute(networkInfo.name, gateways.length, gateways,
|
||||
oldInterfaceName, (aSuccess) => {
|
||||
if (!aSuccess) {
|
||||
gNetworkService.destroyNetwork(aNetwork, function() {
|
||||
gNetworkService.destroyNetwork(networkInfo.name, function() {
|
||||
aReject("setDefaultRoute failed");
|
||||
});
|
||||
return;
|
||||
@ -988,23 +1000,23 @@ NetworkManager.prototype = {
|
||||
});
|
||||
},
|
||||
|
||||
setNetworkProxy: function(network) {
|
||||
setNetworkProxy: function(aNetwork) {
|
||||
try {
|
||||
if (!network.httpProxyHost || network.httpProxyHost === "") {
|
||||
if (!aNetwork.httpProxyHost || aNetwork.httpProxyHost === "") {
|
||||
// Sets direct connection to internet.
|
||||
this.clearNetworkProxy();
|
||||
|
||||
debug("No proxy support for " + network.name + " network interface.");
|
||||
debug("No proxy support for " + aNetwork.info.name + " network interface.");
|
||||
return;
|
||||
}
|
||||
|
||||
debug("Going to set proxy settings for " + network.name + " network interface.");
|
||||
debug("Going to set proxy settings for " + aNetwork.info.name + " network interface.");
|
||||
|
||||
// Do not use this proxy server for all protocols.
|
||||
Services.prefs.setBoolPref("network.proxy.share_proxy_settings", false);
|
||||
Services.prefs.setCharPref("network.proxy.http", network.httpProxyHost);
|
||||
Services.prefs.setCharPref("network.proxy.ssl", network.httpProxyHost);
|
||||
let port = network.httpProxyPort === 0 ? 8080 : network.httpProxyPort;
|
||||
Services.prefs.setCharPref("network.proxy.http", aNetwork.httpProxyHost);
|
||||
Services.prefs.setCharPref("network.proxy.ssl", aNetwork.httpProxyHost);
|
||||
let port = aNetwork.httpProxyPort === 0 ? 8080 : aNetwork.httpProxyPort;
|
||||
Services.prefs.setIntPref("network.proxy.http_port", port);
|
||||
Services.prefs.setIntPref("network.proxy.ssl_port", port);
|
||||
|
||||
@ -1022,7 +1034,7 @@ NetworkManager.prototype = {
|
||||
}
|
||||
} catch(ex) {
|
||||
debug("Exception " + ex + ". Unable to set proxy setting for " +
|
||||
network.name + " network interface.");
|
||||
aNetwork.info.name + " network interface.");
|
||||
}
|
||||
},
|
||||
|
||||
@ -1105,7 +1117,7 @@ let CaptivePortalDetectionHelper = (function() {
|
||||
case EVENT_CONNECT:
|
||||
// perform captive portal detection on wifi interface
|
||||
if (_available && network &&
|
||||
network.type == Ci.nsINetworkInterface.NETWORK_TYPE_WIFI) {
|
||||
network.type == Ci.nsINetworkInfo.NETWORK_TYPE_WIFI) {
|
||||
_performDetection(network.name, function() {
|
||||
// TODO: bug 837600
|
||||
// We can disconnect wifi in here if user abort the login procedure.
|
||||
@ -1115,7 +1127,7 @@ let CaptivePortalDetectionHelper = (function() {
|
||||
break;
|
||||
case EVENT_DISCONNECT:
|
||||
if (_available &&
|
||||
network.type == Ci.nsINetworkInterface.NETWORK_TYPE_WIFI) {
|
||||
network.type == Ci.nsINetworkInfo.NETWORK_TYPE_WIFI) {
|
||||
_abort(network.name);
|
||||
}
|
||||
break;
|
||||
|
@ -60,8 +60,8 @@ const kPrefRilDebuggingEnabled = "ril.debugging.enabled";
|
||||
const RADIO_POWER_OFF_TIMEOUT = 30000;
|
||||
const HW_DEFAULT_CLIENT_ID = 0;
|
||||
|
||||
const NETWORK_TYPE_WIFI = Ci.nsINetworkInterface.NETWORK_TYPE_WIFI;
|
||||
const NETWORK_TYPE_MOBILE = Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE;
|
||||
const NETWORK_TYPE_WIFI = Ci.nsINetworkInfo.NETWORK_TYPE_WIFI;
|
||||
const NETWORK_TYPE_MOBILE = Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE;
|
||||
|
||||
// set to true in ril_consts.js to see debug messages
|
||||
var DEBUG = RIL.DEBUG_RIL;
|
||||
@ -1148,21 +1148,21 @@ RadioInterface.prototype = {
|
||||
this._sntp.updateOffset(offset);
|
||||
break;
|
||||
case kNetworkConnStateChangedTopic:
|
||||
let network = subject.QueryInterface(Ci.nsINetworkInterface);
|
||||
if (network.state != Ci.nsINetworkInterface.NETWORK_STATE_CONNECTED) {
|
||||
let networkInfo = subject.QueryInterface(Ci.nsINetworkInfo);
|
||||
if (networkInfo.state != Ci.nsINetworkInfo.NETWORK_STATE_CONNECTED) {
|
||||
return;
|
||||
}
|
||||
|
||||
// SNTP can only update when we have mobile or Wifi connections.
|
||||
if (network.type != NETWORK_TYPE_WIFI &&
|
||||
network.type != NETWORK_TYPE_MOBILE) {
|
||||
if (networkInfo.type != NETWORK_TYPE_WIFI &&
|
||||
networkInfo.type != NETWORK_TYPE_MOBILE) {
|
||||
return;
|
||||
}
|
||||
|
||||
// If the network comes from RIL, make sure the RIL service is matched.
|
||||
if (subject instanceof Ci.nsIRilNetworkInterface) {
|
||||
network = subject.QueryInterface(Ci.nsIRilNetworkInterface);
|
||||
if (network.serviceId != this.clientId) {
|
||||
if (subject instanceof Ci.nsIRilNetworkInfo) {
|
||||
networkInfo = subject.QueryInterface(Ci.nsIRilNetworkInfo);
|
||||
if (networkInfo.serviceId != this.clientId) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1242,8 +1242,9 @@ RadioInterface.prototype = {
|
||||
// Set the latest cached NITZ time if it's available.
|
||||
if (this._lastNitzMessage) {
|
||||
this.setClockByNitz(this._lastNitzMessage);
|
||||
} else if (gNetworkManager.active && gNetworkManager.active.state ==
|
||||
Ci.nsINetworkInterface.NETWORK_STATE_CONNECTED) {
|
||||
} else if (gNetworkManager.activeNetworkInfo &&
|
||||
gNetworkManager.activeNetworkInfo.state ==
|
||||
Ci.nsINetworkInfo.NETWORK_STATE_CONNECTED) {
|
||||
// Set the latest cached SNTP time if it's available.
|
||||
if (!this._sntp.isExpired()) {
|
||||
this.setClockBySntp(this._sntp.getOffset());
|
||||
|
@ -248,7 +248,7 @@ TetheringService.prototype = {
|
||||
this.handle(aSubject.key, aSubject.value);
|
||||
break;
|
||||
case TOPIC_CONNECTION_STATE_CHANGED:
|
||||
network = aSubject.QueryInterface(Ci.nsINetworkInterface);
|
||||
network = aSubject.QueryInterface(Ci.nsINetworkInfo);
|
||||
debug("Network " + network.type + "/" + network.name +
|
||||
" changed state to " + network.state);
|
||||
this.onConnectionChanged(network);
|
||||
@ -338,18 +338,18 @@ TetheringService.prototype = {
|
||||
libcutils.property_get("ro.tethering.dun_required") === "1";
|
||||
},
|
||||
|
||||
getNetworkInterface: function(aType, aServiceId) {
|
||||
for each (let network in gNetworkManager.networkInterfaces) {
|
||||
if (network.type == aType) {
|
||||
getNetworkInfo: function(aType, aServiceId) {
|
||||
for each (let networkInfo in gNetworkManager.allNetworkInfo) {
|
||||
if (networkInfo.type == aType) {
|
||||
try {
|
||||
if (network instanceof Ci.nsIRilNetworkInterface) {
|
||||
let rilNetwork = network.QueryInterface(Ci.nsIRilNetworkInterface);
|
||||
if (networkInfo instanceof Ci.nsIRilNetworkInfo) {
|
||||
let rilNetwork = networkInfo.QueryInterface(Ci.nsIRilNetworkInfo);
|
||||
if (rilNetwork.serviceId != aServiceId) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
} catch (e) {}
|
||||
return network;
|
||||
return networkInfo;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@ -405,7 +405,7 @@ TetheringService.prototype = {
|
||||
let ril = gRil.getRadioInterface(this._dataDefaultServiceId);
|
||||
|
||||
this.dunRetryTimes = 0;
|
||||
ril.setupDataCallByType(Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_DUN);
|
||||
ril.setupDataCallByType(Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE_DUN);
|
||||
this.dunConnectTimer.cancel();
|
||||
this.dunConnectTimer.
|
||||
initWithCallback(this.onDunConnectTimerTimeout.bind(this),
|
||||
@ -430,8 +430,8 @@ TetheringService.prototype = {
|
||||
_dunActiveUsers: 0,
|
||||
handleDunConnection: function(aEnable, aCallback) {
|
||||
debug("handleDunConnection: " + aEnable);
|
||||
let dun = this.getNetworkInterface(
|
||||
Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_DUN, this._dataDefaultServiceId);
|
||||
let dun = this.getNetworkInfo(
|
||||
Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE_DUN, this._dataDefaultServiceId);
|
||||
|
||||
if (!aEnable) {
|
||||
this._dunActiveUsers--;
|
||||
@ -445,15 +445,15 @@ TetheringService.prototype = {
|
||||
this.dunConnectTimer.cancel();
|
||||
this._pendingTetheringRequests = [];
|
||||
|
||||
if (dun && (dun.state == Ci.nsINetworkInterface.NETWORK_STATE_CONNECTED)) {
|
||||
if (dun && (dun.state == Ci.nsINetworkInfo.NETWORK_STATE_CONNECTED)) {
|
||||
gRil.getRadioInterface(this._dataDefaultServiceId)
|
||||
.deactivateDataCallByType(Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_DUN);
|
||||
.deactivateDataCallByType(Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE_DUN);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
this._dunActiveUsers++;
|
||||
if (!dun || (dun.state != Ci.nsINetworkInterface.NETWORK_STATE_CONNECTED)) {
|
||||
if (!dun || (dun.state != Ci.nsINetworkInfo.NETWORK_STATE_CONNECTED)) {
|
||||
debug("DUN data call inactive, setup dun data call!")
|
||||
this._pendingTetheringRequests.push(aCallback);
|
||||
this.dunRetryTimes = 0;
|
||||
@ -495,23 +495,24 @@ TetheringService.prototype = {
|
||||
this._usbTetheringAction = TETHERING_STATE_ONGOING;
|
||||
|
||||
if (this.tetheringSettings[SETTINGS_DUN_REQUIRED]) {
|
||||
this.handleDunConnection(true, (aNetwork) => {
|
||||
if (!aNetwork){
|
||||
this.handleDunConnection(true, (aNetworkInfo) => {
|
||||
if (!aNetworkInfo){
|
||||
this.usbTetheringResultReport(aEnable, "Dun connection failed");
|
||||
return;
|
||||
}
|
||||
this._tetheringInterface[TETHERING_TYPE_USB].externalInterface = aNetwork.name;
|
||||
this._tetheringInterface[TETHERING_TYPE_USB].externalInterface =
|
||||
aNetworkInfo.name;
|
||||
gNetworkService.enableUsbRndis(true, this.enableUsbRndisResult.bind(this));
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if (gNetworkManager.active) {
|
||||
if (gNetworkManager.activeNetworkInfo) {
|
||||
this._tetheringInterface[TETHERING_TYPE_USB].externalInterface =
|
||||
gNetworkManager.active.name;
|
||||
gNetworkManager.activeNetworkInfo.name;
|
||||
} else {
|
||||
let mobile = this.getNetworkInterface(
|
||||
Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE, this._dataDefaultServiceId);
|
||||
let mobile = this.getNetworkInfo(
|
||||
Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE, this._dataDefaultServiceId);
|
||||
if (mobile && mobile.name) {
|
||||
this._tetheringInterface[TETHERING_TYPE_USB].externalInterface = mobile.name;
|
||||
}
|
||||
@ -599,10 +600,10 @@ TetheringService.prototype = {
|
||||
},
|
||||
|
||||
// Enable/disable WiFi tethering by sending commands to netd.
|
||||
setWifiTethering: function(aEnable, aNetwork, aConfig, aCallback) {
|
||||
setWifiTethering: function(aEnable, aInterfaceName, aConfig, aCallback) {
|
||||
debug("setWifiTethering: " + aEnable);
|
||||
if (!aNetwork) {
|
||||
this.notifyError(true, aCallback, "invalid network information");
|
||||
if (!aInterfaceName) {
|
||||
this.notifyError(true, aCallback, "invalid network interface name");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -630,22 +631,24 @@ TetheringService.prototype = {
|
||||
return;
|
||||
}
|
||||
|
||||
this._tetheringInterface[TETHERING_TYPE_WIFI].internalInterface = aNetwork.name;
|
||||
this._tetheringInterface[TETHERING_TYPE_WIFI].internalInterface =
|
||||
aInterfaceName;
|
||||
|
||||
if (this.tetheringSettings[SETTINGS_DUN_REQUIRED]) {
|
||||
this.handleDunConnection(true, (aNetwork) => {
|
||||
if (!aNetwork) {
|
||||
this.handleDunConnection(true, (aNetworkInfo) => {
|
||||
if (!aNetworkInfo) {
|
||||
this.notifyError(true, aCallback, "Dun connection failed");
|
||||
return;
|
||||
}
|
||||
this._tetheringInterface[TETHERING_TYPE_WIFI].externalInterface = aNetwork.name;
|
||||
this._tetheringInterface[TETHERING_TYPE_WIFI].externalInterface =
|
||||
aNetworkInfo.name;
|
||||
this.enableWifiTethering(true, aConfig, aCallback);
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
let mobile = this.getNetworkInterface(
|
||||
Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE, this._dataDefaultServiceId);
|
||||
let mobile = this.getNetworkInfo(
|
||||
Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE, this._dataDefaultServiceId);
|
||||
// Update the real interface name
|
||||
if (mobile && mobile.name) {
|
||||
this._tetheringInterface[TETHERING_TYPE_WIFI].externalInterface = mobile.name;
|
||||
@ -745,20 +748,20 @@ TetheringService.prototype = {
|
||||
}
|
||||
},
|
||||
|
||||
onConnectionChanged: function(aNetwork) {
|
||||
if (aNetwork.state != Ci.nsINetworkInterface.NETWORK_STATE_CONNECTED) {
|
||||
onConnectionChanged: function(aNetworkInfo) {
|
||||
if (aNetworkInfo.state != Ci.nsINetworkInfo.NETWORK_STATE_CONNECTED) {
|
||||
debug("We are only interested in CONNECTED event");
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.tetheringSettings[SETTINGS_DUN_REQUIRED] &&
|
||||
aNetwork.type === Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_DUN) {
|
||||
aNetworkInfo.type === Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE_DUN) {
|
||||
this.dunConnectTimer.cancel();
|
||||
debug("DUN data call connected, process callbacks.");
|
||||
while (this._pendingTetheringRequests.length > 0) {
|
||||
let callback = this._pendingTetheringRequests.shift();
|
||||
if (typeof callback === 'function') {
|
||||
callback(aNetwork);
|
||||
callback(aNetworkInfo);
|
||||
}
|
||||
}
|
||||
return;
|
||||
@ -770,15 +773,15 @@ TetheringService.prototype = {
|
||||
}
|
||||
|
||||
if (this.tetheringSettings[SETTINGS_DUN_REQUIRED] &&
|
||||
aNetwork.type === Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_DUN &&
|
||||
aNetworkInfo.type === Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE_DUN &&
|
||||
this._tetheringInterface[TETHERING_TYPE_USB].externalInterface ===
|
||||
aNetwork.name) {
|
||||
aNetworkInfo.name) {
|
||||
debug("Dun required and dun interface is the same");
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._tetheringInterface[TETHERING_TYPE_USB].externalInterface ===
|
||||
gNetworkManager.active.name) {
|
||||
gNetworkManager.activeNetworkInfo.name) {
|
||||
debug("The active interface is the same");
|
||||
return;
|
||||
}
|
||||
@ -790,12 +793,12 @@ TetheringService.prototype = {
|
||||
|
||||
let current = {
|
||||
internalIfname: this._tetheringInterface[TETHERING_TYPE_USB].internalInterface,
|
||||
externalIfname: aNetwork.name
|
||||
externalIfname: aNetworkInfo.name
|
||||
};
|
||||
|
||||
let callback = (() => {
|
||||
// Update external network interface.
|
||||
debug("Update upstream interface to " + aNetwork.name);
|
||||
debug("Update upstream interface to " + aNetworkInfo.name);
|
||||
gNetworkService.updateUpStream(previous, current,
|
||||
this.onConnectionChangedReport.bind(this));
|
||||
});
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
XPIDL_SOURCES += [
|
||||
'nsIAudioManager.idl',
|
||||
'nsINetworkInterface.idl',
|
||||
'nsINetworkInterfaceListService.idl',
|
||||
'nsINetworkManager.idl',
|
||||
'nsINetworkService.idl',
|
||||
|
@ -3,10 +3,10 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsINetworkManager.idl"
|
||||
#include "nsINetworkInterface.idl"
|
||||
|
||||
[scriptable, uuid(b8ce8528-fce8-4b5e-9d0a-c3247296ccaf)]
|
||||
interface nsIRilNetworkInterface : nsINetworkInterface
|
||||
[scriptable, uuid(501b7041-0754-4ddb-9174-946e2c2ebd83)]
|
||||
interface nsIRilNetworkInfo : nsINetworkInfo
|
||||
{
|
||||
readonly attribute unsigned long serviceId;
|
||||
readonly attribute DOMString iccId;
|
||||
|
100
dom/system/gonk/nsINetworkInterface.idl
Normal file
100
dom/system/gonk/nsINetworkInterface.idl
Normal file
@ -0,0 +1,100 @@
|
||||
/* 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/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(f439ab5d-64bd-4a6c-8863-30235fa784d2)]
|
||||
interface nsINetworkInfo : nsISupports
|
||||
{
|
||||
const long NETWORK_STATE_UNKNOWN = -1;
|
||||
const long NETWORK_STATE_CONNECTING = 0;
|
||||
const long NETWORK_STATE_CONNECTED = 1;
|
||||
const long NETWORK_STATE_DISCONNECTING = 2;
|
||||
const long NETWORK_STATE_DISCONNECTED = 3;
|
||||
|
||||
/**
|
||||
* Current network state, one of the NETWORK_STATE_* constants.
|
||||
*
|
||||
* When this changes, network interface implementations notify with
|
||||
* updateNetworkInterface() API.
|
||||
*/
|
||||
readonly attribute long state;
|
||||
|
||||
const long NETWORK_TYPE_UNKNOWN = -1;
|
||||
const long NETWORK_TYPE_WIFI = 0;
|
||||
const long NETWORK_TYPE_MOBILE = 1;
|
||||
const long NETWORK_TYPE_MOBILE_MMS = 2;
|
||||
const long NETWORK_TYPE_MOBILE_SUPL = 3;
|
||||
const long NETWORK_TYPE_WIFI_P2P = 4;
|
||||
const long NETWORK_TYPE_MOBILE_IMS = 5;
|
||||
const long NETWORK_TYPE_MOBILE_DUN = 6;
|
||||
const long NETWORK_TYPE_MOBILE_FOTA = 7;
|
||||
|
||||
/**
|
||||
* Network type. One of the NETWORK_TYPE_* constants.
|
||||
*/
|
||||
readonly attribute long type;
|
||||
|
||||
/**
|
||||
* Interface name of the network interface this network info belongs to.
|
||||
*/
|
||||
readonly attribute DOMString name;
|
||||
|
||||
/**
|
||||
* Get the list of ip addresses and prefix lengths, ip address could be IPv4
|
||||
* or IPv6, typically 1 IPv4 or 1 IPv6 or one of each.
|
||||
*
|
||||
* @param ips
|
||||
* The list of ip addresses retrieved.
|
||||
* @param prefixLengths
|
||||
* The list of prefix lengths retrieved.
|
||||
*
|
||||
* @returns the length of the lists.
|
||||
*/
|
||||
void getAddresses([array, size_is(count)] out wstring ips,
|
||||
[array, size_is(count)] out unsigned long prefixLengths,
|
||||
[retval] out unsigned long count);
|
||||
|
||||
/**
|
||||
* Get the list of gateways, could be IPv4 or IPv6, typically 1 IPv4 or 1
|
||||
* IPv6 or one of each.
|
||||
*
|
||||
* @param count
|
||||
* The length of the list of gateways
|
||||
*
|
||||
* @returns the list of gateways.
|
||||
*/
|
||||
void getGateways([optional] out unsigned long count,
|
||||
[array, size_is(count), retval] out wstring gateways);
|
||||
|
||||
/**
|
||||
* Get the list of dnses, could be IPv4 or IPv6.
|
||||
*
|
||||
* @param count
|
||||
* The length of the list of dnses.
|
||||
*
|
||||
* @returns the list of dnses.
|
||||
*/
|
||||
void getDnses([optional] out unsigned long count,
|
||||
[array, size_is(count), retval] out wstring dnses);
|
||||
};
|
||||
|
||||
[scriptable, uuid(9a025351-8684-4ab5-a0c1-f21a9f83d405)]
|
||||
interface nsINetworkInterface : nsISupports
|
||||
{
|
||||
/**
|
||||
* The network information about this network interface.
|
||||
*/
|
||||
readonly attribute nsINetworkInfo info;
|
||||
|
||||
/**
|
||||
* The host name of the http proxy server.
|
||||
*/
|
||||
readonly attribute DOMString httpProxyHost;
|
||||
|
||||
/*
|
||||
* The port number of the http proxy server.
|
||||
*/
|
||||
readonly attribute long httpProxyPort;
|
||||
};
|
@ -2,10 +2,11 @@
|
||||
* 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/. */
|
||||
|
||||
#include "nsINetworkManager.idl"
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[scriptable, uuid(b44d74db-c9d6-41dd-98ae-a56918d6e6ad)]
|
||||
interface nsINetworkInfo;
|
||||
|
||||
[scriptable, uuid(55779d32-1e28-4f43-af87-09d04bc3cce9)]
|
||||
interface nsINetworkInterfaceList : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -14,10 +15,10 @@ interface nsINetworkInterfaceList : nsISupports
|
||||
long getNumberOfInterface();
|
||||
|
||||
/**
|
||||
* Get the i-th interface from the list.
|
||||
* Get the i-th interface info info from the list.
|
||||
* @param interfaceIndex index of interface, from 0 to number of interface - 1.
|
||||
*/
|
||||
nsINetworkInterface getInterface(in long interfaceIndex);
|
||||
nsINetworkInfo getInterfaceInfo(in long interfaceIndex);
|
||||
};
|
||||
|
||||
[scriptable, uuid(21d7fc8b-28c4-4a4f-a15e-1f9defbc2cec)]
|
||||
|
@ -4,99 +4,13 @@
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
/**
|
||||
* Information about networks that is exposed to network manager API consumers.
|
||||
*/
|
||||
[scriptable, uuid(12da2bfd-0801-40d9-9c2e-768868526065)]
|
||||
interface nsINetworkInterface : nsISupports
|
||||
{
|
||||
const long NETWORK_STATE_UNKNOWN = -1;
|
||||
const long NETWORK_STATE_CONNECTING = 0;
|
||||
const long NETWORK_STATE_CONNECTED = 1;
|
||||
const long NETWORK_STATE_DISCONNECTING = 2;
|
||||
const long NETWORK_STATE_DISCONNECTED = 3;
|
||||
|
||||
/**
|
||||
* Current network state, one of the NETWORK_STATE_* constants.
|
||||
*
|
||||
* When this changes, network interface implementations notify with
|
||||
* updateNetworkInterface() API.
|
||||
*/
|
||||
readonly attribute long state;
|
||||
|
||||
const long NETWORK_TYPE_UNKNOWN = -1;
|
||||
const long NETWORK_TYPE_WIFI = 0;
|
||||
const long NETWORK_TYPE_MOBILE = 1;
|
||||
const long NETWORK_TYPE_MOBILE_MMS = 2;
|
||||
const long NETWORK_TYPE_MOBILE_SUPL = 3;
|
||||
const long NETWORK_TYPE_WIFI_P2P = 4;
|
||||
const long NETWORK_TYPE_MOBILE_IMS = 5;
|
||||
const long NETWORK_TYPE_MOBILE_DUN = 6;
|
||||
const long NETWORK_TYPE_MOBILE_FOTA = 7;
|
||||
|
||||
/**
|
||||
* Network type. One of the NETWORK_TYPE_* constants.
|
||||
*/
|
||||
readonly attribute long type;
|
||||
|
||||
/**
|
||||
* Name of the network interface. This identifier is unique.
|
||||
*/
|
||||
readonly attribute DOMString name;
|
||||
|
||||
/**
|
||||
* The host name of the http proxy server.
|
||||
*/
|
||||
readonly attribute DOMString httpProxyHost;
|
||||
|
||||
/*
|
||||
* The port number of the http proxy server.
|
||||
*/
|
||||
readonly attribute long httpProxyPort;
|
||||
|
||||
/**
|
||||
* Get the list of ip addresses and prefix lengths, ip address could be IPv4
|
||||
* or IPv6, typically 1 IPv4 or 1 IPv6 or one of each.
|
||||
*
|
||||
* @param ips
|
||||
* The list of ip addresses retrieved.
|
||||
* @param prefixLengths
|
||||
* The list of prefix lengths retrieved.
|
||||
*
|
||||
* @returns the length of the lists.
|
||||
*/
|
||||
void getAddresses([array, size_is(count)] out wstring ips,
|
||||
[array, size_is(count)] out unsigned long prefixLengths,
|
||||
[retval] out unsigned long count);
|
||||
|
||||
/**
|
||||
* Get the list of gateways, could be IPv4 or IPv6, typically 1 IPv4 or 1
|
||||
* IPv6 or one of each.
|
||||
*
|
||||
* @param count
|
||||
* The length of the list of gateways
|
||||
*
|
||||
* @returns the list of gateways.
|
||||
*/
|
||||
void getGateways([optional] out unsigned long count,
|
||||
[array, size_is(count), retval] out wstring gateways);
|
||||
|
||||
/**
|
||||
* Get the list of dnses, could be IPv4 or IPv6.
|
||||
*
|
||||
* @param count
|
||||
* The length of the list of dnses.
|
||||
*
|
||||
* @returns the list of dnses.
|
||||
*/
|
||||
void getDnses([optional] out unsigned long count,
|
||||
[array, size_is(count), retval] out wstring dnses);
|
||||
};
|
||||
interface nsINetworkInfo;
|
||||
interface nsINetworkInterface;
|
||||
|
||||
/**
|
||||
* Manage network interfaces.
|
||||
*/
|
||||
[scriptable, uuid(b0ab71bf-4b38-4796-8a3c-4141255f4259)]
|
||||
[scriptable, uuid(e5ffe335-078e-4b25-87f1-02429bd2e458)]
|
||||
interface nsINetworkManager : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -141,12 +55,12 @@ interface nsINetworkManager : nsISupports
|
||||
void unregisterNetworkInterface(in nsINetworkInterface network);
|
||||
|
||||
/**
|
||||
* Object containing all known network connections, keyed by their
|
||||
* Object containing all known network information, keyed by their
|
||||
* network id. Network id is composed of a sub-id + '-' + network
|
||||
* type. For mobile network types, sub-id is 'ril' + service id; for
|
||||
* non-mobile network types, sub-id is always 'device'.
|
||||
*/
|
||||
readonly attribute jsval networkInterfaces;
|
||||
readonly attribute jsval allNetworkInfo;
|
||||
|
||||
/**
|
||||
* The preferred network type. One of the
|
||||
@ -159,12 +73,13 @@ interface nsINetworkManager : nsISupports
|
||||
attribute long preferredNetworkType;
|
||||
|
||||
/**
|
||||
* The network interface handling all data traffic.
|
||||
* The network information of the network interface handling all network
|
||||
* traffic.
|
||||
*
|
||||
* When this changes, the 'network-active-changed' observer
|
||||
* notification is dispatched.
|
||||
*/
|
||||
readonly attribute nsINetworkInterface active;
|
||||
readonly attribute nsINetworkInfo activeNetworkInfo;
|
||||
|
||||
/**
|
||||
* Override the default behaviour for preferredNetworkType and route
|
||||
@ -183,7 +98,7 @@ interface nsINetworkManager : nsISupports
|
||||
* Add host route to the specified network into routing table.
|
||||
*
|
||||
* @param network
|
||||
* The network interface where the host to be routed to.
|
||||
* The network information for the host to be routed to.
|
||||
* @param host
|
||||
* The host to be added.
|
||||
* The host will be resolved in advance if it's not an ip-address.
|
||||
@ -191,14 +106,14 @@ interface nsINetworkManager : nsISupports
|
||||
* @return a Promise
|
||||
* resolved if added; rejected, otherwise.
|
||||
*/
|
||||
jsval addHostRoute(in nsINetworkInterface network,
|
||||
jsval addHostRoute(in nsINetworkInfo network,
|
||||
in DOMString host);
|
||||
|
||||
/**
|
||||
* Remove host route to the specified network from routing table.
|
||||
*
|
||||
* @param network
|
||||
* The network interface where the routing to be removed from.
|
||||
* The network information for the routing to be removed from.
|
||||
* @param host
|
||||
* The host routed to the network.
|
||||
* The host will be resolved in advance if it's not an ip-address.
|
||||
@ -206,6 +121,6 @@ interface nsINetworkManager : nsISupports
|
||||
* @return a Promise
|
||||
* resolved if removed; rejected, otherwise.
|
||||
*/
|
||||
jsval removeHostRoute(in nsINetworkInterface network,
|
||||
jsval removeHostRoute(in nsINetworkInfo network,
|
||||
in DOMString host);
|
||||
};
|
||||
|
@ -7,7 +7,7 @@
|
||||
interface nsINetworkInterface;
|
||||
interface nsIWifiTetheringCallback;
|
||||
|
||||
[scriptable, uuid(80d65940-bd99-458f-8529-e438c7348087)]
|
||||
[scriptable, uuid(993b79df-f10e-4697-a5dc-5981cf8ff7e6)]
|
||||
interface nsITetheringService : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -16,15 +16,15 @@ interface nsITetheringService : nsISupports
|
||||
* @param enabled
|
||||
* Boolean that indicates whether tethering should be enabled (true) or
|
||||
* disabled (false).
|
||||
* @param networkInterface
|
||||
* The Wifi network interface with at least name of network interface.
|
||||
* @param interfaceName
|
||||
* The Wifi network interface name for internal interface.
|
||||
* @param config
|
||||
* The Wifi Tethering configuration from settings db.
|
||||
* @param callback
|
||||
* Callback function used to report status to WifiManager.
|
||||
*/
|
||||
void setWifiTethering(in boolean enabled,
|
||||
in nsINetworkInterface networkInterface,
|
||||
in DOMString interfaceName,
|
||||
in jsval config,
|
||||
in nsIWifiTetheringCallback callback);
|
||||
};
|
@ -9,18 +9,18 @@ const SETTINGS_KEY_DATA_APN_SETTINGS = "ril.data.apnSettings";
|
||||
const TOPIC_CONNECTION_STATE_CHANGED = "network-connection-state-changed";
|
||||
const TOPIC_NETWORK_ACTIVE_CHANGED = "network-active-changed";
|
||||
|
||||
const NETWORK_STATE_UNKNOWN = Ci.nsINetworkInterface.NETWORK_STATE_UNKNOWN;
|
||||
const NETWORK_STATE_CONNECTING = Ci.nsINetworkInterface.NETWORK_STATE_CONNECTING;
|
||||
const NETWORK_STATE_CONNECTED = Ci.nsINetworkInterface.NETWORK_STATE_CONNECTED;
|
||||
const NETWORK_STATE_DISCONNECTING = Ci.nsINetworkInterface.NETWORK_STATE_DISCONNECTING;
|
||||
const NETWORK_STATE_DISCONNECTED = Ci.nsINetworkInterface.NETWORK_STATE_DISCONNECTED;
|
||||
const NETWORK_STATE_UNKNOWN = Ci.nsINetworkInfo.NETWORK_STATE_UNKNOWN;
|
||||
const NETWORK_STATE_CONNECTING = Ci.nsINetworkInfo.NETWORK_STATE_CONNECTING;
|
||||
const NETWORK_STATE_CONNECTED = Ci.nsINetworkInfo.NETWORK_STATE_CONNECTED;
|
||||
const NETWORK_STATE_DISCONNECTING = Ci.nsINetworkInfo.NETWORK_STATE_DISCONNECTING;
|
||||
const NETWORK_STATE_DISCONNECTED = Ci.nsINetworkInfo.NETWORK_STATE_DISCONNECTED;
|
||||
|
||||
const NETWORK_TYPE_MOBILE = Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE;
|
||||
const NETWORK_TYPE_MOBILE_MMS = Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS;
|
||||
const NETWORK_TYPE_MOBILE_SUPL = Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_SUPL;
|
||||
const NETWORK_TYPE_MOBILE_IMS = Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_IMS;
|
||||
const NETWORK_TYPE_MOBILE_DUN = Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_DUN;
|
||||
const NETWORK_TYPE_MOBILE_FOTA = Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_FOTA;
|
||||
const NETWORK_TYPE_MOBILE = Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE;
|
||||
const NETWORK_TYPE_MOBILE_MMS = Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE_MMS;
|
||||
const NETWORK_TYPE_MOBILE_SUPL = Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE_SUPL;
|
||||
const NETWORK_TYPE_MOBILE_IMS = Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE_IMS;
|
||||
const NETWORK_TYPE_MOBILE_DUN = Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE_DUN;
|
||||
const NETWORK_TYPE_MOBILE_FOTA = Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE_FOTA;
|
||||
|
||||
const networkTypes = [
|
||||
NETWORK_TYPE_MOBILE,
|
||||
@ -144,13 +144,13 @@ function setDataEnabledAndWait(aEnabled) {
|
||||
let promises = [];
|
||||
promises.push(waitForObserverEvent(TOPIC_CONNECTION_STATE_CHANGED)
|
||||
.then(function(aSubject) {
|
||||
ok(aSubject instanceof Ci.nsIRilNetworkInterface,
|
||||
"subject should be an instance of nsIRILNetworkInterface");
|
||||
ok(aSubject instanceof Ci.nsIRilNetworkInfo,
|
||||
"subject should be an instance of nsIRilNetworkInfo");
|
||||
is(aSubject.type, NETWORK_TYPE_MOBILE,
|
||||
"subject.type should be " + NETWORK_TYPE_MOBILE);
|
||||
is(aSubject.state,
|
||||
aEnabled ? Ci.nsINetworkInterface.NETWORK_STATE_CONNECTED
|
||||
: Ci.nsINetworkInterface.NETWORK_STATE_DISCONNECTED,
|
||||
aEnabled ? Ci.nsINetworkInfo.NETWORK_STATE_CONNECTED
|
||||
: Ci.nsINetworkInfo.NETWORK_STATE_DISCONNECTED,
|
||||
"subject.state should be " + aEnabled ? "CONNECTED" : "DISCONNECTED");
|
||||
}));
|
||||
promises.push(setSettings(SETTINGS_KEY_DATA_ENABLED, aEnabled));
|
||||
@ -175,11 +175,11 @@ function setupDataCallAndWait(aNetworkType) {
|
||||
let promises = [];
|
||||
promises.push(waitForObserverEvent(TOPIC_CONNECTION_STATE_CHANGED)
|
||||
.then(function(aSubject) {
|
||||
ok(aSubject instanceof Ci.nsIRilNetworkInterface,
|
||||
"subject should be an instance of nsIRILNetworkInterface");
|
||||
ok(aSubject instanceof Ci.nsIRilNetworkInfo,
|
||||
"subject should be an instance of nsIRilNetworkInfo");
|
||||
is(aSubject.type, aNetworkType,
|
||||
"subject.type should be " + aNetworkType);
|
||||
is(aSubject.state, Ci.nsINetworkInterface.NETWORK_STATE_CONNECTED,
|
||||
is(aSubject.state, Ci.nsINetworkInfo.NETWORK_STATE_CONNECTED,
|
||||
"subject.state should be CONNECTED");
|
||||
}));
|
||||
promises.push(radioInterface.setupDataCallByType(aNetworkType));
|
||||
@ -204,11 +204,11 @@ function deactivateDataCallAndWait(aNetworkType) {
|
||||
let promises = [];
|
||||
promises.push(waitForObserverEvent(TOPIC_CONNECTION_STATE_CHANGED)
|
||||
.then(function(aSubject) {
|
||||
ok(aSubject instanceof Ci.nsIRilNetworkInterface,
|
||||
"subject should be an instance of nsIRILNetworkInterface");
|
||||
ok(aSubject instanceof Ci.nsIRilNetworkInfo,
|
||||
"subject should be an instance of nsIRilNetworkInfo");
|
||||
is(aSubject.type, aNetworkType,
|
||||
"subject.type should be " + aNetworkType);
|
||||
is(aSubject.state, Ci.nsINetworkInterface.NETWORK_STATE_DISCONNECTED,
|
||||
is(aSubject.state, Ci.nsINetworkInfo.NETWORK_STATE_DISCONNECTED,
|
||||
"subject.state should be DISCONNECTED");
|
||||
}));
|
||||
promises.push(radioInterface.deactivateDataCallByType(aNetworkType));
|
||||
|
@ -13,8 +13,8 @@ function testInitialState() {
|
||||
return getSettings(SETTINGS_KEY_DATA_ENABLED)
|
||||
.then((enabled) => {
|
||||
is(enabled, false, "data should be off by default");
|
||||
is(networkManager.active, null,
|
||||
"networkManager.active should be null by default");
|
||||
is(networkManager.activeNetworkInfo, null,
|
||||
"networkManager.activeNetworkInfo should be null by default");
|
||||
});
|
||||
}
|
||||
|
||||
@ -29,16 +29,16 @@ function testActiveNetworkChangedBySwitchingDataCall(aDataCallEnabled) {
|
||||
let subject = results[0];
|
||||
|
||||
if (aDataCallEnabled) {
|
||||
ok(subject instanceof Ci.nsINetworkInterface,
|
||||
"subject should be an instance of nsINetworkInterface");
|
||||
ok(subject instanceof Ci.nsIRilNetworkInterface,
|
||||
"subject should be an instance of nsIRILNetworkInterface");
|
||||
ok(subject instanceof Ci.nsINetworkInfo,
|
||||
"subject should be an instance of nsINetworkInfo");
|
||||
ok(subject instanceof Ci.nsIRilNetworkInfo,
|
||||
"subject should be an instance of nsIRilNetworkInfo");
|
||||
is(subject.type, NETWORK_TYPE_MOBILE,
|
||||
"subject.type should be NETWORK_TYPE_MOBILE");
|
||||
}
|
||||
|
||||
is(subject, networkManager.active,
|
||||
"subject should be equal with networkManager.active");
|
||||
is(subject, networkManager.activeNetworkInfo,
|
||||
"subject should be equal with networkManager.activeNetworkInfo");
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
MARIONETTE_TIMEOUT = 60000;
|
||||
MARIONETTE_HEAD_JS = "head.js";
|
||||
|
||||
function getNetworkInterface(aType) {
|
||||
function getNetworkInfo(aType) {
|
||||
let networkListService =
|
||||
Cc["@mozilla.org/network/interface-list-service;1"].
|
||||
getService(Ci.nsINetworkInterfaceListService);
|
||||
@ -14,9 +14,9 @@ function getNetworkInterface(aType) {
|
||||
// Try to get nsINetworkInterface for aType.
|
||||
let numberOfInterface = networkList.getNumberOfInterface();
|
||||
for (let i = 0; i < numberOfInterface; i++) {
|
||||
let iface = networkList.getInterface(i);
|
||||
if (iface.type === aType) {
|
||||
return iface;
|
||||
let info = networkList.getInterfaceInfo(i);
|
||||
if (info.type === aType) {
|
||||
return info;
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,27 +29,27 @@ function testGetDataInterfaceList(aMobileDataEnabled) {
|
||||
aMobileDataEnabled ? "enabled" : "disabled");
|
||||
|
||||
return setDataEnabledAndWait(aMobileDataEnabled)
|
||||
.then(() => getNetworkInterface(NETWORK_TYPE_MOBILE))
|
||||
.then((networkInterface) => {
|
||||
if (!networkInterface) {
|
||||
ok(false, "Should get an valid nsINetworkInterface for mobile");
|
||||
.then(() => getNetworkInfo(NETWORK_TYPE_MOBILE))
|
||||
.then((networkInfo) => {
|
||||
if (!networkInfo) {
|
||||
ok(false, "Should get an valid nsINetworkInfo for mobile");
|
||||
return;
|
||||
}
|
||||
|
||||
ok(networkInterface instanceof Ci.nsINetworkInterface,
|
||||
"networkInterface should be an instance of nsINetworkInterface");
|
||||
ok(networkInfo instanceof Ci.nsINetworkInfo,
|
||||
"networkInfo should be an instance of nsINetworkInfo");
|
||||
|
||||
let ipAddresses = {};
|
||||
let prefixs = {};
|
||||
let numOfGateways = {};
|
||||
let numOfDnses = {};
|
||||
let numOfIpAddresses = networkInterface.getAddresses(ipAddresses, prefixs);
|
||||
let gateways = networkInterface.getGateways(numOfGateways);
|
||||
let dnses = networkInterface.getDnses(numOfDnses);
|
||||
let numOfIpAddresses = networkInfo.getAddresses(ipAddresses, prefixs);
|
||||
let gateways = networkInfo.getGateways(numOfGateways);
|
||||
let dnses = networkInfo.getDnses(numOfDnses);
|
||||
|
||||
if (aMobileDataEnabled) {
|
||||
// Mobile data is enabled.
|
||||
is(networkInterface.state, NETWORK_STATE_CONNECTED, "check state");
|
||||
is(networkInfo.state, NETWORK_STATE_CONNECTED, "check state");
|
||||
ok(numOfIpAddresses > 0, "check number of ipAddresses");
|
||||
ok(ipAddresses.value.length > 0, "check ipAddresses.length");
|
||||
ok(prefixs.value.length > 0, "check prefixs.length");
|
||||
@ -60,7 +60,7 @@ function testGetDataInterfaceList(aMobileDataEnabled) {
|
||||
ok(dnses.length > 0, "check dnses.length");
|
||||
} else {
|
||||
// Mobile data is disabled.
|
||||
is(networkInterface.state, NETWORK_STATE_DISCONNECTED, "check state");
|
||||
is(networkInfo.state, NETWORK_STATE_DISCONNECTED, "check state");
|
||||
is(numOfIpAddresses, 0, "check number of ipAddresses");
|
||||
is(ipAddresses.value.length, 0, "check ipAddresses.length");
|
||||
is(prefixs.value.length, 0, "check prefixs.length");
|
||||
|
@ -490,39 +490,44 @@ function P2pStateMachine(aP2pCommand, aNetUtil) {
|
||||
let _p2pNetworkInterface = {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsINetworkInterface]),
|
||||
|
||||
state: Ci.nsINetworkInterface.NETWORK_STATE_DISCONNECTED,
|
||||
type: Ci.nsINetworkInterface.NETWORK_TYPE_WIFI_P2P,
|
||||
name: P2P_INTERFACE_NAME,
|
||||
ips: [],
|
||||
prefixLengths: [],
|
||||
dnses: [],
|
||||
gateways: [],
|
||||
info: {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsINetworkInfo]),
|
||||
|
||||
state: Ci.nsINetworkInfo.NETWORK_STATE_DISCONNECTED,
|
||||
type: Ci.nsINetworkInfo.NETWORK_TYPE_WIFI_P2P,
|
||||
name: P2P_INTERFACE_NAME,
|
||||
ips: [],
|
||||
prefixLengths: [],
|
||||
dnses: [],
|
||||
gateways: [],
|
||||
|
||||
getAddresses: function (ips, prefixLengths) {
|
||||
ips.value = this.ips.slice();
|
||||
prefixLengths.value = this.prefixLengths.slice();
|
||||
|
||||
return this.ips.length;
|
||||
},
|
||||
|
||||
getGateways: function (count) {
|
||||
if (count) {
|
||||
count.value = this.gateways.length;
|
||||
}
|
||||
return this.gateways.slice();
|
||||
},
|
||||
|
||||
getDnses: function (count) {
|
||||
if (count) {
|
||||
count.value = this.dnses.length;
|
||||
}
|
||||
return this.dnses.slice();
|
||||
}
|
||||
},
|
||||
|
||||
httpProxyHost: null,
|
||||
httpProxyPort: null,
|
||||
|
||||
// help
|
||||
registered: false,
|
||||
|
||||
getAddresses: function (ips, prefixLengths) {
|
||||
ips.value = this.ips.slice();
|
||||
prefixLengths.value = this.prefixLengths.slice();
|
||||
|
||||
return this.ips.length;
|
||||
},
|
||||
|
||||
getGateways: function (count) {
|
||||
if (count) {
|
||||
count.value = this.gateways.length;
|
||||
}
|
||||
return this.gateways.slice();
|
||||
},
|
||||
|
||||
getDnses: function (count) {
|
||||
if (count) {
|
||||
count.value = this.dnses.length;
|
||||
}
|
||||
return this.dnses.slice();
|
||||
}
|
||||
registered: false
|
||||
};
|
||||
|
||||
//---------------------------------------------------------
|
||||
@ -1419,10 +1424,10 @@ function P2pStateMachine(aP2pCommand, aNetUtil) {
|
||||
}
|
||||
|
||||
// Update p2p network interface.
|
||||
_p2pNetworkInterface.state = Ci.nsINetworkInterface.NETWORK_STATE_CONNECTED;
|
||||
_p2pNetworkInterface.ips = [GO_NETWORK_INTERFACE.ip];
|
||||
_p2pNetworkInterface.prefixLengths = [GO_NETWORK_INTERFACE.maskLength];
|
||||
_p2pNetworkInterface.gateways = [GO_NETWORK_INTERFACE.ip];
|
||||
_p2pNetworkInterface.info.state = Ci.nsINetworkInfo.NETWORK_STATE_CONNECTED;
|
||||
_p2pNetworkInterface.info.ips = [GO_NETWORK_INTERFACE.ip];
|
||||
_p2pNetworkInterface.info.prefixLengths = [GO_NETWORK_INTERFACE.maskLength];
|
||||
_p2pNetworkInterface.info.gateways = [GO_NETWORK_INTERFACE.ip];
|
||||
handleP2pNetworkInterfaceStateChanged();
|
||||
|
||||
_groupInfo.networkInterface = _p2pNetworkInterface;
|
||||
@ -1454,18 +1459,18 @@ function P2pStateMachine(aP2pCommand, aNetUtil) {
|
||||
if (!maskLength) {
|
||||
maskLength = 32; // max prefix for IPv4.
|
||||
}
|
||||
_p2pNetworkInterface.state = Ci.nsINetworkInterface.NETWORK_STATE_CONNECTED;
|
||||
_p2pNetworkInterface.ips = [dhcpData.info.ipaddr_str];
|
||||
_p2pNetworkInterface.prefixLengths = [maskLength];
|
||||
_p2pNetworkInterface.info.state = Ci.nsINetworkInfo.NETWORK_STATE_CONNECTED;
|
||||
_p2pNetworkInterface.info.ips = [dhcpData.info.ipaddr_str];
|
||||
_p2pNetworkInterface.info.prefixLengths = [maskLength];
|
||||
if (typeof dhcpData.info.dns1_str == "string" &&
|
||||
dhcpData.info.dns1_str.length) {
|
||||
_p2pNetworkInterface.dnses.push(dhcpData.info.dns1_str);
|
||||
_p2pNetworkInterface.info.dnses.push(dhcpData.info.dns1_str);
|
||||
}
|
||||
if (typeof dhcpData.info.dns2_str == "string" &&
|
||||
dhcpData.info.dns2_str.length) {
|
||||
_p2pNetworkInterface.dnses.push(dhcpData.info.dns2_str);
|
||||
_p2pNetworkInterface.info.dnses.push(dhcpData.info.dns2_str);
|
||||
}
|
||||
_p2pNetworkInterface.gateways = [dhcpData.info.gateway_str];
|
||||
_p2pNetworkInterface.info.gateways = [dhcpData.info.gateway_str];
|
||||
handleP2pNetworkInterfaceStateChanged();
|
||||
|
||||
_groupInfo.networkInterface = _p2pNetworkInterface;
|
||||
@ -1476,11 +1481,11 @@ function P2pStateMachine(aP2pCommand, aNetUtil) {
|
||||
}
|
||||
|
||||
function resetP2pNetworkInterface() {
|
||||
_p2pNetworkInterface.state = Ci.nsINetworkInterface.NETWORK_STATE_DISCONNECTED;
|
||||
_p2pNetworkInterface.ips = [];
|
||||
_p2pNetworkInterface.prefixLengths = [];
|
||||
_p2pNetworkInterface.dnses = [];
|
||||
_p2pNetworkInterface.gateways = [];
|
||||
_p2pNetworkInterface.info.state = Ci.nsINetworkInfo.NETWORK_STATE_DISCONNECTED;
|
||||
_p2pNetworkInterface.info.ips = [];
|
||||
_p2pNetworkInterface.info.prefixLengths = [];
|
||||
_p2pNetworkInterface.info.dnses = [];
|
||||
_p2pNetworkInterface.info.gateways = [];
|
||||
}
|
||||
|
||||
function registerP2pNetworkInteface() {
|
||||
@ -1523,7 +1528,7 @@ function P2pStateMachine(aP2pCommand, aNetUtil) {
|
||||
}
|
||||
|
||||
// Update p2p network interface.
|
||||
_p2pNetworkInterface.state = Ci.nsINetworkInterface.NETWORK_STATE_DISCONNECTED;
|
||||
_p2pNetworkInterface.info.state = Ci.nsINetworkInfo.NETWORK_STATE_DISCONNECTED;
|
||||
handleP2pNetworkInterfaceStateChanged();
|
||||
|
||||
if (P2P_ROLE_GO === aInfo.role) {
|
||||
|
@ -403,8 +403,8 @@ var WifiManager = (function() {
|
||||
WifiNetworkInterface.httpProxyHost = network.httpProxyHost;
|
||||
WifiNetworkInterface.httpProxyPort = network.httpProxyPort;
|
||||
|
||||
if (WifiNetworkInterface.state ==
|
||||
Ci.nsINetworkInterface.NETWORK_STATE_CONNECTED) {
|
||||
if (WifiNetworkInterface.info.state ==
|
||||
Ci.nsINetworkInfo.NETWORK_STATE_CONNECTED) {
|
||||
gNetworkManager.updateNetworkInterface(WifiNetworkInterface);
|
||||
}
|
||||
}
|
||||
@ -1014,16 +1014,17 @@ var WifiManager = (function() {
|
||||
if (enabled) {
|
||||
manager.state = "INITIALIZING";
|
||||
// Register as network interface.
|
||||
WifiNetworkInterface.name = manager.ifname;
|
||||
WifiNetworkInterface.info.name = manager.ifname;
|
||||
if (!WifiNetworkInterface.registered) {
|
||||
gNetworkManager.registerNetworkInterface(WifiNetworkInterface);
|
||||
WifiNetworkInterface.registered = true;
|
||||
}
|
||||
WifiNetworkInterface.state = Ci.nsINetworkInterface.NETWORK_STATE_DISCONNECTED;
|
||||
WifiNetworkInterface.ips = [];
|
||||
WifiNetworkInterface.prefixLengths = [];
|
||||
WifiNetworkInterface.gateways = [];
|
||||
WifiNetworkInterface.dnses = [];
|
||||
WifiNetworkInterface.info.state =
|
||||
Ci.nsINetworkInfo.NETWORK_STATE_DISCONNECTED;
|
||||
WifiNetworkInterface.info.ips = [];
|
||||
WifiNetworkInterface.info.prefixLengths = [];
|
||||
WifiNetworkInterface.info.gateways = [];
|
||||
WifiNetworkInterface.info.dnses = [];
|
||||
gNetworkManager.updateNetworkInterface(WifiNetworkInterface);
|
||||
|
||||
prepareForStartup(function() {
|
||||
@ -1168,8 +1169,10 @@ var WifiManager = (function() {
|
||||
|
||||
function doStartWifiTethering() {
|
||||
cancelWaitForDriverReadyTimer();
|
||||
WifiNetworkInterface.name = libcutils.property_get("wifi.tethering.interface", manager.ifname);
|
||||
gTetheringService.setWifiTethering(enabled, WifiNetworkInterface,
|
||||
WifiNetworkInterface.info.name =
|
||||
libcutils.property_get("wifi.tethering.interface", manager.ifname);
|
||||
gTetheringService.setWifiTethering(enabled,
|
||||
WifiNetworkInterface.info.name,
|
||||
configuration, function(result) {
|
||||
if (result) {
|
||||
manager.tetheringState = "UNINITIALIZED";
|
||||
@ -1783,55 +1786,59 @@ let WifiNetworkInterface = {
|
||||
|
||||
// nsINetworkInterface
|
||||
|
||||
NETWORK_STATE_UNKNOWN: Ci.nsINetworkInterface.NETWORK_STATE_UNKNOWN,
|
||||
NETWORK_STATE_CONNECTING: Ci.nsINetworkInterface.CONNECTING,
|
||||
NETWORK_STATE_CONNECTED: Ci.nsINetworkInterface.CONNECTED,
|
||||
NETWORK_STATE_DISCONNECTING: Ci.nsINetworkInterface.DISCONNECTING,
|
||||
NETWORK_STATE_DISCONNECTED: Ci.nsINetworkInterface.DISCONNECTED,
|
||||
NETWORK_STATE_UNKNOWN: Ci.nsINetworkInfo.NETWORK_STATE_UNKNOWN,
|
||||
NETWORK_STATE_CONNECTING: Ci.nsINetworkInfo.CONNECTING,
|
||||
NETWORK_STATE_CONNECTED: Ci.nsINetworkInfo.CONNECTED,
|
||||
NETWORK_STATE_DISCONNECTING: Ci.nsINetworkInfo.DISCONNECTING,
|
||||
NETWORK_STATE_DISCONNECTED: Ci.nsINetworkInfo.DISCONNECTED,
|
||||
|
||||
state: Ci.nsINetworkInterface.NETWORK_STATE_UNKNOWN,
|
||||
NETWORK_TYPE_WIFI: Ci.nsINetworkInfo.NETWORK_TYPE_WIFI,
|
||||
NETWORK_TYPE_MOBILE: Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE,
|
||||
NETWORK_TYPE_MOBILE_MMS: Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE_MMS,
|
||||
NETWORK_TYPE_MOBILE_SUPL: Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE_SUPL,
|
||||
|
||||
NETWORK_TYPE_WIFI: Ci.nsINetworkInterface.NETWORK_TYPE_WIFI,
|
||||
NETWORK_TYPE_MOBILE: Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE,
|
||||
NETWORK_TYPE_MOBILE_MMS: Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_MMS,
|
||||
NETWORK_TYPE_MOBILE_SUPL: Ci.nsINetworkInterface.NETWORK_TYPE_MOBILE_SUPL,
|
||||
info: {
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsINetworkInfo]),
|
||||
|
||||
type: Ci.nsINetworkInterface.NETWORK_TYPE_WIFI,
|
||||
state: Ci.nsINetworkInfo.NETWORK_STATE_UNKNOWN,
|
||||
|
||||
name: null,
|
||||
type: Ci.nsINetworkInfo.NETWORK_TYPE_WIFI,
|
||||
|
||||
ips: [],
|
||||
name: null,
|
||||
|
||||
prefixLengths: [],
|
||||
ips: [],
|
||||
|
||||
dnses: [],
|
||||
prefixLengths: [],
|
||||
|
||||
gateways: [],
|
||||
dnses: [],
|
||||
|
||||
gateways: [],
|
||||
|
||||
getAddresses: function (ips, prefixLengths) {
|
||||
ips.value = this.ips.slice();
|
||||
prefixLengths.value = this.prefixLengths.slice();
|
||||
|
||||
return this.ips.length;
|
||||
},
|
||||
|
||||
getGateways: function (count) {
|
||||
if (count) {
|
||||
count.value = this.gateways.length;
|
||||
}
|
||||
return this.gateways.slice();
|
||||
},
|
||||
|
||||
getDnses: function (count) {
|
||||
if (count) {
|
||||
count.value = this.dnses.length;
|
||||
}
|
||||
return this.dnses.slice();
|
||||
}
|
||||
},
|
||||
|
||||
httpProxyHost: null,
|
||||
|
||||
httpProxyPort: null,
|
||||
|
||||
getAddresses: function (ips, prefixLengths) {
|
||||
ips.value = this.ips.slice();
|
||||
prefixLengths.value = this.prefixLengths.slice();
|
||||
|
||||
return this.ips.length;
|
||||
},
|
||||
|
||||
getGateways: function (count) {
|
||||
if (count) {
|
||||
count.value = this.gateways.length;
|
||||
}
|
||||
return this.gateways.slice();
|
||||
},
|
||||
|
||||
getDnses: function (count) {
|
||||
if (count) {
|
||||
count.value = this.dnses.length;
|
||||
}
|
||||
return this.dnses.slice();
|
||||
}
|
||||
httpProxyPort: null
|
||||
};
|
||||
|
||||
function WifiScanResult() {}
|
||||
@ -2252,8 +2259,8 @@ function WifiWorker() {
|
||||
case "DISCONNECTED":
|
||||
// wpa_supplicant may give us a "DISCONNECTED" event even if
|
||||
// we are already in "DISCONNECTED" state.
|
||||
if ((WifiNetworkInterface.state ===
|
||||
Ci.nsINetworkInterface.NETWORK_STATE_DISCONNECTED) &&
|
||||
if ((WifiNetworkInterface.info.state ===
|
||||
Ci.nsINetworkInfo.NETWORK_STATE_DISCONNECTED) &&
|
||||
(this.prevState === "INITIALIZING" ||
|
||||
this.prevState === "DISCONNECTED" ||
|
||||
this.prevState === "INTERFACE_DISABLED" ||
|
||||
@ -2285,13 +2292,16 @@ function WifiWorker() {
|
||||
}
|
||||
});
|
||||
|
||||
WifiNetworkInterface.state =
|
||||
Ci.nsINetworkInterface.NETWORK_STATE_DISCONNECTED;
|
||||
WifiNetworkInterface.ips = [];
|
||||
WifiNetworkInterface.prefixLengths = [];
|
||||
WifiNetworkInterface.gateways = [];
|
||||
WifiNetworkInterface.dnses = [];
|
||||
WifiNetworkInterface.info.state =
|
||||
Ci.nsINetworkInfo.NETWORK_STATE_DISCONNECTED;
|
||||
|
||||
// Update network infterface first then clear properties.
|
||||
gNetworkManager.updateNetworkInterface(WifiNetworkInterface);
|
||||
WifiNetworkInterface.info.ips = [];
|
||||
WifiNetworkInterface.info.prefixLengths = [];
|
||||
WifiNetworkInterface.info.gateways = [];
|
||||
WifiNetworkInterface.info.dnses = [];
|
||||
|
||||
|
||||
break;
|
||||
case "WPS_TIMEOUT":
|
||||
@ -2333,18 +2343,18 @@ function WifiWorker() {
|
||||
WifiNetworkInterface.httpProxyPort = netConnect.httpProxyPort;
|
||||
}
|
||||
|
||||
WifiNetworkInterface.state =
|
||||
Ci.nsINetworkInterface.NETWORK_STATE_CONNECTED;
|
||||
WifiNetworkInterface.ips = [this.info.ipaddr_str];
|
||||
WifiNetworkInterface.prefixLengths = [maskLength];
|
||||
WifiNetworkInterface.gateways = [this.info.gateway_str];
|
||||
WifiNetworkInterface.info.state =
|
||||
Ci.nsINetworkInfo.NETWORK_STATE_CONNECTED;
|
||||
WifiNetworkInterface.info.ips = [this.info.ipaddr_str];
|
||||
WifiNetworkInterface.info.prefixLengths = [maskLength];
|
||||
WifiNetworkInterface.info.gateways = [this.info.gateway_str];
|
||||
if (typeof this.info.dns1_str == "string" &&
|
||||
this.info.dns1_str.length) {
|
||||
WifiNetworkInterface.dnses.push(this.info.dns1_str);
|
||||
WifiNetworkInterface.info.dnses.push(this.info.dns1_str);
|
||||
}
|
||||
if (typeof this.info.dns2_str == "string" &&
|
||||
this.info.dns2_str.length) {
|
||||
WifiNetworkInterface.dnses.push(this.info.dns2_str);
|
||||
WifiNetworkInterface.info.dnses.push(this.info.dns2_str);
|
||||
}
|
||||
gNetworkManager.updateNetworkInterface(WifiNetworkInterface);
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include "mozilla/CondVar.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsRefPtr.h"
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
#include "nsThread.h"
|
||||
|
||||
class nsIRunnable;
|
||||
|
@ -103,6 +103,7 @@ public:
|
||||
// Only touched on the worker thread.
|
||||
uint32_t mOuterEventStreamId;
|
||||
uint32_t mOuterChannelId;
|
||||
uint32_t mOpenCount;
|
||||
uint64_t mLastLoaded;
|
||||
uint64_t mLastTotal;
|
||||
uint64_t mLastUploadLoaded;
|
||||
@ -112,7 +113,6 @@ public:
|
||||
bool mLastUploadLengthComputable;
|
||||
bool mSeenLoadStart;
|
||||
bool mSeenUploadLoadStart;
|
||||
bool mOpening;
|
||||
|
||||
// Only touched on the main thread.
|
||||
bool mUploadEventListenersAttached;
|
||||
@ -125,10 +125,10 @@ public:
|
||||
: mWorkerPrivate(nullptr), mXMLHttpRequestPrivate(aXHRPrivate),
|
||||
mMozAnon(aMozAnon), mMozSystem(aMozSystem),
|
||||
mInnerEventStreamId(0), mInnerChannelId(0), mOutstandingSendCount(0),
|
||||
mOuterEventStreamId(0), mOuterChannelId(0), mLastLoaded(0), mLastTotal(0),
|
||||
mLastUploadLoaded(0), mLastUploadTotal(0), mIsSyncXHR(false),
|
||||
mOuterEventStreamId(0), mOuterChannelId(0), mOpenCount(0), mLastLoaded(0),
|
||||
mLastTotal(0), mLastUploadLoaded(0), mLastUploadTotal(0), mIsSyncXHR(false),
|
||||
mLastLengthComputable(false), mLastUploadLengthComputable(false),
|
||||
mSeenLoadStart(false), mSeenUploadLoadStart(false), mOpening(false),
|
||||
mSeenLoadStart(false), mSeenUploadLoadStart(false),
|
||||
mUploadEventListenersAttached(false), mMainThreadSeenLoadStart(false),
|
||||
mInOpen(false), mArrayBufferResponseWasTransferred(false)
|
||||
{ }
|
||||
@ -1859,7 +1859,7 @@ XMLHttpRequest::SendInternal(const nsAString& aStringBody,
|
||||
mWorkerPrivate->AssertIsOnWorkerThread();
|
||||
|
||||
// No send() calls when open is running.
|
||||
if (mProxy->mOpening) {
|
||||
if (mProxy->mOpenCount) {
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return;
|
||||
}
|
||||
@ -1954,15 +1954,17 @@ XMLHttpRequest::Open(const nsACString& aMethod, const nsAString& aUrl,
|
||||
mBackgroundRequest, mWithCredentials,
|
||||
mTimeout);
|
||||
|
||||
mProxy->mOpening = true;
|
||||
++mProxy->mOpenCount;
|
||||
if (!runnable->Dispatch(mWorkerPrivate->GetJSContext())) {
|
||||
mProxy->mOpening = false;
|
||||
ReleaseProxy();
|
||||
if (!--mProxy->mOpenCount) {
|
||||
ReleaseProxy();
|
||||
}
|
||||
|
||||
aRv.Throw(NS_ERROR_FAILURE);
|
||||
return;
|
||||
}
|
||||
|
||||
mProxy->mOpening = false;
|
||||
--mProxy->mOpenCount;
|
||||
mProxy->mIsSyncXHR = !aAsync;
|
||||
}
|
||||
|
||||
|
@ -92,6 +92,16 @@ public:
|
||||
{
|
||||
return Conjugate().Normalize();
|
||||
}
|
||||
|
||||
Point3D RotatePoint(const Point3D& aPoint) {
|
||||
Float uvx = Float(2.0) * (y*aPoint.z - z*aPoint.y);
|
||||
Float uvy = Float(2.0) * (z*aPoint.x - x*aPoint.z);
|
||||
Float uvz = Float(2.0) * (x*aPoint.y - y*aPoint.x);
|
||||
|
||||
return Point3D(aPoint.x + w*uvx + y*uvz - z*uvy,
|
||||
aPoint.y + w*uvy + z*uvx - x*uvz,
|
||||
aPoint.z + w*uvz + x*uvy - y*uvx);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace gfx
|
||||
|
@ -384,16 +384,6 @@ public:
|
||||
*/
|
||||
virtual void EndFrameForExternalComposition(const gfx::Matrix& aTransform) = 0;
|
||||
|
||||
/**
|
||||
* Setup the viewport and projection matrix for rendering to a target of the
|
||||
* given dimensions. The size and transform here will override those set in
|
||||
* BeginFrame. BeginFrame sets a size and transform for the default render
|
||||
* target, usually the screen. Calling this method prepares the compositor to
|
||||
* render using a different viewport (that is, size and transform), usually
|
||||
* associated with a new render target.
|
||||
*/
|
||||
virtual void PrepareViewport(const gfx::IntSize& aSize) = 0;
|
||||
|
||||
/**
|
||||
* Whether textures created by this compositor can receive partial updates.
|
||||
*/
|
||||
|
@ -386,13 +386,6 @@ public:
|
||||
NONE, SCROLLABLE
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns true if aLayer is optimized for the given PaintedLayerCreationHint.
|
||||
*/
|
||||
virtual bool IsOptimizedFor(PaintedLayer* aLayer,
|
||||
PaintedLayerCreationHint aCreationHint)
|
||||
{ return true; }
|
||||
|
||||
/**
|
||||
* CONSTRUCTION PHASE ONLY
|
||||
* Create a PaintedLayer for this manager's layer tree.
|
||||
@ -1674,6 +1667,20 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace the current effective transform with the given one,
|
||||
* returning the old one. This is currently added as a hack for VR
|
||||
* rendering, and might go away if we find a better way to do this.
|
||||
* If you think you have a need for this method, talk with
|
||||
* vlad/mstange/mwoodrow first.
|
||||
*/
|
||||
virtual gfx::Matrix4x4 ReplaceEffectiveTransform(const gfx::Matrix4x4& aNewEffectiveTransform) {
|
||||
gfx::Matrix4x4 old = mEffectiveTransform;
|
||||
mEffectiveTransform = aNewEffectiveTransform;
|
||||
ComputeEffectiveTransformForMaskLayers(mEffectiveTransform);
|
||||
return old;
|
||||
}
|
||||
|
||||
protected:
|
||||
Layer(LayerManager* aManager, void* aImplData);
|
||||
|
||||
@ -1847,6 +1854,13 @@ public:
|
||||
|
||||
bool UsedForReadback() { return mUsedForReadback; }
|
||||
void SetUsedForReadback(bool aUsed) { mUsedForReadback = aUsed; }
|
||||
|
||||
/**
|
||||
* Returns true if aLayer is optimized for the given PaintedLayerCreationHint.
|
||||
*/
|
||||
virtual bool IsOptimizedFor(LayerManager::PaintedLayerCreationHint aCreationHint)
|
||||
{ return true; }
|
||||
|
||||
/**
|
||||
* Returns the residual translation. Apply this translation when drawing
|
||||
* into the PaintedLayer so that when mEffectiveTransform is applied afterwards
|
||||
@ -2053,6 +2067,21 @@ public:
|
||||
void SetVRHMDInfo(gfx::VRHMDInfo* aHMD) { mHMDInfo = aHMD; }
|
||||
gfx::VRHMDInfo* GetVRHMDInfo() { return mHMDInfo; }
|
||||
|
||||
/**
|
||||
* Replace the current effective transform with the given one,
|
||||
* returning the old one. This is currently added as a hack for VR
|
||||
* rendering, and might go away if we find a better way to do this.
|
||||
* If you think you have a need for this method, talk with
|
||||
* vlad/mstange/mwoodrow first.
|
||||
*/
|
||||
gfx::Matrix4x4 ReplaceEffectiveTransform(const gfx::Matrix4x4& aNewEffectiveTransform) override {
|
||||
gfx::Matrix4x4 old = mEffectiveTransform;
|
||||
mEffectiveTransform = aNewEffectiveTransform;
|
||||
ComputeEffectiveTransformsForChildren(mEffectiveTransform);
|
||||
ComputeEffectiveTransformForMaskLayers(mEffectiveTransform);
|
||||
return old;
|
||||
}
|
||||
|
||||
protected:
|
||||
friend class ReadbackProcessor;
|
||||
|
||||
@ -2258,6 +2287,8 @@ public:
|
||||
mPreTransCallbackData = closureData;
|
||||
}
|
||||
|
||||
const nsIntRect& GetBounds() const { return mBounds; }
|
||||
|
||||
protected:
|
||||
void FirePreTransactionCallback()
|
||||
{
|
||||
|
@ -150,7 +150,7 @@ public:
|
||||
gfx::IntPoint GetTileOffset(TileIntPoint aPosition) const {
|
||||
gfx::IntSize scaledTileSize = GetScaledTileSize();
|
||||
return gfx::IntPoint(aPosition.x * scaledTileSize.width,
|
||||
aPosition.y * scaledTileSize.height);
|
||||
aPosition.y * scaledTileSize.height) + mTileOrigin;
|
||||
}
|
||||
|
||||
const TilesPlacement& GetPlacement() const { return mTiles; }
|
||||
@ -194,6 +194,7 @@ protected:
|
||||
TilesPlacement mTiles;
|
||||
float mResolution;
|
||||
gfx::IntSize mTileSize;
|
||||
gfx::IntPoint mTileOrigin;
|
||||
};
|
||||
|
||||
template<typename Derived, typename Tile> void
|
||||
|
@ -139,7 +139,7 @@ bool Axis::AdjustDisplacement(ParentLayerCoord aDisplacement,
|
||||
return false;
|
||||
}
|
||||
|
||||
ClearOverscrollAnimationState();
|
||||
EndOverscrollAnimation();
|
||||
|
||||
ParentLayerCoord displacement = aDisplacement;
|
||||
|
||||
@ -186,7 +186,7 @@ void Axis::OverscrollBy(ParentLayerCoord aOverscroll) {
|
||||
if (FuzzyEqualsAdditive(aOverscroll.value, 0.0f, COORDINATE_EPSILON)) {
|
||||
return;
|
||||
}
|
||||
ClearOverscrollAnimationState();
|
||||
EndOverscrollAnimation();
|
||||
aOverscroll = ApplyResistance(aOverscroll);
|
||||
if (aOverscroll > 0) {
|
||||
#ifdef DEBUG
|
||||
@ -238,13 +238,11 @@ void Axis::StartOverscrollAnimation(float aVelocity) {
|
||||
}
|
||||
|
||||
void Axis::EndOverscrollAnimation() {
|
||||
ClearOverscrollAnimationState();
|
||||
}
|
||||
|
||||
void Axis::ClearOverscrollAnimationState() {
|
||||
ParentLayerCoord overscroll = GetOverscroll();
|
||||
mFirstOverscrollAnimationSample = 0;
|
||||
mLastOverscrollPeak = 0;
|
||||
mOverscrollScale = 1.0f;
|
||||
mOverscroll = overscroll;
|
||||
}
|
||||
|
||||
void Axis::StepOverscrollAnimation(double aStepDurationMilliseconds) {
|
||||
@ -364,7 +362,7 @@ bool Axis::IsOverscrolled() const {
|
||||
}
|
||||
|
||||
void Axis::ClearOverscroll() {
|
||||
ClearOverscrollAnimationState();
|
||||
EndOverscrollAnimation();
|
||||
mOverscroll = 0;
|
||||
}
|
||||
|
||||
|
@ -278,9 +278,6 @@ protected:
|
||||
// actual overscroll amount.
|
||||
ParentLayerCoord ApplyResistance(ParentLayerCoord aOverscroll) const;
|
||||
|
||||
// Clear the state associated with an overscroll animation.
|
||||
void ClearOverscrollAnimationState();
|
||||
|
||||
// Helper function for SampleOverscrollAnimation().
|
||||
void StepOverscrollAnimation(double aStepDurationMilliseconds);
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "mozilla/gfx/Matrix.h" // for Matrix4x4
|
||||
#include "mozilla/layers/LayersTypes.h" // for EventRegions
|
||||
#include "mozilla/Maybe.h" // for Maybe
|
||||
#include "nsRefPtr.h" // for nsRefPtr
|
||||
#include "mozilla/nsRefPtr.h" // for nsRefPtr
|
||||
|
||||
namespace mozilla {
|
||||
namespace layers {
|
||||
|
@ -15,7 +15,7 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsISupportsImpl.h" // for NS_INLINE_DECL_REFCOUNTING
|
||||
#include "nsIWeakReferenceUtils.h" // for nsWeakPtr
|
||||
#include "nsRefPtr.h"
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
|
||||
template <class> class nsCOMPtr;
|
||||
class nsIDocument;
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#include "mozilla/layers/GeckoContentController.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsRefPtr.h"
|
||||
#include "mozilla/nsRefPtr.h"
|
||||
|
||||
class nsIDOMWindowUtils;
|
||||
class nsIDocument;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user