mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge m-c to inbound a=merge
This commit is contained in:
commit
2d89cb74ec
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="53a59364ce4f14068034c8d6fe01f4f6b9f78f23">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="ea93363a8c424d65a9ad91438ce6961377a20f98"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="6e804a42ab90f4251c7fe8c68731dc1c6abd8006"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
@ -23,7 +23,7 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="193c5b27148f44e3960fa5484c149866f4e9fe65"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="1085a4b05f19f1c43def7e87362d4498ce20b70f"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>
|
||||
|
@ -19,13 +19,13 @@
|
||||
<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="ea93363a8c424d65a9ad91438ce6961377a20f98"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6e804a42ab90f4251c7fe8c68731dc1c6abd8006"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>
|
||||
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="c058843242068d0df7c107e09da31b53d2e08fa6"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="193c5b27148f44e3960fa5484c149866f4e9fe65"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="1085a4b05f19f1c43def7e87362d4498ce20b70f"/>
|
||||
<!-- Stock Android things -->
|
||||
<project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
|
||||
<project name="platform/bionic" path="bionic" revision="c72b8f6359de7ed17c11ddc9dfdde3f615d188a9"/>
|
||||
|
@ -17,10 +17,10 @@
|
||||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="ea93363a8c424d65a9ad91438ce6961377a20f98"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="6e804a42ab90f4251c7fe8c68731dc1c6abd8006"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="193c5b27148f44e3960fa5484c149866f4e9fe65"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="1085a4b05f19f1c43def7e87362d4498ce20b70f"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<!-- Stock Android things -->
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="53a59364ce4f14068034c8d6fe01f4f6b9f78f23">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="ea93363a8c424d65a9ad91438ce6961377a20f98"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="6e804a42ab90f4251c7fe8c68731dc1c6abd8006"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
@ -23,7 +23,7 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="193c5b27148f44e3960fa5484c149866f4e9fe65"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="1085a4b05f19f1c43def7e87362d4498ce20b70f"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="f92a936f2aa97526d4593386754bdbf02db07a12"/>
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="6e47ff2790f5656b5b074407829ceecf3e6188c4"/>
|
||||
|
@ -19,13 +19,13 @@
|
||||
<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="ea93363a8c424d65a9ad91438ce6961377a20f98"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6e804a42ab90f4251c7fe8c68731dc1c6abd8006"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>
|
||||
<project name="platform_external_qemu" path="external/qemu" remote="b2g" revision="c058843242068d0df7c107e09da31b53d2e08fa6"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="193c5b27148f44e3960fa5484c149866f4e9fe65"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="1085a4b05f19f1c43def7e87362d4498ce20b70f"/>
|
||||
<!-- Stock Android things -->
|
||||
<project name="platform/abi/cpp" path="abi/cpp" revision="dd924f92906085b831bf1cbbc7484d3c043d613c"/>
|
||||
<project name="platform/bionic" path="bionic" revision="c72b8f6359de7ed17c11ddc9dfdde3f615d188a9"/>
|
||||
|
@ -17,10 +17,10 @@
|
||||
</project>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="ea93363a8c424d65a9ad91438ce6961377a20f98"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="6e804a42ab90f4251c7fe8c68731dc1c6abd8006"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="193c5b27148f44e3960fa5484c149866f4e9fe65"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="1085a4b05f19f1c43def7e87362d4498ce20b70f"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<!-- Stock Android things -->
|
||||
|
@ -4,6 +4,6 @@
|
||||
"remote": "",
|
||||
"branch": ""
|
||||
},
|
||||
"revision": "c6e222c3d86410830558dcf89436313b431da418",
|
||||
"revision": "f2dfcf31b96b8ffdf3dda0bd7b7272a07643e916",
|
||||
"repo_path": "/integration/gaia-central"
|
||||
}
|
||||
|
@ -17,12 +17,12 @@
|
||||
<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="ea93363a8c424d65a9ad91438ce6961377a20f98"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6e804a42ab90f4251c7fe8c68731dc1c6abd8006"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="193c5b27148f44e3960fa5484c149866f4e9fe65"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="1085a4b05f19f1c43def7e87362d4498ce20b70f"/>
|
||||
<!-- Stock Android things -->
|
||||
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
|
||||
<project name="platform/bionic" path="bionic" revision="d2eb6c7b6e1bc7643c17df2d9d9bcb1704d0b9ab"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="ea93363a8c424d65a9ad91438ce6961377a20f98"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6e804a42ab90f4251c7fe8c68731dc1c6abd8006"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
|
@ -17,10 +17,10 @@
|
||||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="ea93363a8c424d65a9ad91438ce6961377a20f98"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="6e804a42ab90f4251c7fe8c68731dc1c6abd8006"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="193c5b27148f44e3960fa5484c149866f4e9fe65"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="1085a4b05f19f1c43def7e87362d4498ce20b70f"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<!-- Stock Android things -->
|
||||
|
@ -17,12 +17,12 @@
|
||||
<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="ea93363a8c424d65a9ad91438ce6961377a20f98"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="6e804a42ab90f4251c7fe8c68731dc1c6abd8006"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="193c5b27148f44e3960fa5484c149866f4e9fe65"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="1085a4b05f19f1c43def7e87362d4498ce20b70f"/>
|
||||
<project name="gonk-patches" path="patches" remote="b2g" revision="223a2421006e8f5da33f516f6891c87cae86b0f6"/>
|
||||
<!-- Stock Android things -->
|
||||
<project name="platform/abi/cpp" path="abi/cpp" revision="6426040f1be4a844082c9769171ce7f5341a5528"/>
|
||||
|
@ -368,7 +368,7 @@
|
||||
<menuitem id="context-viewsource"
|
||||
label="&viewPageSourceCmd.label;"
|
||||
accesskey="&viewPageSourceCmd.accesskey;"
|
||||
oncommand="BrowserViewSourceOfDocument(gContextMenu.browser.contentDocument);"
|
||||
oncommand="BrowserViewSourceOfDocument(gContextMenu.browser.contentDocumentAsCPOW);"
|
||||
observes="isImage"/>
|
||||
<menuitem id="context-viewinfo"
|
||||
label="&viewPageInfoCmd.label;"
|
||||
|
@ -779,7 +779,9 @@
|
||||
|
||||
<handler event="dragstart" phase="capturing"><![CDATA[
|
||||
// Drag only if the gesture starts from the input field.
|
||||
if (event.originalTarget != this.inputField)
|
||||
if (this.inputField != event.originalTarget &&
|
||||
!(this.inputField.compareDocumentPosition(event.originalTarget) &
|
||||
Node.DOCUMENT_POSITION_CONTAINED_BY))
|
||||
return;
|
||||
|
||||
// Drag only if the entire value is selected and it's a valid URI.
|
||||
|
@ -206,7 +206,7 @@ loop.panel = (function(_, mozL10n) {
|
||||
_generateMailTo: function() {
|
||||
return encodeURI([
|
||||
"mailto:?subject=" + __("share_email_subject2") + "&",
|
||||
"body=" + __("share_email_body", {callUrl: this.state.callUrl})
|
||||
"body=" + __("share_email_body2", {callUrl: this.state.callUrl})
|
||||
].join(""));
|
||||
},
|
||||
|
||||
|
@ -206,7 +206,7 @@ loop.panel = (function(_, mozL10n) {
|
||||
_generateMailTo: function() {
|
||||
return encodeURI([
|
||||
"mailto:?subject=" + __("share_email_subject2") + "&",
|
||||
"body=" + __("share_email_body", {callUrl: this.state.callUrl})
|
||||
"body=" + __("share_email_body2", {callUrl: this.state.callUrl})
|
||||
].join(""));
|
||||
},
|
||||
|
||||
|
@ -169,7 +169,7 @@ loop.shared.router = (function(l10n) {
|
||||
* @param {Object} event
|
||||
*/
|
||||
_onPeerHungup: function() {
|
||||
this._notifier.warnL10n("peer_ended_conversation");
|
||||
this._notifier.warnL10n("peer_ended_conversation2");
|
||||
this.endCall();
|
||||
},
|
||||
|
||||
|
@ -4,11 +4,11 @@ call_has_ended=Your call has ended.
|
||||
call_timeout_notification_text=Your call did not go through.
|
||||
missing_conversation_info=Missing conversation information.
|
||||
network_disconnected=The network connection terminated abruptly.
|
||||
peer_ended_conversation=Your peer ended the conversation.
|
||||
peer_ended_conversation2=The person you were calling has ended the conversation.
|
||||
unable_retrieve_call_info=Unable to retrieve conversation information.
|
||||
hangup_button_title=Hangup
|
||||
hangup_button_title=Hang up
|
||||
mute_local_audio_button_title=Mute your audio
|
||||
unmute_local_audio_button_title=Unute your audio
|
||||
unmute_local_audio_button_title=Unmute your audio
|
||||
mute_local_video_button_title=Mute your video
|
||||
unmute_local_video_button_title=Unmute your video
|
||||
start_call=Start the call
|
||||
@ -42,7 +42,6 @@ call_has_ended=L'appel est terminé.
|
||||
call_timeout_notification_text=Votre appel n'a pas abouti.
|
||||
missing_conversation_info=Informations de communication manquantes.
|
||||
network_disconnected=La connexion réseau semble avoir été interrompue.
|
||||
peer_ended_conversation=Votre correspondant a mis fin à la communication.
|
||||
unable_retrieve_call_info=Impossible de récupérer les informations liées à cet appel.
|
||||
hangup_button_title=Terminer l'appel
|
||||
mute_local_audio_button_title=Couper la diffusion audio
|
||||
|
@ -255,7 +255,7 @@ describe("loop.panel", function() {
|
||||
|
||||
if (key === "share_email_subject2")
|
||||
text = "email-subject";
|
||||
else if (key === "share_email_body")
|
||||
else if (key === "share_email_body2")
|
||||
text = "{{callUrl}}";
|
||||
|
||||
return JSON.stringify({textContent: text});
|
||||
|
@ -165,7 +165,7 @@ describe("loop.shared.router", function() {
|
||||
|
||||
sinon.assert.calledOnce(notifier.warnL10n);
|
||||
sinon.assert.calledWithExactly(notifier.warnL10n,
|
||||
"peer_ended_conversation");
|
||||
"peer_ended_conversation2");
|
||||
|
||||
});
|
||||
|
||||
|
@ -1097,29 +1097,20 @@ var gApplicationsPane = {
|
||||
_loadPluginHandlers: function() {
|
||||
"use strict";
|
||||
|
||||
let pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
|
||||
let pluginTags = pluginHost.getPluginTags();
|
||||
let mimeTypes = navigator.mimeTypes;
|
||||
|
||||
for (let i = 0; i < pluginTags.length; ++i) {
|
||||
let pluginTag = pluginTags[i];
|
||||
|
||||
let mimeTypes = pluginTag.getMimeTypes();
|
||||
for (let j = 0; j < mimeTypes.length; ++j) {
|
||||
let type = mimeTypes[j];
|
||||
|
||||
let handlerInfoWrapper;
|
||||
if (type in this._handledTypes)
|
||||
handlerInfoWrapper = this._handledTypes[type];
|
||||
else {
|
||||
let wrappedHandlerInfo =
|
||||
this._mimeSvc.getFromTypeAndExtension(type, null);
|
||||
handlerInfoWrapper = new HandlerInfoWrapper(type, wrappedHandlerInfo);
|
||||
handlerInfoWrapper.handledOnlyByPlugin = true;
|
||||
this._handledTypes[type] = handlerInfoWrapper;
|
||||
}
|
||||
|
||||
handlerInfoWrapper.pluginName = pluginTag.name;
|
||||
for (let mimeType of mimeTypes) {
|
||||
let handlerInfoWrapper;
|
||||
if (mimeType.type in this._handledTypes) {
|
||||
handlerInfoWrapper = this._handledTypes[mimeType.type];
|
||||
} else {
|
||||
let wrappedHandlerInfo =
|
||||
this._mimeSvc.getFromTypeAndExtension(mimeType.type, null);
|
||||
handlerInfoWrapper = new HandlerInfoWrapper(mimeType.type, wrappedHandlerInfo);
|
||||
handlerInfoWrapper.handledOnlyByPlugin = true;
|
||||
this._handledTypes[mimeType.type] = handlerInfoWrapper;
|
||||
}
|
||||
handlerInfoWrapper.pluginName = mimeType.enabledPlugin.name;
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -1089,29 +1089,20 @@ var gApplicationsPane = {
|
||||
_loadPluginHandlers: function() {
|
||||
"use strict";
|
||||
|
||||
let pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
|
||||
let pluginTags = pluginHost.getPluginTags();
|
||||
let mimeTypes = navigator.mimeTypes;
|
||||
|
||||
for (let i = 0; i < pluginTags.length; ++i) {
|
||||
let pluginTag = pluginTags[i];
|
||||
|
||||
let mimeTypes = pluginTag.getMimeTypes();
|
||||
for (let j = 0; j < mimeTypes.length; ++j) {
|
||||
let type = mimeTypes[j];
|
||||
|
||||
let handlerInfoWrapper;
|
||||
if (type in this._handledTypes)
|
||||
handlerInfoWrapper = this._handledTypes[type];
|
||||
else {
|
||||
let wrappedHandlerInfo =
|
||||
this._mimeSvc.getFromTypeAndExtension(type, null);
|
||||
handlerInfoWrapper = new HandlerInfoWrapper(type, wrappedHandlerInfo);
|
||||
handlerInfoWrapper.handledOnlyByPlugin = true;
|
||||
this._handledTypes[type] = handlerInfoWrapper;
|
||||
}
|
||||
|
||||
handlerInfoWrapper.pluginName = pluginTag.name;
|
||||
for (let mimeType of mimeTypes) {
|
||||
let handlerInfoWrapper;
|
||||
if (mimeType.type in this._handledTypes) {
|
||||
handlerInfoWrapper = this._handledTypes[mimeType.type];
|
||||
} else {
|
||||
let wrappedHandlerInfo =
|
||||
this._mimeSvc.getFromTypeAndExtension(mimeType.type, null);
|
||||
handlerInfoWrapper = new HandlerInfoWrapper(mimeType.type, wrappedHandlerInfo);
|
||||
handlerInfoWrapper.handledOnlyByPlugin = true;
|
||||
this._handledTypes[mimeType.type] = handlerInfoWrapper;
|
||||
}
|
||||
handlerInfoWrapper.pluginName = mimeType.enabledPlugin.name;
|
||||
}
|
||||
},
|
||||
|
||||
|
107
browser/docs/UITelemetry.rst
Normal file
107
browser/docs/UITelemetry.rst
Normal file
@ -0,0 +1,107 @@
|
||||
=======================
|
||||
UITelemetry data format
|
||||
=======================
|
||||
|
||||
UI Telemetry sends its data as a JSON blob. This document describes the different parts
|
||||
of the JSON blob.
|
||||
|
||||
``toolbars``
|
||||
------------
|
||||
|
||||
This tracks the state of the user's UI customizations. It has the following properties:
|
||||
|
||||
- ``sizemode`` - string indicating whether the window is in maximized, normal (restored) or
|
||||
fullscreen mode;
|
||||
- ``bookmarksBarEnabled`` - boolean indicating whether the bookmarks bar is visible;
|
||||
- ``menuBarEnabled`` - boolean indicating whether the menu bar is visible (always false on OS X);
|
||||
- ``titleBarEnabled`` - boolean indicating whether the (real) titlebar is visible (rather than
|
||||
having tabs in the titlebar);
|
||||
- ``defaultKept`` - list of strings identifying toolbar buttons and items that are still in their
|
||||
default position. Only the IDs of builtin widgets are sent (ie not add-on widgets);
|
||||
- ``defaultMoved`` - list of strings identifying toolbar buttons and items that are no longer in
|
||||
their default position, but have not been removed to the palette. Only the IDs of builtin widgets
|
||||
are sent (ie not add-on widgets);
|
||||
- ``nondefaultAdded`` - list of strings identifying toolbar buttons and items that have been added
|
||||
from the palette. Only the IDs of builtin widgets are sent (ie not add-on widgets);
|
||||
- ``defaultRemoved`` - list of strings identifying toolbar buttons and items that are in the
|
||||
palette that are elsewhere by default. Only the IDs of builtin widgets are sent
|
||||
(ie not add-on widgets);
|
||||
- ``addonToolbars`` - the number of non-default toolbars that are customizable. 1 by default
|
||||
because it counts the add-on bar shim;
|
||||
- ``visibleTabs`` - array of the number of visible tabs per window;
|
||||
- ``hiddenTabs`` - array of the number of hidden tabs per window (ie tabs in panorama groups which
|
||||
are not the current group);
|
||||
- ``countableEvents`` - please refer to the next section.
|
||||
- ``durations`` - an object mapping descriptions to duration records, which records the amount of
|
||||
time a user spent doing something. Currently only has one property:
|
||||
- ``customization`` - how long a user spent customizing the browser. This is an array of
|
||||
objects, where each object has a ``duration`` property indicating the time in milliseconds,
|
||||
and a ``bucket`` property indicating a bucket in which the duration info falls.
|
||||
|
||||
``countableEvents``
|
||||
-------------------
|
||||
|
||||
Countable events are stored under the ``toolbars`` section. They count the number of times certain
|
||||
events happen. No timing or other correlating information is stored - purely the number of times
|
||||
things happen.
|
||||
|
||||
``countableEvents`` is an object with properties representing buckets. In each bucket, there is an
|
||||
object with the following properties:
|
||||
|
||||
- ``click-builtin-item`` is an object tracking clicks on builtin customizable toolbar items, keyed
|
||||
off the item IDs, with an object for each item with keys ``left``, ``middle`` and ``right`` each
|
||||
storing a number indicating how often the respective type of click has happened.
|
||||
- ``click-menu-button`` is the same, except the item ID is always 'button'.
|
||||
- ``click-bookmarks-bar`` is the same, with the item IDs being replaced by either ``container`` for
|
||||
clicks on bookmark or livemark folders, and ``item`` for individual bookmarks.
|
||||
- ``click-menubar`` is similar, with the item IDs being replaced by one of ``menu``, ``menuitem``
|
||||
or ``other``, depending on the kind of item clicked. Note that this is not tracked on OS X, where
|
||||
we can't listen for these events because of the global menubar.
|
||||
- ``click-bookmarks-menu-button`` is also similar, with the item IDs being replaced by:
|
||||
- ``menu`` for clicks on the 'menu' part of the item;
|
||||
- ``add`` for clicks that add a bookmark;
|
||||
- ``edit`` for clicks that open the panel to edit an existing bookmark;
|
||||
- ``in-panel`` for clicks when the button is in the menu panel, and clicking it does none of the
|
||||
above;
|
||||
- ``customize`` tracks different types of customization events without the ``left``, ``middle`` and
|
||||
``right`` distinctions. The different events are the following, with each storing a count of the
|
||||
number of times they occurred:
|
||||
- ``start`` counts the number of times the user starts customizing;
|
||||
- ``add`` counts the number of times an item is added somewhere from the palette;
|
||||
- ``move`` counts the number of times an item is moved somewhere else (but not to the palette);
|
||||
- ``remove`` counts the number of times an item is removed to the palette;
|
||||
- ``reset`` counts the number of times the 'restore defaults' button is used;
|
||||
|
||||
|
||||
``UITour``
|
||||
----------
|
||||
The UI Tour has its own section in the UI Telemetry output, outside of the ``toolbars`` section.
|
||||
It has a single property ``seenPageIDs`` which tracks which UI Tour pages have been run.
|
||||
|
||||
``contextmenu``
|
||||
---------------
|
||||
We track context menu interactions to figure out which ones are most often used and/or how
|
||||
effective they are. In the ``contextmenu`` object, we first store things per-bucket. Next, we
|
||||
divide the following different context menu situations:
|
||||
|
||||
- ``selection`` if there is content on the page that's selected on which the user clicks;
|
||||
- ``link`` if the user opened the context menu for a link
|
||||
- ``image-link`` if the user opened the context menu on an image or canvas that's a link;
|
||||
- ``image`` if the user opened the context menu on an image (that isn't a link);
|
||||
- ``canvas`` if the user opened the context menu on a canvas (that isn't a link);
|
||||
- ``media`` if the user opened the context menu on an HTML video or audio element;
|
||||
- ``input`` if the user opened the context menu on a text input element;
|
||||
- ``social`` if the user opened the context menu inside a social frame;
|
||||
- ``other`` for all other openings of the content menu;
|
||||
|
||||
Each of these objects (if they exist) then gets a "withcustom" and/or a "withoutcustom" property
|
||||
for context menus opened with custom page-created items and without them, and each of those
|
||||
properties holds an object with IDs corresponding to a count of how often an item with that ID was
|
||||
activated in the context menu. Only builtin context menu items are tracked, and besides those items
|
||||
there are four special items which get counts:
|
||||
|
||||
- ``close-without-interaction`` is incremented when the user closes the context menu without interacting with it;
|
||||
- ``custom-page-item`` is incremented when the user clicks an item that was created by the page;
|
||||
- ``unknown`` is incremented when an item without an ID was clicked;
|
||||
- ``other-item`` is incremented when an add-on-provided menuitem is clicked.
|
||||
|
9
browser/docs/index.rst
Normal file
9
browser/docs/index.rst
Normal file
@ -0,0 +1,9 @@
|
||||
=======
|
||||
Firefox
|
||||
=======
|
||||
|
||||
This is the nascent documentation of the Firefox front-end code.
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 1
|
||||
|
@ -21,13 +21,13 @@ incoming_call_answer_audio_only_tooltip=Answer with voice
|
||||
incoming_call_decline_button=Decline
|
||||
incoming_call_decline_and_block_button=Decline and Block
|
||||
incoming_call_block_button=Block
|
||||
hangup_button_title=Hangup
|
||||
hangup_button_title=Hang up
|
||||
mute_local_audio_button_title=Mute your audio
|
||||
unmute_local_audio_button_title=Unmute your audio
|
||||
mute_local_video_button_title=Mute your video
|
||||
unmute_local_video_button_title=Unmute your video
|
||||
|
||||
peer_ended_conversation=Your peer ended the conversation.
|
||||
peer_ended_conversation2=The person you were calling has ended the conversation.
|
||||
call_has_ended=Your call has ended.
|
||||
|
||||
cannot_start_call_session_not_ready=Can't start call, session is not ready.
|
||||
@ -59,9 +59,9 @@ feedback_back_button=Back
|
||||
feedback_window_will_close_in=This window will close in {{countdown}} seconds
|
||||
|
||||
share_email_subject2=Invitation to chat
|
||||
## LOCALIZATION NOTE (share_email_body): In this item, don't translate the
|
||||
## part between {{..}} and let the \r\n\r\n part
|
||||
share_email_body=Please click that link to call me back:\r\n\r\n{{callUrl}}
|
||||
## LOCALIZATION NOTE (share_email_body2): In this item, don't translate the
|
||||
## part between {{..}} and leave the \r\n\r\n part alone
|
||||
share_email_body2=Please click this link to call me:\r\n\r\n{{callUrl}}
|
||||
share_button=Email
|
||||
copy_url_button=Copy
|
||||
copied_url_button=Copied!
|
||||
|
@ -6,6 +6,8 @@
|
||||
|
||||
CONFIGURE_SUBST_FILES += ['installer/Makefile']
|
||||
|
||||
SPHINX_TREES['browser'] = 'docs'
|
||||
|
||||
DIRS += [
|
||||
'base',
|
||||
'components',
|
||||
|
@ -94,10 +94,6 @@ nsHTMLDNSPrefetch::Shutdown()
|
||||
bool
|
||||
nsHTMLDNSPrefetch::IsAllowed (nsIDocument *aDocument)
|
||||
{
|
||||
if (NS_IsAppOffline(aDocument->NodePrincipal())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// There is no need to do prefetch on non UI scenarios such as XMLHttpRequest.
|
||||
return aDocument->IsDNSPrefetchAllowed() && aDocument->GetWindow();
|
||||
}
|
||||
|
@ -593,10 +593,6 @@ Navigator::CookieEnabled()
|
||||
bool
|
||||
Navigator::OnLine()
|
||||
{
|
||||
if (mWindow && mWindow->GetDoc()) {
|
||||
return !NS_IsAppOffline(mWindow->GetDoc()->NodePrincipal());
|
||||
}
|
||||
|
||||
return !NS_IsOffline();
|
||||
}
|
||||
|
||||
|
@ -10807,7 +10807,7 @@ nsGlobalWindow::FireOfflineStatusEvent()
|
||||
if (!IsCurrentInnerWindow())
|
||||
return;
|
||||
nsAutoString name;
|
||||
if (NS_IsOffline() || NS_IsAppOffline(GetPrincipal())) {
|
||||
if (NS_IsOffline()) {
|
||||
name.AssignLiteral("offline");
|
||||
} else {
|
||||
name.AssignLiteral("online");
|
||||
@ -11363,8 +11363,7 @@ nsresult
|
||||
nsGlobalWindow::Observe(nsISupports* aSubject, const char* aTopic,
|
||||
const char16_t* aData)
|
||||
{
|
||||
if (!nsCRT::strcmp(aTopic, NS_IOSERVICE_OFFLINE_STATUS_TOPIC) ||
|
||||
!nsCRT::strcmp(aTopic, NS_IOSERVICE_APP_OFFLINE_STATUS_TOPIC)) {
|
||||
if (!nsCRT::strcmp(aTopic, NS_IOSERVICE_OFFLINE_STATUS_TOPIC)) {
|
||||
if (IsFrozen()) {
|
||||
// if an even number of notifications arrive while we're frozen,
|
||||
// we don't need to fire.
|
||||
|
@ -521,11 +521,6 @@ child:
|
||||
*/
|
||||
UIResolutionChanged();
|
||||
|
||||
/**
|
||||
* Tell the child of an app's offline status
|
||||
*/
|
||||
AppOfflineStatus(uint32_t id, bool offline);
|
||||
|
||||
/*
|
||||
* FIXME: write protocol!
|
||||
|
||||
|
@ -80,7 +80,6 @@
|
||||
#include "UnitTransforms.h"
|
||||
#include "ClientLayerManager.h"
|
||||
#include "LayersLogging.h"
|
||||
#include "nsIOService.h"
|
||||
|
||||
#include "nsColorPickerProxy.h"
|
||||
|
||||
@ -2532,18 +2531,6 @@ TabChild::RecvAsyncMessage(const nsString& aMessage,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TabChild::RecvAppOfflineStatus(const uint32_t& aId, const bool& aOffline)
|
||||
{
|
||||
// Instantiate the service to make sure gIOService is initialized
|
||||
nsCOMPtr<nsIIOService> ioService = mozilla::services::GetIOService();
|
||||
if (gIOService && ioService) {
|
||||
gIOService->SetAppOfflineInternal(aId, aOffline ?
|
||||
nsIAppOfflineInfo::OFFLINE : nsIAppOfflineInfo::ONLINE);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
class UnloadScriptEvent : public nsRunnable
|
||||
{
|
||||
public:
|
||||
|
@ -368,8 +368,6 @@ public:
|
||||
const InfallibleTArray<CpowEntry>& aCpows,
|
||||
const IPC::Principal& aPrincipal) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool RecvAppOfflineStatus(const uint32_t& aId, const bool& aOffline) MOZ_OVERRIDE;
|
||||
|
||||
virtual PDocumentRendererChild*
|
||||
AllocPDocumentRendererChild(const nsRect& documentRect, const gfx::Matrix& transform,
|
||||
const nsString& bgcolor,
|
||||
|
@ -237,7 +237,6 @@ TabParent::TabParent(nsIContentParent* aManager, const TabContext& aContext, uin
|
||||
, mMarkedDestroying(false)
|
||||
, mIsDestroyed(false)
|
||||
, mAppPackageFileDescriptorSent(false)
|
||||
, mSendOfflineStatus(true)
|
||||
, mChromeFlags(aChromeFlags)
|
||||
{
|
||||
MOZ_ASSERT(aManager);
|
||||
@ -503,14 +502,6 @@ TabParent::LoadURL(nsIURI* aURI)
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t appId = OwnOrContainingAppId();
|
||||
if (mSendOfflineStatus && NS_IsAppOffline(appId)) {
|
||||
// If the app is offline in the parent process
|
||||
// pass that state to the child process as well
|
||||
unused << SendAppOfflineStatus(appId, true);
|
||||
}
|
||||
mSendOfflineStatus = false;
|
||||
|
||||
unused << SendLoadURL(spec);
|
||||
|
||||
// If this app is a packaged app then we can speed startup by sending over
|
||||
|
@ -416,10 +416,6 @@ private:
|
||||
// Whether we have already sent a FileDescriptor for the app package.
|
||||
bool mAppPackageFileDescriptorSent;
|
||||
|
||||
// Whether we need to send the offline status to the TabChild
|
||||
// This is true, until the first call of LoadURL
|
||||
bool mSendOfflineStatus;
|
||||
|
||||
uint32_t mChromeFlags;
|
||||
|
||||
nsCOMPtr<nsILoadContext> mLoadContext;
|
||||
|
@ -150,15 +150,6 @@ GlobalPCList.prototype = {
|
||||
} else if (data == "online") {
|
||||
this._networkdown = false;
|
||||
}
|
||||
} else if (topic == "network:app-offline-status-changed") {
|
||||
// App just went offline. The subject also contains the appId,
|
||||
// but navigator.onLine checks that for us
|
||||
if (!this._networkdown && !this._win.navigator.onLine) {
|
||||
for (let winId in this._list) {
|
||||
cleanupWinId(this._list, winId);
|
||||
}
|
||||
}
|
||||
this._networkdown = !this._win.navigator.onLine;
|
||||
} else if (topic == "gmp-plugin-crash") {
|
||||
// a plugin crashed; if it's associated with any of our PCs, fire an
|
||||
// event to the DOM window
|
||||
@ -343,7 +334,7 @@ RTCPeerConnection.prototype = {
|
||||
}
|
||||
this._mustValidateRTCConfiguration(rtcConfig,
|
||||
"RTCPeerConnection constructor passed invalid RTCConfiguration");
|
||||
if (_globalPCList._networkdown || !this._win.navigator.onLine) {
|
||||
if (_globalPCList._networkdown) {
|
||||
throw new this._win.DOMError("",
|
||||
"Can't create RTCPeerConnections when the network is down");
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ union NetAddr;
|
||||
native NetAddr(mozilla::net::NetAddr);
|
||||
[ptr] native NetAddrPtr(mozilla::net::NetAddr);
|
||||
|
||||
[scriptable, uuid(5bb7de5a-8766-4c13-b9ed-14e63168dabf)]
|
||||
[scriptable, uuid(36ec5264-6a58-4cf2-ad9a-185292e0d1d1)]
|
||||
interface nsIUDPSocketChild : nsISupports
|
||||
{
|
||||
readonly attribute unsigned short localPort;
|
||||
|
@ -50,55 +50,10 @@ NS_INTERFACE_MAP_END
|
||||
TCPSocketParentBase::TCPSocketParentBase()
|
||||
: mIPCOpen(false)
|
||||
{
|
||||
mObserver = new mozilla::net::OfflineObserver(this);
|
||||
}
|
||||
|
||||
TCPSocketParentBase::~TCPSocketParentBase()
|
||||
{
|
||||
if (mObserver) {
|
||||
mObserver->RemoveObserver();
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t
|
||||
TCPSocketParent::GetAppId()
|
||||
{
|
||||
uint32_t appId = nsIScriptSecurityManager::UNKNOWN_APP_ID;
|
||||
const PContentParent *content = Manager()->Manager();
|
||||
const InfallibleTArray<PBrowserParent*>& browsers = content->ManagedPBrowserParent();
|
||||
if (browsers.Length() > 0) {
|
||||
TabParent *tab = static_cast<TabParent*>(browsers[0]);
|
||||
appId = tab->OwnAppId();
|
||||
}
|
||||
return appId;
|
||||
};
|
||||
|
||||
nsresult
|
||||
TCPSocketParent::OfflineNotification(nsISupports *aSubject)
|
||||
{
|
||||
nsCOMPtr<nsIAppOfflineInfo> info(do_QueryInterface(aSubject));
|
||||
if (!info) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
uint32_t targetAppId = nsIScriptSecurityManager::UNKNOWN_APP_ID;
|
||||
info->GetAppId(&targetAppId);
|
||||
|
||||
// Obtain App ID
|
||||
uint32_t appId = GetAppId();
|
||||
if (appId != targetAppId) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// If the app is offline, close the socket
|
||||
if (mSocket && NS_IsAppOffline(appId)) {
|
||||
mSocket->Close();
|
||||
mSocket = nullptr;
|
||||
mIntermediaryObj = nullptr;
|
||||
mIntermediary = nullptr;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
@ -140,12 +95,12 @@ TCPSocketParent::RecvOpen(const nsString& aHost, const uint16_t& aPort, const bo
|
||||
}
|
||||
|
||||
// Obtain App ID
|
||||
uint32_t appId = GetAppId();
|
||||
|
||||
if (NS_IsAppOffline(appId)) {
|
||||
NS_ERROR("Can't open socket because app is offline");
|
||||
FireInteralError(this, __LINE__);
|
||||
return true;
|
||||
uint32_t appId = nsIScriptSecurityManager::NO_APP_ID;
|
||||
const PContentParent *content = Manager()->Manager();
|
||||
const InfallibleTArray<PBrowserParent*>& browsers = content->ManagedPBrowserParent();
|
||||
if (browsers.Length() > 0) {
|
||||
TabParent *tab = static_cast<TabParent*>(browsers[0]);
|
||||
appId = tab->OwnAppId();
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
|
@ -11,7 +11,6 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDOMTCPSocket.h"
|
||||
#include "js/TypeDecls.h"
|
||||
#include "mozilla/net/OfflineObserver.h"
|
||||
|
||||
#define TCPSOCKETPARENT_CID \
|
||||
{ 0x4e7246c6, 0xa8b3, 0x426d, { 0x9c, 0x17, 0x76, 0xda, 0xb1, 0xe1, 0xe1, 0x4a } }
|
||||
@ -22,7 +21,6 @@ namespace dom {
|
||||
class PBrowserParent;
|
||||
|
||||
class TCPSocketParentBase : public nsITCPSocketParent
|
||||
, public mozilla::net::DisconnectableParent
|
||||
{
|
||||
public:
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(TCPSocketParentBase)
|
||||
@ -37,7 +35,6 @@ protected:
|
||||
|
||||
nsCOMPtr<nsITCPSocketIntermediary> mIntermediary;
|
||||
nsCOMPtr<nsIDOMTCPSocket> mSocket;
|
||||
nsRefPtr<mozilla::net::OfflineObserver> mObserver;
|
||||
bool mIPCOpen;
|
||||
};
|
||||
|
||||
@ -61,8 +58,6 @@ public:
|
||||
const uint32_t& aTrackingNumber) MOZ_OVERRIDE;
|
||||
virtual bool RecvRequestDelete() MOZ_OVERRIDE;
|
||||
|
||||
virtual nsresult OfflineNotification(nsISupports *) MOZ_OVERRIDE;
|
||||
virtual uint32_t GetAppId() MOZ_OVERRIDE;
|
||||
private:
|
||||
virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
|
||||
|
||||
|
@ -14,9 +14,6 @@
|
||||
#include "mozilla/ipc/InputStreamUtils.h"
|
||||
#include "mozilla/net/DNS.h"
|
||||
#include "mozilla/net/NeckoCommon.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
#include "mozilla/dom/TabParent.h"
|
||||
#include "mozilla/net/PNeckoParent.h"
|
||||
|
||||
namespace mozilla {
|
||||
@ -24,17 +21,8 @@ namespace dom {
|
||||
|
||||
NS_IMPL_ISUPPORTS(UDPSocketParent, nsIUDPSocketListener)
|
||||
|
||||
UDPSocketParent::UDPSocketParent()
|
||||
: mIPCOpen(true)
|
||||
{
|
||||
mObserver = new mozilla::net::OfflineObserver(this);
|
||||
}
|
||||
|
||||
UDPSocketParent::~UDPSocketParent()
|
||||
{
|
||||
if (mObserver) {
|
||||
mObserver->RemoveObserver();
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
@ -61,46 +49,6 @@ UDPSocketParent::Init(const nsACString& aFilter)
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
UDPSocketParent::GetAppId()
|
||||
{
|
||||
uint32_t appId = nsIScriptSecurityManager::UNKNOWN_APP_ID;
|
||||
const PContentParent *content = Manager()->Manager();
|
||||
const InfallibleTArray<PBrowserParent*>& browsers = content->ManagedPBrowserParent();
|
||||
if (browsers.Length() > 0) {
|
||||
TabParent *tab = static_cast<TabParent*>(browsers[0]);
|
||||
appId = tab->OwnAppId();
|
||||
}
|
||||
return appId;
|
||||
};
|
||||
|
||||
nsresult
|
||||
UDPSocketParent::OfflineNotification(nsISupports *aSubject)
|
||||
{
|
||||
nsCOMPtr<nsIAppOfflineInfo> info(do_QueryInterface(aSubject));
|
||||
if (!info) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
uint32_t targetAppId = nsIScriptSecurityManager::UNKNOWN_APP_ID;
|
||||
info->GetAppId(&targetAppId);
|
||||
|
||||
// Obtain App ID
|
||||
uint32_t appId = GetAppId();
|
||||
|
||||
if (appId != targetAppId) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// If the app is offline, close the socket
|
||||
if (mSocket && NS_IsAppOffline(appId)) {
|
||||
mSocket->Close();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
// PUDPSocketParent methods
|
||||
|
||||
bool
|
||||
|
@ -11,20 +11,19 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIUDPSocket.h"
|
||||
#include "nsIUDPSocketFilter.h"
|
||||
#include "mozilla/net/OfflineObserver.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class UDPSocketParent : public mozilla::net::PUDPSocketParent
|
||||
, public nsIUDPSocketListener
|
||||
, public mozilla::net::DisconnectableParent
|
||||
{
|
||||
public:
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
NS_DECL_NSIUDPSOCKETLISTENER
|
||||
|
||||
explicit UDPSocketParent();
|
||||
UDPSocketParent() :
|
||||
mIPCOpen(true) {}
|
||||
|
||||
bool Init(const nsACString& aFilter);
|
||||
|
||||
@ -41,8 +40,6 @@ public:
|
||||
virtual bool RecvLeaveMulticast(const nsCString& aMulticastAddress,
|
||||
const nsCString& aInterface) MOZ_OVERRIDE;
|
||||
|
||||
virtual nsresult OfflineNotification(nsISupports *) MOZ_OVERRIDE;
|
||||
virtual uint32_t GetAppId() MOZ_OVERRIDE;
|
||||
private:
|
||||
virtual ~UDPSocketParent();
|
||||
|
||||
@ -57,7 +54,6 @@ private:
|
||||
bool mIPCOpen;
|
||||
nsCOMPtr<nsIUDPSocket> mSocket;
|
||||
nsCOMPtr<nsIUDPSocketFilter> mFilter;
|
||||
nsRefPtr<mozilla::net::OfflineObserver> mObserver;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
@ -2476,28 +2476,6 @@ RuntimeService::Observe(nsISupports* aSubject, const char* aTopic,
|
||||
SendOfflineStatusChangeEventToAllWorkers(NS_IsOffline());
|
||||
return NS_OK;
|
||||
}
|
||||
if (!strcmp(aTopic, NS_IOSERVICE_APP_OFFLINE_STATUS_TOPIC)) {
|
||||
nsCOMPtr<nsIAppOfflineInfo> info(do_QueryInterface(aSubject));
|
||||
if (!info) {
|
||||
return NS_OK;
|
||||
}
|
||||
nsIPrincipal * principal = GetPrincipalForAsmJSCacheOp();
|
||||
if (!principal) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
uint32_t appId = nsIScriptSecurityManager::UNKNOWN_APP_ID;
|
||||
principal->GetAppId(&appId);
|
||||
|
||||
uint32_t notificationAppId = nsIScriptSecurityManager::UNKNOWN_APP_ID;
|
||||
info->GetAppId(¬ificationAppId);
|
||||
|
||||
if (appId != notificationAppId) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
SendOfflineStatusChangeEventToAllWorkers(NS_IsAppOffline(appId));
|
||||
}
|
||||
|
||||
NS_NOTREACHED("Unknown observer topic!");
|
||||
return NS_OK;
|
||||
|
@ -3528,7 +3528,7 @@ WorkerPrivate::WorkerPrivate(JSContext* aCx,
|
||||
else {
|
||||
AssertIsOnMainThread();
|
||||
RuntimeService::GetDefaultPreferences(mPreferences);
|
||||
mOnLine = !NS_IsOffline() && !NS_IsAppOffline(aLoadInfo.mPrincipal);
|
||||
mOnLine = !NS_IsOffline();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -88,24 +88,6 @@ interface nsIIOService : nsISupports
|
||||
*/
|
||||
attribute boolean offline;
|
||||
|
||||
/**
|
||||
* Set whether network appears to be offline for network connections from
|
||||
* a given appID.
|
||||
*
|
||||
* Calling this function may fire the "network:app-offline-status-changed"
|
||||
* notification, which is also sent to child processes containing this appId.
|
||||
* 'state' must one of nsIAppOfflineInfo::{ONLINE|OFFLINE|WIFI_ONLY}.
|
||||
*/
|
||||
void setAppOffline(in uint32_t appId, in long state);
|
||||
|
||||
/**
|
||||
* Returns true if given appId is currently not allowed to make network
|
||||
* connections. It will return true if the app is in the wifi-only state
|
||||
* and we are currently on a 3G connection.
|
||||
*/
|
||||
boolean isAppOffline(in uint32_t appId);
|
||||
|
||||
|
||||
/**
|
||||
* Checks if a port number is banned. This involves consulting a list of
|
||||
* unsafe ports, corresponding to network services that may be easily
|
||||
@ -135,18 +117,6 @@ interface nsIIOService : nsISupports
|
||||
ACString extractScheme(in AUTF8String urlString);
|
||||
};
|
||||
|
||||
[scriptable, uuid(4ac296a0-ca1b-44f4-8787-117a88cb70fb)]
|
||||
interface nsIAppOfflineInfo : nsISupports
|
||||
{
|
||||
readonly attribute unsigned long appId;
|
||||
|
||||
const long ONLINE = 1;
|
||||
const long OFFLINE = 2;
|
||||
const long WIFI_ONLY = 3;
|
||||
|
||||
readonly attribute long mode;
|
||||
};
|
||||
|
||||
%{C++
|
||||
/**
|
||||
* We send notifications through nsIObserverService with topic
|
||||
@ -166,10 +136,4 @@ interface nsIAppOfflineInfo : nsISupports
|
||||
#define NS_IOSERVICE_OFFLINE_STATUS_TOPIC "network:offline-status-changed"
|
||||
#define NS_IOSERVICE_OFFLINE "offline"
|
||||
#define NS_IOSERVICE_ONLINE "online"
|
||||
|
||||
/**
|
||||
* When network:app-offline-status-changed is fired,
|
||||
* the 'Subject' argument is a nsIOfflineAppInfo.
|
||||
*/
|
||||
#define NS_IOSERVICE_APP_OFFLINE_STATUS_TOPIC "network:app-offline-status-changed"
|
||||
%}
|
||||
|
@ -29,7 +29,7 @@ native NetAddr(mozilla::net::NetAddr);
|
||||
*
|
||||
* An interface to a UDP socket that can accept incoming connections.
|
||||
*/
|
||||
[scriptable, uuid(5e526cc7-a65f-42b2-b193-a6894c0253f7)]
|
||||
[scriptable, uuid(8f28299c-f2ac-468a-8223-190335006bbc)]
|
||||
interface nsIUDPSocket : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -75,7 +75,6 @@
|
||||
#include "nsIRedirectChannelRegistrar.h"
|
||||
#include "nsIMIMEHeaderParam.h"
|
||||
#include "nsILoadContext.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "nsIPrivateBrowsingChannel.h"
|
||||
#include "mozIApplicationClearPrivateDataParams.h"
|
||||
@ -1617,30 +1616,6 @@ NS_IsOffline()
|
||||
return offline;
|
||||
}
|
||||
|
||||
inline bool
|
||||
NS_IsAppOffline(uint32_t appId)
|
||||
{
|
||||
bool appOffline = false;
|
||||
nsCOMPtr<nsIIOService> io(
|
||||
do_GetService("@mozilla.org/network/io-service;1"));
|
||||
if (io) {
|
||||
io->IsAppOffline(appId, &appOffline);
|
||||
}
|
||||
return appOffline;
|
||||
}
|
||||
|
||||
inline bool
|
||||
NS_IsAppOffline(nsIPrincipal * principal)
|
||||
{
|
||||
if (!principal) {
|
||||
return NS_IsOffline();
|
||||
}
|
||||
uint32_t appId = nsIScriptSecurityManager::UNKNOWN_APP_ID;
|
||||
principal->GetAppId(&appId);
|
||||
|
||||
return NS_IsAppOffline(appId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper functions for implementing nsINestedURI::innermostURI.
|
||||
*
|
||||
|
@ -1,118 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set sw=2 ts=8 et tw=80 : */
|
||||
/* 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 "OfflineObserver.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIOService.h"
|
||||
#include "mozilla/net/NeckoCommon.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsThreadUtils.h"
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
NS_IMPL_ISUPPORTS(OfflineObserver, nsIObserver)
|
||||
|
||||
void
|
||||
OfflineObserver::RegisterOfflineObserver()
|
||||
{
|
||||
if (NS_IsMainThread()) {
|
||||
RegisterOfflineObserverMainThread();
|
||||
} else {
|
||||
nsRefPtr<nsIRunnable> event =
|
||||
NS_NewRunnableMethod(this, &OfflineObserver::RegisterOfflineObserverMainThread);
|
||||
NS_DispatchToMainThread(event);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
OfflineObserver::RemoveOfflineObserver()
|
||||
{
|
||||
if (NS_IsMainThread()) {
|
||||
RemoveOfflineObserverMainThread();
|
||||
} else {
|
||||
nsRefPtr<nsIRunnable> event =
|
||||
NS_NewRunnableMethod(this, &OfflineObserver::RemoveOfflineObserverMainThread);
|
||||
NS_DispatchToMainThread(event);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
OfflineObserver::RegisterOfflineObserverMainThread()
|
||||
{
|
||||
nsCOMPtr<nsIObserverService> observerService =
|
||||
mozilla::services::GetObserverService();
|
||||
if (!observerService) {
|
||||
return;
|
||||
}
|
||||
nsresult rv = observerService->AddObserver(this,
|
||||
NS_IOSERVICE_APP_OFFLINE_STATUS_TOPIC, false);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("Failed to register observer");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
OfflineObserver::RemoveOfflineObserverMainThread()
|
||||
{
|
||||
nsCOMPtr<nsIObserverService> observerService =
|
||||
mozilla::services::GetObserverService();
|
||||
if (observerService) {
|
||||
observerService->RemoveObserver(this, NS_IOSERVICE_APP_OFFLINE_STATUS_TOPIC);
|
||||
}
|
||||
}
|
||||
|
||||
OfflineObserver::OfflineObserver(DisconnectableParent * parent)
|
||||
{
|
||||
mParent = parent;
|
||||
RegisterOfflineObserver();
|
||||
}
|
||||
|
||||
void
|
||||
OfflineObserver::RemoveObserver()
|
||||
{
|
||||
RemoveOfflineObserver();
|
||||
mParent = nullptr;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
OfflineObserver::Observe(nsISupports *aSubject,
|
||||
const char *aTopic,
|
||||
const char16_t *aData)
|
||||
{
|
||||
if (mParent &&
|
||||
!strcmp(aTopic, NS_IOSERVICE_APP_OFFLINE_STATUS_TOPIC)) {
|
||||
mParent->OfflineNotification(aSubject);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
DisconnectableParent::OfflineNotification(nsISupports *aSubject)
|
||||
{
|
||||
nsCOMPtr<nsIAppOfflineInfo> info(do_QueryInterface(aSubject));
|
||||
if (!info) {
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
uint32_t targetAppId = NECKO_UNKNOWN_APP_ID;
|
||||
info->GetAppId(&targetAppId);
|
||||
|
||||
// Obtain App ID
|
||||
uint32_t appId = GetAppId();
|
||||
if (appId != targetAppId) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// If the app is offline, close the socket
|
||||
if (NS_IsAppOffline(appId)) {
|
||||
OfflineDisconnect();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
} // net namespace
|
||||
} // mozilla namespace
|
@ -1,73 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set sw=2 ts=8 et tw=80 : */
|
||||
/* 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/. */
|
||||
|
||||
#ifndef nsOfflineObserver_h__
|
||||
#define nsOfflineObserver_h__
|
||||
|
||||
#include "nsIObserver.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
|
||||
/**
|
||||
* Parents should extend this class and have a nsRefPtr<OfflineObserver> member.
|
||||
* The constructor should initialize the member to new OfflineObserver(this)
|
||||
* and the destructor should call RemoveObserver on the member.
|
||||
*
|
||||
* GetAppId and OfflineDisconnect are called from the default implementation
|
||||
* of OfflineNotification. These should be overridden by classes that don't
|
||||
* provide an implementation of OfflineNotification.
|
||||
*/
|
||||
class DisconnectableParent
|
||||
{
|
||||
public:
|
||||
// This is called on the main thread, by the OfflineObserver.
|
||||
// aSubject is of type nsAppOfflineInfo and contains appId and offline mode.
|
||||
virtual nsresult OfflineNotification(nsISupports *aSubject);
|
||||
|
||||
// GetAppId returns the appId for the app associated with the parent
|
||||
virtual uint32_t GetAppId() = 0;
|
||||
|
||||
// OfflineDisconnect cancels all existing connections in the parent when
|
||||
// the app becomes offline.
|
||||
virtual void OfflineDisconnect() { }
|
||||
};
|
||||
|
||||
/**
|
||||
* This class observes the "network:app-offline-status-changed" topic and calls
|
||||
* OfflineNotification on the DisconnectableParent with the subject.
|
||||
*/
|
||||
class OfflineObserver
|
||||
: public nsIObserver
|
||||
{
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
NS_DECL_NSIOBSERVER
|
||||
public:
|
||||
// A nsRefPtr to this object should be kept by the disconnectable parent.
|
||||
|
||||
OfflineObserver(DisconnectableParent * parent);
|
||||
// This method needs to be called in the destructor of the parent
|
||||
// It removes the observer from the nsObserverService list, and it clears
|
||||
// the pointer it holds to the disconnectable parent.
|
||||
void RemoveObserver();
|
||||
private:
|
||||
|
||||
// These methods are called to register and unregister the observer.
|
||||
// If they are called on the main thread they register the observer right
|
||||
// away, otherwise they dispatch and event to the main thread
|
||||
void RegisterOfflineObserver();
|
||||
void RemoveOfflineObserver();
|
||||
void RegisterOfflineObserverMainThread();
|
||||
void RemoveOfflineObserverMainThread();
|
||||
private:
|
||||
virtual ~OfflineObserver() { }
|
||||
DisconnectableParent * mParent;
|
||||
};
|
||||
|
||||
} // net namespace
|
||||
} // mozilla namespace
|
||||
|
||||
#endif // nsOfflineObserver_h__
|
@ -16,7 +16,6 @@ EXPORTS.mozilla.net += [
|
||||
'ChannelDiverterParent.h',
|
||||
'Dashboard.h',
|
||||
'DashboardTypes.h',
|
||||
'OfflineObserver.h',
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
@ -84,7 +83,6 @@ SOURCES += [
|
||||
'nsAsyncRedirectVerifyHelper.cpp',
|
||||
'nsSocketTransport2.cpp',
|
||||
'nsSocketTransportService2.cpp',
|
||||
'OfflineObserver.cpp',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include "nsIConsoleService.h"
|
||||
#include "nsIUploadChannel2.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIProtocolProxyCallback.h"
|
||||
#include "nsICancelable.h"
|
||||
#include "nsINetworkLinkService.h"
|
||||
@ -38,19 +37,12 @@
|
||||
#include "nsPIDNSService.h"
|
||||
#include "nsIProtocolProxyService2.h"
|
||||
#include "MainThreadUtils.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "mozilla/net/NeckoCommon.h"
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
#include "nsINetworkManager.h"
|
||||
#endif
|
||||
|
||||
#if defined(XP_WIN)
|
||||
#include "nsNativeConnectionHelper.h"
|
||||
#endif
|
||||
|
||||
using namespace mozilla;
|
||||
using mozilla::net::IsNeckoChild;
|
||||
|
||||
#define PORT_PREF_PREFIX "network.security.ports."
|
||||
#define PORT_PREF(x) PORT_PREF_PREFIX x
|
||||
@ -139,15 +131,11 @@ int16_t gBadPortList[] = {
|
||||
static const char kProfileChangeNetTeardownTopic[] = "profile-change-net-teardown";
|
||||
static const char kProfileChangeNetRestoreTopic[] = "profile-change-net-restore";
|
||||
static const char kProfileDoChange[] = "profile-do-change";
|
||||
static const char kNetworkActiveChanged[] = "network-active-changed";
|
||||
|
||||
// Necko buffer defaults
|
||||
uint32_t nsIOService::gDefaultSegmentSize = 4096;
|
||||
uint32_t nsIOService::gDefaultSegmentCount = 24;
|
||||
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsAppOfflineInfo, nsIAppOfflineInfo)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsIOService::nsIOService()
|
||||
@ -160,7 +148,6 @@ nsIOService::nsIOService()
|
||||
, mNetworkLinkServiceInitialized(false)
|
||||
, mChannelEventSinks(NS_CHANNEL_EVENT_SINK_CATEGORY)
|
||||
, mAutoDialEnabled(false)
|
||||
, mPreviousWifiState(-1)
|
||||
{
|
||||
}
|
||||
|
||||
@ -212,7 +199,6 @@ nsIOService::Init()
|
||||
observerService->AddObserver(this, kProfileDoChange, true);
|
||||
observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, true);
|
||||
observerService->AddObserver(this, NS_NETWORK_LINK_TOPIC, true);
|
||||
observerService->AddObserver(this, kNetworkActiveChanged, true);
|
||||
}
|
||||
else
|
||||
NS_WARNING("failed to get observer service");
|
||||
@ -915,62 +901,6 @@ nsIOService::GetPrefBranch(nsIPrefBranch **result)
|
||||
CallGetService(NS_PREFSERVICE_CONTRACTID, result);
|
||||
}
|
||||
|
||||
// This returns true if wifi-only apps should have connectivity.
|
||||
// Always returns false in the child process (should not depend on this method)
|
||||
static bool
|
||||
IsWifiActive()
|
||||
{
|
||||
// We don't need to do this check inside the child process
|
||||
if (IsNeckoChild()) {
|
||||
return false;
|
||||
}
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
// On B2G we query the network manager for the active interface
|
||||
nsCOMPtr<nsINetworkManager> networkManager =
|
||||
do_GetService("@mozilla.org/network/manager;1");
|
||||
if (!networkManager) {
|
||||
return false;
|
||||
}
|
||||
nsCOMPtr<nsINetworkInterface> active;
|
||||
networkManager->GetActive(getter_AddRefs(active));
|
||||
if (!active) {
|
||||
return false;
|
||||
}
|
||||
int32_t type;
|
||||
if (NS_FAILED(active->GetType(&type))) {
|
||||
return false;
|
||||
}
|
||||
switch (type) {
|
||||
case nsINetworkInterface::NETWORK_TYPE_WIFI:
|
||||
case nsINetworkInterface::NETWORK_TYPE_WIFI_P2P:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
// On anything else than B2G we return true so than wifi-only
|
||||
// apps don't think they are offline.
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
struct EnumeratorParams {
|
||||
nsIOService *service;
|
||||
int32_t status;
|
||||
};
|
||||
|
||||
PLDHashOperator
|
||||
nsIOService::EnumerateWifiAppsChangingState(const unsigned int &aKey,
|
||||
int32_t aValue,
|
||||
void *aUserArg)
|
||||
{
|
||||
EnumeratorParams *params = reinterpret_cast<EnumeratorParams*>(aUserArg);
|
||||
if (aValue == nsIAppOfflineInfo::WIFI_ONLY) {
|
||||
params->service->NotifyAppOfflineStatus(aKey, params->status);
|
||||
}
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
// nsIObserver interface
|
||||
NS_IMETHODIMP
|
||||
nsIOService::Observe(nsISupports *subject,
|
||||
@ -1026,37 +956,7 @@ nsIOService::Observe(nsISupports *subject,
|
||||
TrackNetworkLinkStatusForOffline();
|
||||
}
|
||||
}
|
||||
else if (!strcmp(topic, kNetworkActiveChanged)) {
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
if (IsNeckoChild()) {
|
||||
return NS_OK;
|
||||
}
|
||||
nsCOMPtr<nsINetworkInterface> interface = do_QueryInterface(subject);
|
||||
if (!interface) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
int32_t state;
|
||||
if (NS_FAILED(interface->GetState(&state))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
bool wifiActive = IsWifiActive();
|
||||
int32_t newWifiState = wifiActive ?
|
||||
nsINetworkInterface::NETWORK_TYPE_WIFI :
|
||||
nsINetworkInterface::NETWORK_TYPE_MOBILE;
|
||||
if (mPreviousWifiState != newWifiState) {
|
||||
// Notify wifi-only apps of their new status
|
||||
int32_t status = wifiActive ?
|
||||
nsIAppOfflineInfo::ONLINE : nsIAppOfflineInfo::OFFLINE;
|
||||
|
||||
EnumeratorParams params = {this, status};
|
||||
mAppsOfflineStatus.EnumerateRead(EnumerateWifiAppsChangingState, ¶ms);
|
||||
}
|
||||
|
||||
mPreviousWifiState = newWifiState;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -1350,156 +1250,3 @@ nsIOService::SpeculativeConnect(nsIURI *aURI,
|
||||
new IOServiceProxyCallback(aCallbacks, this);
|
||||
return pps->AsyncResolve(aURI, 0, callback, getter_AddRefs(cancelable));
|
||||
}
|
||||
|
||||
void
|
||||
nsIOService::NotifyAppOfflineStatus(uint32_t appId, int32_t state)
|
||||
{
|
||||
MOZ_RELEASE_ASSERT(NS_IsMainThread(),
|
||||
"Should be called on the main thread");
|
||||
|
||||
nsCOMPtr<nsIObserverService> observerService =
|
||||
mozilla::services::GetObserverService();
|
||||
MOZ_ASSERT(observerService, "The observer service should not be null");
|
||||
|
||||
if (observerService) {
|
||||
nsRefPtr<nsAppOfflineInfo> info = new nsAppOfflineInfo(appId, state);
|
||||
observerService->NotifyObservers(
|
||||
info,
|
||||
NS_IOSERVICE_APP_OFFLINE_STATUS_TOPIC,
|
||||
MOZ_UTF16("all data in nsIAppOfflineInfo subject argument"));
|
||||
}
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
class SetAppOfflineMainThread : public nsRunnable
|
||||
{
|
||||
public:
|
||||
SetAppOfflineMainThread(uint32_t aAppId, int32_t aState)
|
||||
: mAppId(aAppId)
|
||||
, mState(aState)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
gIOService->SetAppOfflineInternal(mAppId, mState);
|
||||
return NS_OK;
|
||||
}
|
||||
private:
|
||||
uint32_t mAppId;
|
||||
int32_t mState;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIOService::SetAppOffline(uint32_t aAppId, int32_t aState)
|
||||
{
|
||||
NS_ENSURE_TRUE(!IsNeckoChild(),
|
||||
NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(aAppId != nsIScriptSecurityManager::NO_APP_ID,
|
||||
NS_ERROR_INVALID_ARG);
|
||||
NS_ENSURE_TRUE(aAppId != nsIScriptSecurityManager::UNKNOWN_APP_ID,
|
||||
NS_ERROR_INVALID_ARG);
|
||||
|
||||
if (!NS_IsMainThread()) {
|
||||
NS_DispatchToMainThread(new SetAppOfflineMainThread(aAppId, aState));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
SetAppOfflineInternal(aAppId, aState);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// This method may be called in both the parent and the child process
|
||||
// In parent it only gets called in from nsIOService::SetAppOffline
|
||||
// and SetAppOfflineMainThread::Run
|
||||
// In the child, it may get called from NeckoChild::RecvAppOfflineStatus
|
||||
// and TabChild::RecvAppOfflineStatus.
|
||||
// Note that in the child process, apps should never be in a WIFI_ONLY
|
||||
// because wifi status is not available on the child
|
||||
void
|
||||
nsIOService::SetAppOfflineInternal(uint32_t aAppId, int32_t aState)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
NS_ENSURE_TRUE_VOID(NS_IsMainThread());
|
||||
|
||||
int32_t state = nsIAppOfflineInfo::ONLINE;
|
||||
mAppsOfflineStatus.Get(aAppId, &state);
|
||||
if (state == aState) {
|
||||
// The app is already in this state. Nothing needs to be done.
|
||||
return;
|
||||
}
|
||||
|
||||
// wifiActive will always be false in the child process
|
||||
// but it will be true in the parent process on Desktop Firefox as it does
|
||||
// not have wifi-detection capabilities
|
||||
bool wifiActive = IsWifiActive();
|
||||
bool offline = (state == nsIAppOfflineInfo::OFFLINE) ||
|
||||
(state == nsIAppOfflineInfo::WIFI_ONLY && !wifiActive);
|
||||
|
||||
switch (aState) {
|
||||
case nsIAppOfflineInfo::OFFLINE:
|
||||
mAppsOfflineStatus.Put(aAppId, nsIAppOfflineInfo::OFFLINE);
|
||||
if (!offline) {
|
||||
NotifyAppOfflineStatus(aAppId, nsIAppOfflineInfo::OFFLINE);
|
||||
}
|
||||
break;
|
||||
case nsIAppOfflineInfo::WIFI_ONLY:
|
||||
MOZ_RELEASE_ASSERT(!IsNeckoChild());
|
||||
mAppsOfflineStatus.Put(aAppId, nsIAppOfflineInfo::WIFI_ONLY);
|
||||
if (offline && wifiActive) {
|
||||
NotifyAppOfflineStatus(aAppId, nsIAppOfflineInfo::ONLINE);
|
||||
} else if (!offline && !wifiActive) {
|
||||
NotifyAppOfflineStatus(aAppId, nsIAppOfflineInfo::OFFLINE);
|
||||
}
|
||||
break;
|
||||
case nsIAppOfflineInfo::ONLINE:
|
||||
mAppsOfflineStatus.Remove(aAppId);
|
||||
if (offline) {
|
||||
NotifyAppOfflineStatus(aAppId, nsIAppOfflineInfo::ONLINE);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIOService::IsAppOffline(uint32_t aAppId, bool* aResult)
|
||||
{
|
||||
NS_ENSURE_ARG(aResult);
|
||||
*aResult = mOffline;
|
||||
|
||||
if (mOffline) {
|
||||
// If the entire browser is offline, return that status
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (aAppId == NECKO_NO_APP_ID ||
|
||||
aAppId == NECKO_UNKNOWN_APP_ID) {
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
int32_t state;
|
||||
if (mAppsOfflineStatus.Get(aAppId, &state)) {
|
||||
switch (state) {
|
||||
case nsIAppOfflineInfo::OFFLINE:
|
||||
*aResult = true;
|
||||
break;
|
||||
case nsIAppOfflineInfo::WIFI_ONLY:
|
||||
MOZ_RELEASE_ASSERT(!IsNeckoChild());
|
||||
*aResult = !IsWifiActive();
|
||||
break;
|
||||
default:
|
||||
// The app is online by default
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "nsIChannelEventSink.h"
|
||||
#include "nsCategoryCache.h"
|
||||
#include "nsISpeculativeConnect.h"
|
||||
#include "nsDataHashtable.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
#define NS_N(x) (sizeof(x)/sizeof(*x))
|
||||
@ -38,12 +37,6 @@ class nsIProxyInfo;
|
||||
class nsPIDNSService;
|
||||
class nsPISocketTransportService;
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
class NeckoChild;
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
||||
class nsIOService MOZ_FINAL : public nsIIOService2
|
||||
, public nsIObserver
|
||||
, public nsINetUtil
|
||||
@ -81,9 +74,6 @@ public:
|
||||
return mOffline && mSettingOffline && !mSetOfflineValue;
|
||||
}
|
||||
|
||||
// Should only be called from NeckoChild. Use SetAppOffline instead.
|
||||
void SetAppOfflineInternal(uint32_t appId, int32_t status);
|
||||
|
||||
private:
|
||||
// These shouldn't be called directly:
|
||||
// - construct using GetInstance
|
||||
@ -112,11 +102,6 @@ private:
|
||||
void LookupProxyInfo(nsIURI *aURI, nsIURI *aProxyURI, uint32_t aProxyFlags,
|
||||
nsCString *aScheme, nsIProxyInfo **outPI);
|
||||
|
||||
// notify content processes of offline status
|
||||
// 'status' must be a nsIAppOfflineInfo mode constant.
|
||||
void NotifyAppOfflineStatus(uint32_t appId, int32_t status);
|
||||
static PLDHashOperator EnumerateWifiAppsChangingState(const unsigned int &, int32_t, void*);
|
||||
|
||||
private:
|
||||
bool mOffline;
|
||||
bool mOfflineForProfileChange;
|
||||
@ -144,50 +129,12 @@ private:
|
||||
nsTArray<int32_t> mRestrictedPortList;
|
||||
|
||||
bool mAutoDialEnabled;
|
||||
|
||||
int32_t mPreviousWifiState;
|
||||
// Hashtable of (appId, nsIAppOffineInfo::mode) pairs
|
||||
// that is used especially in IsAppOffline
|
||||
nsDataHashtable<nsUint32HashKey, int32_t> mAppsOfflineStatus;
|
||||
public:
|
||||
// Used for all default buffer sizes that necko allocates.
|
||||
static uint32_t gDefaultSegmentSize;
|
||||
static uint32_t gDefaultSegmentCount;
|
||||
};
|
||||
|
||||
/**
|
||||
* This class is passed as the subject to a NotifyObservers call for the
|
||||
* "network:app-offline-status-changed" topic.
|
||||
* Observers will use the appId and mode to get the offline status of an app.
|
||||
*/
|
||||
class nsAppOfflineInfo : public nsIAppOfflineInfo
|
||||
{
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
public:
|
||||
nsAppOfflineInfo(uint32_t aAppId, int32_t aMode)
|
||||
: mAppId(aAppId), mMode(aMode)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP GetMode(int32_t *aMode)
|
||||
{
|
||||
*aMode = mMode;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP GetAppId(uint32_t *aAppId)
|
||||
{
|
||||
*aAppId = mAppId;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
private:
|
||||
virtual ~nsAppOfflineInfo() {}
|
||||
|
||||
uint32_t mAppId;
|
||||
int32_t mMode;
|
||||
};
|
||||
|
||||
/**
|
||||
* Reference to the IO service singleton. May be null.
|
||||
*/
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "mozilla/net/RtspChannelChild.h"
|
||||
#endif
|
||||
#include "SerializedLoadContext.h"
|
||||
#include "nsIOService.h"
|
||||
|
||||
using mozilla::dom::TCPSocketChild;
|
||||
using mozilla::dom::TCPServerSocketChild;
|
||||
@ -318,17 +317,5 @@ NeckoChild::RecvAsyncAuthPromptForNestedFrame(const uint64_t& aNestedFrameId,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
NeckoChild::RecvAppOfflineStatus(const uint32_t& aId, const bool& aOffline)
|
||||
{
|
||||
// Instantiate the service to make sure gIOService is initialized
|
||||
nsCOMPtr<nsIIOService> ioService = do_GetIOService();
|
||||
if (gIOService) {
|
||||
gIOService->SetAppOfflineInternal(aId, aOffline ?
|
||||
nsIAppOfflineInfo::OFFLINE : nsIAppOfflineInfo::ONLINE);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}} // mozilla::net
|
||||
|
||||
|
@ -75,7 +75,6 @@ protected:
|
||||
const nsCString& aUri,
|
||||
const nsString& aRealm,
|
||||
const uint64_t& aCallbackId) MOZ_OVERRIDE;
|
||||
virtual bool RecvAppOfflineStatus(const uint32_t& aId, const bool& aOffline) MOZ_OVERRIDE;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -36,8 +36,6 @@
|
||||
#include "SerializedLoadContext.h"
|
||||
#include "nsAuthInformationHolder.h"
|
||||
#include "nsIAuthPromptCallback.h"
|
||||
#include "nsIOService.h"
|
||||
#include "mozilla/net/OfflineObserver.h"
|
||||
|
||||
using mozilla::dom::ContentParent;
|
||||
using mozilla::dom::TabParent;
|
||||
@ -75,15 +73,10 @@ NeckoParent::NeckoParent()
|
||||
LossyCopyUTF16toASCII(corePath, mCoreAppsBasePath);
|
||||
LossyCopyUTF16toASCII(webPath, mWebAppsBasePath);
|
||||
}
|
||||
|
||||
mObserver = new OfflineObserver(this);
|
||||
}
|
||||
|
||||
NeckoParent::~NeckoParent()
|
||||
{
|
||||
if (mObserver) {
|
||||
mObserver->RemoveObserver();
|
||||
}
|
||||
}
|
||||
|
||||
static PBOverrideStatus
|
||||
@ -784,43 +777,4 @@ NeckoParent::RecvOnAuthCancelled(const uint64_t& aCallbackId,
|
||||
return true;
|
||||
}
|
||||
|
||||
nsresult
|
||||
NeckoParent::OfflineNotification(nsISupports *aSubject)
|
||||
{
|
||||
nsCOMPtr<nsIAppOfflineInfo> info(do_QueryInterface(aSubject));
|
||||
if (!info) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
uint32_t targetAppId = NECKO_UNKNOWN_APP_ID;
|
||||
info->GetAppId(&targetAppId);
|
||||
|
||||
for (uint32_t i = 0; i < Manager()->ManagedPBrowserParent().Length(); ++i) {
|
||||
nsRefPtr<TabParent> tabParent =
|
||||
static_cast<TabParent*>(Manager()->ManagedPBrowserParent()[i]);
|
||||
uint32_t appId = tabParent->OwnOrContainingAppId();
|
||||
|
||||
if (appId == targetAppId) {
|
||||
if (gIOService) {
|
||||
bool offline = false;
|
||||
nsresult rv = gIOService->IsAppOffline(appId, &offline);
|
||||
if (NS_FAILED(rv)) {
|
||||
printf_stderr("Unexpected - NeckoParent: "
|
||||
"appId not found by isAppOffline(): %u\n", appId);
|
||||
break;
|
||||
}
|
||||
if (!SendAppOfflineStatus(appId, offline)) {
|
||||
printf_stderr("NeckoParent: "
|
||||
"SendAppOfflineStatus failed for appId: %u\n", appId);
|
||||
}
|
||||
// Once we found the targetAppId, we don't need to continue
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
}} // mozilla::net
|
||||
|
@ -7,7 +7,6 @@
|
||||
|
||||
#include "mozilla/net/PNeckoParent.h"
|
||||
#include "mozilla/net/NeckoCommon.h"
|
||||
#include "mozilla/net/OfflineObserver.h"
|
||||
|
||||
#ifndef mozilla_net_NeckoParent_h
|
||||
#define mozilla_net_NeckoParent_h
|
||||
@ -23,9 +22,8 @@ enum PBOverrideStatus {
|
||||
};
|
||||
|
||||
// Header file contents
|
||||
class NeckoParent
|
||||
: public PNeckoParent
|
||||
, public DisconnectableParent
|
||||
class NeckoParent :
|
||||
public PNeckoParent
|
||||
{
|
||||
public:
|
||||
NeckoParent();
|
||||
@ -53,8 +51,7 @@ public:
|
||||
nsCOMPtr<nsILoadContext> &aResult);
|
||||
|
||||
virtual void ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE;
|
||||
virtual nsresult OfflineNotification(nsISupports *) MOZ_OVERRIDE;
|
||||
virtual uint32_t GetAppId() MOZ_OVERRIDE { return NECKO_UNKNOWN_APP_ID; }
|
||||
|
||||
virtual void
|
||||
CloneManagees(ProtocolBase* aSource,
|
||||
mozilla::ipc::ProtocolCloneContext* aCtx) MOZ_OVERRIDE;
|
||||
@ -204,7 +201,6 @@ protected:
|
||||
private:
|
||||
nsCString mCoreAppsBasePath;
|
||||
nsCString mWebAppsBasePath;
|
||||
nsRefPtr<OfflineObserver> mObserver;
|
||||
};
|
||||
|
||||
} // namespace net
|
||||
|
@ -100,8 +100,6 @@ child:
|
||||
*/
|
||||
AsyncAuthPromptForNestedFrame(uint64_t nestedFrameId, nsCString uri,
|
||||
nsString realm, uint64_t callbackId);
|
||||
// Notifies child that a given app is now offline (or online)
|
||||
AppOfflineStatus(uint32_t appId, bool offline);
|
||||
|
||||
both:
|
||||
// Actually we need PTCPSocket() for parent. But ipdl disallows us having different
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "mozilla/ipc/URIUtils.h"
|
||||
#include "mozilla/unused.h"
|
||||
#include "SerializedLoadContext.h"
|
||||
#include "nsIOService.h"
|
||||
|
||||
using namespace mozilla::ipc;
|
||||
|
||||
@ -38,16 +37,11 @@ FTPChannelParent::FTPChannelParent(nsILoadContext* aLoadContext, PBOverrideStatu
|
||||
nsIProtocolHandler* handler;
|
||||
CallGetService(NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "ftp", &handler);
|
||||
NS_ASSERTION(handler, "no ftp handler");
|
||||
|
||||
mObserver = new OfflineObserver(this);
|
||||
}
|
||||
|
||||
FTPChannelParent::~FTPChannelParent()
|
||||
{
|
||||
gFtpHandler->Release();
|
||||
if (mObserver) {
|
||||
mObserver->RemoveObserver();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -114,18 +108,7 @@ FTPChannelParent::DoAsyncOpen(const URIParams& aURI,
|
||||
this, uriSpec.get()));
|
||||
#endif
|
||||
|
||||
bool app_offline = false;
|
||||
uint32_t appId = GetAppId();
|
||||
if (appId != NECKO_UNKNOWN_APP_ID &&
|
||||
appId != NECKO_NO_APP_ID) {
|
||||
gIOService->IsAppOffline(appId, &app_offline);
|
||||
LOG(("FTP app id %u is offline %d\n", appId, app_offline));
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
if (app_offline)
|
||||
return SendFailedAsyncOpen(NS_ERROR_OFFLINE);
|
||||
|
||||
nsCOMPtr<nsIIOService> ios(do_GetIOService(&rv));
|
||||
if (NS_FAILED(rv))
|
||||
return SendFailedAsyncOpen(rv);
|
||||
@ -190,7 +173,6 @@ FTPChannelParent::RecvCancel(const nsresult& status)
|
||||
{
|
||||
if (mChannel)
|
||||
mChannel->Cancel(status);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -637,25 +619,6 @@ FTPChannelParent::NotifyDiversionFailed(nsresult aErrorCode,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
FTPChannelParent::OfflineDisconnect()
|
||||
{
|
||||
if (mChannel) {
|
||||
mChannel->Cancel(NS_ERROR_OFFLINE);
|
||||
}
|
||||
mStatus = NS_ERROR_OFFLINE;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
FTPChannelParent::GetAppId()
|
||||
{
|
||||
uint32_t appId = NECKO_UNKNOWN_APP_ID;
|
||||
if (mLoadContext) {
|
||||
mLoadContext->GetAppId(&appId);
|
||||
}
|
||||
return appId;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// FTPChannelParent::nsIChannelEventSink
|
||||
//-----------------------------------------------------------------------------
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "mozilla/net/NeckoParent.h"
|
||||
#include "nsIParentChannel.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "OfflineObserver.h"
|
||||
|
||||
class nsFtpChannel;
|
||||
class nsILoadContext;
|
||||
@ -26,7 +25,6 @@ class FTPChannelParent : public PFTPChannelParent
|
||||
, public nsIInterfaceRequestor
|
||||
, public ADivertableParentChannel
|
||||
, public nsIChannelEventSink
|
||||
, public DisconnectableParent
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
@ -81,9 +79,6 @@ protected:
|
||||
|
||||
virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
|
||||
|
||||
void OfflineDisconnect() MOZ_OVERRIDE;
|
||||
uint32_t GetAppId() MOZ_OVERRIDE;
|
||||
|
||||
// if configured to use HTTP proxy for FTP, this can an an HTTP channel.
|
||||
nsCOMPtr<nsIChannel> mChannel;
|
||||
|
||||
@ -108,7 +103,6 @@ protected:
|
||||
// Set if we successfully suspended the nsHttpChannel for diversion. Unset
|
||||
// when we call ResumeForDiversion.
|
||||
bool mSuspendedForDiversion;
|
||||
nsRefPtr<OfflineObserver> mObserver;
|
||||
};
|
||||
|
||||
} // namespace net
|
||||
|
@ -2513,11 +2513,7 @@ nsFtpState::CheckCache()
|
||||
|
||||
// Set cache access requested:
|
||||
nsCacheAccessMode accessReq;
|
||||
uint32_t appId;
|
||||
bool isInBrowser;
|
||||
NS_GetAppInfo(mChannel, &appId, &isInBrowser);
|
||||
|
||||
if (NS_IsOffline() || NS_IsAppOffline(appId)) {
|
||||
if (NS_IsOffline()) {
|
||||
accessReq = nsICache::ACCESS_READ; // can only read
|
||||
} else if (mChannel->HasLoadFlag(nsIRequest::LOAD_BYPASS_CACHE)) {
|
||||
accessReq = nsICache::ACCESS_WRITE; // replace cache entry
|
||||
|
@ -27,8 +27,6 @@
|
||||
#include "SerializedLoadContext.h"
|
||||
#include "nsIAuthInformation.h"
|
||||
#include "nsIAuthPromptCallback.h"
|
||||
#include "nsIOService.h"
|
||||
#include "nsICachingChannel.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::ipc;
|
||||
@ -66,15 +64,10 @@ HttpChannelParent::HttpChannelParent(const PBrowserOrId& iframeEmbedding,
|
||||
} else {
|
||||
mNestedFrameId = iframeEmbedding.get_uint64_t();
|
||||
}
|
||||
|
||||
mObserver = new OfflineObserver(this);
|
||||
}
|
||||
|
||||
HttpChannelParent::~HttpChannelParent()
|
||||
{
|
||||
if (mObserver) {
|
||||
mObserver->RemoveObserver();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -167,7 +160,7 @@ HttpChannelParent::DoAsyncOpen( const URIParams& aURI,
|
||||
const OptionalURIParams& aDocURI,
|
||||
const OptionalURIParams& aReferrerURI,
|
||||
const OptionalURIParams& aAPIRedirectToURI,
|
||||
const uint32_t& aLoadFlags,
|
||||
const uint32_t& loadFlags,
|
||||
const RequestHeaderTuples& requestHeaders,
|
||||
const nsCString& requestMethod,
|
||||
const OptionalInputStreamParams& uploadStream,
|
||||
@ -207,20 +200,6 @@ HttpChannelParent::DoAsyncOpen( const URIParams& aURI,
|
||||
if (NS_FAILED(rv))
|
||||
return SendFailedAsyncOpen(rv);
|
||||
|
||||
bool appOffline = false;
|
||||
uint32_t appId = GetAppId();
|
||||
if (appId != NECKO_UNKNOWN_APP_ID &&
|
||||
appId != NECKO_NO_APP_ID) {
|
||||
gIOService->IsAppOffline(appId, &appOffline);
|
||||
}
|
||||
|
||||
uint32_t loadFlags = aLoadFlags;
|
||||
if (appOffline) {
|
||||
loadFlags |= nsICachingChannel::LOAD_ONLY_FROM_CACHE;
|
||||
loadFlags |= nsIRequest::LOAD_FROM_CACHE;
|
||||
loadFlags |= nsICachingChannel::LOAD_NO_NETWORK_IO;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIChannel> channel;
|
||||
rv = NS_NewChannel(getter_AddRefs(channel), uri, ios, nullptr, nullptr, loadFlags);
|
||||
if (NS_FAILED(rv))
|
||||
@ -306,8 +285,10 @@ HttpChannelParent::DoAsyncOpen( const URIParams& aURI,
|
||||
|
||||
if (setChooseApplicationCache) {
|
||||
bool inBrowser = false;
|
||||
uint32_t appId = NECKO_NO_APP_ID;
|
||||
if (mLoadContext) {
|
||||
mLoadContext->GetIsInBrowserElement(&inBrowser);
|
||||
mLoadContext->GetAppId(&appId);
|
||||
}
|
||||
|
||||
bool chooseAppCache = false;
|
||||
@ -352,22 +333,6 @@ HttpChannelParent::ConnectChannel(const uint32_t& channelId)
|
||||
}
|
||||
}
|
||||
|
||||
bool appOffline = false;
|
||||
uint32_t appId = GetAppId();
|
||||
if (appId != NECKO_UNKNOWN_APP_ID &&
|
||||
appId != NECKO_NO_APP_ID) {
|
||||
gIOService->IsAppOffline(appId, &appOffline);
|
||||
}
|
||||
|
||||
if (appOffline) {
|
||||
uint32_t loadFlags;
|
||||
mChannel->GetLoadFlags(&loadFlags);
|
||||
loadFlags |= nsICachingChannel::LOAD_ONLY_FROM_CACHE;
|
||||
loadFlags |= nsIRequest::LOAD_FROM_CACHE;
|
||||
loadFlags |= nsICachingChannel::LOAD_NO_NETWORK_IO;
|
||||
mChannel->SetLoadFlags(loadFlags);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1036,25 +1001,6 @@ HttpChannelParent::NotifyDiversionFailed(nsresult aErrorCode,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
HttpChannelParent::OfflineDisconnect()
|
||||
{
|
||||
if (mChannel) {
|
||||
mChannel->Cancel(NS_ERROR_OFFLINE);
|
||||
}
|
||||
mStatus = NS_ERROR_OFFLINE;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
HttpChannelParent::GetAppId()
|
||||
{
|
||||
uint32_t appId = NECKO_UNKNOWN_APP_ID;
|
||||
if (mLoadContext) {
|
||||
mLoadContext->GetAppId(&appId);
|
||||
}
|
||||
return appId;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HttpChannelParent::GetAuthPrompt(uint32_t aPromptReason, const nsIID& iid,
|
||||
void** aResult)
|
||||
|
@ -13,8 +13,6 @@
|
||||
#include "mozilla/net/PHttpChannelParent.h"
|
||||
#include "mozilla/net/NeckoCommon.h"
|
||||
#include "mozilla/net/NeckoParent.h"
|
||||
#include "OfflineObserver.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsIParentRedirectingChannel.h"
|
||||
#include "nsIProgressEventSink.h"
|
||||
#include "nsHttpChannel.h"
|
||||
@ -40,7 +38,6 @@ class HttpChannelParent : public PHttpChannelParent
|
||||
, public nsIInterfaceRequestor
|
||||
, public ADivertableParentChannel
|
||||
, public nsIAuthPromptProvider
|
||||
, public DisconnectableParent
|
||||
{
|
||||
virtual ~HttpChannelParent();
|
||||
|
||||
@ -129,9 +126,6 @@ protected:
|
||||
friend class HttpChannelParentListener;
|
||||
nsRefPtr<mozilla::dom::TabParent> mTabParent;
|
||||
|
||||
void OfflineDisconnect() MOZ_OVERRIDE;
|
||||
uint32_t GetAppId() MOZ_OVERRIDE;
|
||||
|
||||
private:
|
||||
nsRefPtr<nsHttpChannel> mChannel;
|
||||
nsCOMPtr<nsICacheEntry> mCacheEntry;
|
||||
@ -153,8 +147,6 @@ private:
|
||||
bool mSentRedirect1BeginFailed : 1;
|
||||
bool mReceivedRedirect2Verify : 1;
|
||||
|
||||
nsRefPtr<OfflineObserver> mObserver;
|
||||
|
||||
PBOverrideStatus mPBOverride;
|
||||
|
||||
nsCOMPtr<nsILoadContext> mLoadContext;
|
||||
|
@ -2557,16 +2557,8 @@ nsHttpChannel::OpenCacheEntry(bool usingSSL)
|
||||
openURI = mURI;
|
||||
}
|
||||
|
||||
uint32_t appId = info->AppId();
|
||||
bool appOffline = false;
|
||||
|
||||
if (appId != NECKO_NO_APP_ID) {
|
||||
gIOService->IsAppOffline(appId, &appOffline);
|
||||
LOG(("nsHttpChannel::OpenCacheEntry appId: %u, offline: %d\n", appId, appOffline));
|
||||
}
|
||||
|
||||
uint32_t cacheEntryOpenFlags;
|
||||
bool offline = gIOService->IsOffline() || appOffline;
|
||||
bool offline = gIOService->IsOffline();
|
||||
if (offline || (mLoadFlags & INHIBIT_CACHING)) {
|
||||
if (BYPASS_LOCAL_CACHE(mLoadFlags) && !offline) {
|
||||
goto bypassCacheEntryOpen;
|
||||
|
@ -10,8 +10,6 @@
|
||||
#include "mozilla/ipc/InputStreamUtils.h"
|
||||
#include "mozilla/ipc/URIUtils.h"
|
||||
#include "SerializedLoadContext.h"
|
||||
#include "nsIOService.h"
|
||||
#include "mozilla/net/NeckoCommon.h"
|
||||
|
||||
using namespace mozilla::ipc;
|
||||
|
||||
@ -35,15 +33,8 @@ WebSocketChannelParent::WebSocketChannelParent(nsIAuthPromptProvider* aAuthProvi
|
||||
if (!webSocketLog)
|
||||
webSocketLog = PR_NewLogModule("nsWebSocket");
|
||||
#endif
|
||||
mObserver = new OfflineObserver(this);
|
||||
}
|
||||
|
||||
WebSocketChannelParent::~WebSocketChannelParent()
|
||||
{
|
||||
if (mObserver) {
|
||||
mObserver->RemoveObserver();
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------------------
|
||||
// WebSocketChannelParent::PWebSocketChannelParent
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -72,17 +63,6 @@ WebSocketChannelParent::RecvAsyncOpen(const URIParams& aURI,
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
|
||||
|
||||
bool appOffline = false;
|
||||
uint32_t appId = GetAppId();
|
||||
if (appId != NECKO_UNKNOWN_APP_ID &&
|
||||
appId != NECKO_NO_APP_ID) {
|
||||
gIOService->IsAppOffline(appId, &appOffline);
|
||||
if (appOffline) {
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
if (aSecure) {
|
||||
mChannel =
|
||||
do_CreateInstance("@mozilla.org/network/protocol;1?name=wss", &rv);
|
||||
@ -137,7 +117,6 @@ WebSocketChannelParent::RecvClose(const uint16_t& code, const nsCString& reason)
|
||||
nsresult rv = mChannel->Close(code, reason);
|
||||
NS_ENSURE_SUCCESS(rv, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -279,24 +258,6 @@ WebSocketChannelParent::GetInterface(const nsIID & iid, void **result)
|
||||
return QueryInterface(iid, result);
|
||||
}
|
||||
|
||||
void
|
||||
WebSocketChannelParent::OfflineDisconnect()
|
||||
{
|
||||
if (mChannel) {
|
||||
mChannel->Close(nsIWebSocketChannel::CLOSE_GOING_AWAY,
|
||||
nsCString("App is offline"));
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t
|
||||
WebSocketChannelParent::GetAppId()
|
||||
{
|
||||
uint32_t appId = NECKO_UNKNOWN_APP_ID;
|
||||
if (mLoadContext) {
|
||||
mLoadContext->GetAppId(&appId);
|
||||
}
|
||||
return appId;
|
||||
}
|
||||
|
||||
} // namespace net
|
||||
} // namespace mozilla
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "nsILoadContext.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsString.h"
|
||||
#include "OfflineObserver.h"
|
||||
|
||||
class nsIAuthPromptProvider;
|
||||
|
||||
@ -24,10 +23,10 @@ namespace net {
|
||||
|
||||
class WebSocketChannelParent : public PWebSocketParent,
|
||||
public nsIWebSocketListener,
|
||||
public DisconnectableParent,
|
||||
public nsIInterfaceRequestor
|
||||
{
|
||||
~WebSocketChannelParent();
|
||||
~WebSocketChannelParent() {}
|
||||
|
||||
public:
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
NS_DECL_NSIWEBSOCKETLISTENER
|
||||
@ -55,10 +54,6 @@ class WebSocketChannelParent : public PWebSocketParent,
|
||||
|
||||
void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
|
||||
|
||||
void OfflineDisconnect() MOZ_OVERRIDE;
|
||||
uint32_t GetAppId() MOZ_OVERRIDE;
|
||||
nsRefPtr<OfflineObserver> mObserver;
|
||||
|
||||
nsCOMPtr<nsIAuthPromptProvider> mAuthProvider;
|
||||
nsCOMPtr<nsIWebSocketChannel> mChannel;
|
||||
nsCOMPtr<nsILoadContext> mLoadContext;
|
||||
|
@ -1,55 +0,0 @@
|
||||
|
||||
function inChildProcess() {
|
||||
return Cc["@mozilla.org/xre/app-info;1"]
|
||||
.getService(Ci.nsIXULRuntime)
|
||||
.processType != Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
|
||||
}
|
||||
|
||||
function makeChan(url, appId, inBrowser) {
|
||||
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
|
||||
var chan = ios.newChannel(url, null, null).QueryInterface(Ci.nsIHttpChannel);
|
||||
chan.notificationCallbacks = {
|
||||
appId: appId,
|
||||
isInBrowserElement: inBrowser,
|
||||
QueryInterface: function(iid) {
|
||||
if (iid.equals(Ci.nsILoadContext))
|
||||
return this;
|
||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||
},
|
||||
getInterface: function(iid) { return this.QueryInterface(iid); }
|
||||
};
|
||||
return chan;
|
||||
}
|
||||
|
||||
// Simple online load
|
||||
function run_test() {
|
||||
do_test_pending();
|
||||
var chan = makeChan("http://localhost:12345/first", 14, false);
|
||||
chan.asyncOpen(new ChannelListener(checkResponse, "response0"), null);
|
||||
}
|
||||
|
||||
// Should return cached result
|
||||
function test1() {
|
||||
do_test_pending();
|
||||
var chan = makeChan("http://localhost:12345/first", 14, false);
|
||||
chan.asyncOpen(new ChannelListener(checkResponse, "response0"), null);
|
||||
}
|
||||
|
||||
// This request should fail
|
||||
function test2() {
|
||||
do_test_pending();
|
||||
var chan = makeChan("http://localhost:12345/second", 14, false);
|
||||
chan.asyncOpen(new ChannelListener(checkResponse, "", CL_EXPECT_FAILURE), null);
|
||||
}
|
||||
|
||||
// This request should succeed
|
||||
function test3() {
|
||||
do_test_pending();
|
||||
var chan = makeChan("http://localhost:12345/second", 14, false);
|
||||
chan.asyncOpen(new ChannelListener(checkResponse, "response3"), null);
|
||||
}
|
||||
|
||||
function checkResponse(req, buffer, expected) {
|
||||
do_check_eq(buffer, expected);
|
||||
do_test_finished();
|
||||
}
|
@ -1,74 +0,0 @@
|
||||
|
||||
Cu.import("resource://testing-common/httpd.js");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
var test_index = 0;
|
||||
|
||||
var responses = [
|
||||
"response0", // This should be the first returned value
|
||||
"response1", // This response should not be recevied. Load response0 from cache
|
||||
"response2", // This request should fail
|
||||
"response3", // This request should succeed
|
||||
];
|
||||
|
||||
function http_handler(metadata, response) {
|
||||
response.setHeader("Content-Type", "text/plain", false);
|
||||
response.setHeader("Cache-Control", "no-cache", false);
|
||||
response.setStatusLine(metadata.httpVersion, 200, "OK");
|
||||
var body = responses[test_index];
|
||||
response.bodyOutputStream.write(body, body.length);
|
||||
}
|
||||
|
||||
|
||||
function set_app_offline(appId, offline) {
|
||||
let ioservice = Cc['@mozilla.org/network/io-service;1'].
|
||||
getService(Ci.nsIIOService);
|
||||
|
||||
ioservice.setAppOffline(appId, offline);
|
||||
}
|
||||
|
||||
var httpserv;
|
||||
|
||||
function setup() {
|
||||
httpserv = new HttpServer();
|
||||
httpserv.registerPathHandler("/first", http_handler);
|
||||
httpserv.registerPathHandler("/second", http_handler);
|
||||
httpserv.start(12345);
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
setup();
|
||||
test0();
|
||||
}
|
||||
|
||||
// Test that app 14 can open channel
|
||||
function test0() {
|
||||
test_index = 0;
|
||||
run_test_in_child("child_app_offline.js", test1);
|
||||
}
|
||||
|
||||
// Set app 14 offline and check that it still gets a cached response
|
||||
function test1() {
|
||||
test_index = 1;
|
||||
set_app_offline(14, Ci.nsIAppOfflineInfo.OFFLINE);
|
||||
sendCommand('test1();\n', test2);
|
||||
}
|
||||
|
||||
// Check that app 14 can't open a channel to a new location
|
||||
function test2() {
|
||||
test_index = 2;
|
||||
sendCommand('test2();\n', test3);
|
||||
}
|
||||
|
||||
|
||||
// Set app online and check that it now works
|
||||
function test3() {
|
||||
test_index = 3;
|
||||
set_app_offline(14, Ci.nsIAppOfflineInfo.ONLINE);
|
||||
sendCommand('test3();\n', ending);
|
||||
}
|
||||
|
||||
function ending(val) {
|
||||
do_test_finished();
|
||||
}
|
@ -2,7 +2,6 @@
|
||||
head = head_channels_clone.js head_cc.js
|
||||
tail =
|
||||
support-files = disabled_test_bug528292_wrap.js
|
||||
child_app_offline.js
|
||||
|
||||
[test_bug248970_cookie_wrap.js]
|
||||
[test_cacheflags_wrap.js]
|
||||
@ -36,4 +35,3 @@ skip-if = true
|
||||
[test_XHR_redirects.js]
|
||||
[test_redirect_history_wrap.js]
|
||||
[test_reply_without_content_type_wrap.js]
|
||||
[test_app_offline_http.js]
|
||||
|
Loading…
Reference in New Issue
Block a user