Merge m-c to fx-team a=merge

This commit is contained in:
Wes Kocher 2014-08-26 18:22:27 -07:00
commit 47642fa9bf
120 changed files with 850 additions and 1322 deletions

View File

@ -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"/>

View File

@ -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"/>

View File

@ -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 -->

View File

@ -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"/>

View File

@ -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"/>

View File

@ -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 -->

View File

@ -4,6 +4,6 @@
"remote": "",
"branch": ""
},
"revision": "c6e222c3d86410830558dcf89436313b431da418",
"revision": "f2dfcf31b96b8ffdf3dda0bd7b7272a07643e916",
"repo_path": "/integration/gaia-central"
}

View File

@ -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"/>

View File

@ -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"/>

View File

@ -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 -->

View File

@ -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"/>

View File

@ -80,7 +80,8 @@
};
replaceWithHost(intro);
if (getCSSClass() == "expertBadCert") {
var cssClass = getCSSClass();
if (cssClass == "expertBadCert") {
toggle('technicalContent');
toggle('expertContent');
}
@ -88,8 +89,12 @@
// Disallow overrides if this is a Strict-Transport-Security
// host and the cert is bad (STS Spec section 7.3) or if the
// certerror is in a frame (bug 633691).
if (getCSSClass() == "badStsCert" || window != top)
if (cssClass == "badStsCert" || window != top) {
document.getElementById("expertContent").setAttribute("hidden", "true");
}
if (cssClass != "badStsCert") {
document.getElementById("badStsCertExplanation").setAttribute("hidden", "true");
}
var tech = document.getElementById("technicalContentText");
if (tech)
@ -214,6 +219,7 @@
<h2>&certerror.whatShouldIDo.heading;</h2>
<div id="whatShouldIDoContentText">
<p>&certerror.whatShouldIDo.content;</p>
<p id="badStsCertExplanation">&certerror.whatShouldIDo.badStsCertExplanation;</p>
<button id='getMeOutOfHereButton'>&certerror.getMeOutOfHere.label;</button>
</div>
</div>

View File

@ -80,7 +80,23 @@ addEventListener("blur", function(event) {
if (Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_CONTENT) {
addEventListener("contextmenu", function (event) {
sendSyncMessage("contextmenu", {}, { event: event });
let defaultPrevented = event.defaultPrevented;
if (!Services.prefs.getBoolPref("dom.event.contextmenu.enabled")) {
let plugin = null;
try {
plugin = event.target.QueryInterface(Ci.nsIObjectLoadingContent);
} catch (e) {}
if (plugin && plugin.displayedType == Ci.nsIObjectLoadingContent.TYPE_PLUGIN) {
// Don't open a context menu for plugins.
return;
}
defaultPrevented = false;
}
if (!defaultPrevented) {
sendSyncMessage("contextmenu", {}, { event: event });
}
}, false);
} else {
addEventListener("mozUITour", function(event) {
@ -616,4 +632,4 @@ let DOMFullscreenHandler = {
}
}
};
DOMFullscreenHandler.init();
DOMFullscreenHandler.init();

View File

@ -26,6 +26,10 @@ going to the right place. However, this site's identity can't be verified.">
<!ENTITY certerror.whatShouldIDo.content "If you usually connect to
this site without problems, this error could mean that someone is
trying to impersonate the site, and you shouldn't continue.">
<!ENTITY certerror.whatShouldIDo.badStsCertExplanation "This site uses HTTP
Strict Transport Security (HSTS) to specify that &brandShortName; only connect
to it securely. As a result, it is not possible to add an exception for this
certificate.">
<!ENTITY certerror.getMeOutOfHere.label "Get me out of here!">
<!ENTITY certerror.expert.heading "I Understand the Risks">

View File

@ -60,4 +60,5 @@ if CONFIG['GNU_CXX']:
CXXFLAGS += [
'-Wno-empty-body',
'-Wno-type-limits',
'-Wno-unused-local-typedefs',
]

View File

@ -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();
}

View File

@ -593,10 +593,6 @@ Navigator::CookieEnabled()
bool
Navigator::OnLine()
{
if (mWindow && mWindow->GetDoc()) {
return !NS_IsAppOffline(mWindow->GetDoc()->NodePrincipal());
}
return !NS_IsOffline();
}

View File

@ -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.

View File

@ -592,6 +592,7 @@ ContentChild::Init(MessageLoop* aIOLoop,
void
ContentChild::InitProcessAttributes()
{
#ifdef MOZ_WIDGET_GONK
#ifdef MOZ_NUWA_PROCESS
if (IsNuwaProcess()) {
SetProcessName(NS_LITERAL_STRING("(Nuwa)"), false);
@ -603,7 +604,9 @@ ContentChild::InitProcessAttributes()
} else {
SetProcessName(NS_LITERAL_STRING("Browser"), false);
}
#else
SetProcessName(NS_LITERAL_STRING("Web Content"), true);
#endif
}
void

View File

@ -521,11 +521,6 @@ child:
*/
UIResolutionChanged();
/**
* Tell the child of an app's offline status
*/
AppOfflineStatus(uint32_t id, bool offline);
/*
* FIXME: write protocol!

View File

@ -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:

View File

@ -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,

View File

@ -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

View File

@ -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;

View File

@ -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");
}

View File

@ -15,6 +15,9 @@ namespace mobilemessage {
class MobileMessageDatabaseService MOZ_FINAL : public nsIMobileMessageDatabaseService
{
private:
~MobileMessageDatabaseService() {}
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIMOBILEMESSAGEDATABASESERVICE

View File

@ -14,6 +14,9 @@ namespace mobilemessage {
class SmsService MOZ_FINAL : public nsISmsService
{
private:
~SmsService() {}
public:
NS_DECL_ISUPPORTS
NS_DECL_NSISMSSERVICE

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -184,7 +184,10 @@ PluginModuleChild::Init(const std::string& aPluginFilename,
AddQuirk(QUIRK_FLASH_EXPOSE_COORD_TRANSLATION);
}
#else // defined(OS_MACOSX)
mozilla::plugins::PluginUtilsOSX::SetProcessName(info.fName);
const char* namePrefix = "Plugin Content";
char nameBuffer[80];
snprintf(nameBuffer, sizeof(nameBuffer), "%s (%s)", namePrefix, info.fName);
mozilla::plugins::PluginUtilsOSX::SetProcessName(nameBuffer);
#endif
pluginFile.FreePluginInfo(info);

View File

@ -277,7 +277,7 @@ bool mozilla::plugins::PluginUtilsOSX::SetProcessName(const char* aProcessName)
char formattedName[1024];
snprintf(formattedName, sizeof(formattedName),
"%s (%s)", [currentName UTF8String], aProcessName);
"%s %s", [currentName UTF8String], aProcessName);
aProcessName = formattedName;

View File

@ -351,8 +351,6 @@ DOMStorageCache::WaitForPreload(Telemetry::ID aTelemetryID)
nsresult
DOMStorageCache::GetLength(const DOMStorage* aStorage, uint32_t* aRetval)
{
Telemetry::AutoTimer<Telemetry::LOCALDOMSTORAGE_GETLENGTH_MS> autoTimer;
if (Persist(aStorage)) {
WaitForPreload(Telemetry::LOCALDOMSTORAGE_GETLENGTH_BLOCKING_MS);
if (NS_FAILED(mLoadResult)) {
@ -401,8 +399,6 @@ DOMStorageCache::GetKey(const DOMStorage* aStorage, uint32_t aIndex, nsAString&
// suck if there's a large numer of indexes. Do we care? If so,
// maybe we need to have a lazily populated key array here or
// something?
Telemetry::AutoTimer<Telemetry::LOCALDOMSTORAGE_GETKEY_MS> autoTimer;
if (Persist(aStorage)) {
WaitForPreload(Telemetry::LOCALDOMSTORAGE_GETKEY_BLOCKING_MS);
if (NS_FAILED(mLoadResult)) {
@ -431,8 +427,6 @@ KeysArrayBuilder(const nsAString& aKey, const nsString aValue, void* aArg)
void
DOMStorageCache::GetKeys(const DOMStorage* aStorage, nsTArray<nsString>& aKeys)
{
Telemetry::AutoTimer<Telemetry::LOCALDOMSTORAGE_GETALLKEYS_MS> autoTimer;
if (Persist(aStorage)) {
WaitForPreload(Telemetry::LOCALDOMSTORAGE_GETALLKEYS_BLOCKING_MS);
}
@ -448,8 +442,6 @@ nsresult
DOMStorageCache::GetItem(const DOMStorage* aStorage, const nsAString& aKey,
nsAString& aRetval)
{
Telemetry::AutoTimer<Telemetry::LOCALDOMSTORAGE_GETVALUE_MS> autoTimer;
if (Persist(aStorage)) {
WaitForPreload(Telemetry::LOCALDOMSTORAGE_GETVALUE_BLOCKING_MS);
if (NS_FAILED(mLoadResult)) {
@ -472,8 +464,6 @@ nsresult
DOMStorageCache::SetItem(const DOMStorage* aStorage, const nsAString& aKey,
const nsString& aValue, nsString& aOld)
{
Telemetry::AutoTimer<Telemetry::LOCALDOMSTORAGE_SETVALUE_MS> autoTimer;
if (Persist(aStorage)) {
WaitForPreload(Telemetry::LOCALDOMSTORAGE_SETVALUE_BLOCKING_MS);
if (NS_FAILED(mLoadResult)) {
@ -520,8 +510,6 @@ nsresult
DOMStorageCache::RemoveItem(const DOMStorage* aStorage, const nsAString& aKey,
nsString& aOld)
{
Telemetry::AutoTimer<Telemetry::LOCALDOMSTORAGE_REMOVEKEY_MS> autoTimer;
if (Persist(aStorage)) {
WaitForPreload(Telemetry::LOCALDOMSTORAGE_REMOVEKEY_BLOCKING_MS);
if (NS_FAILED(mLoadResult)) {
@ -556,8 +544,6 @@ DOMStorageCache::RemoveItem(const DOMStorage* aStorage, const nsAString& aKey,
nsresult
DOMStorageCache::Clear(const DOMStorage* aStorage)
{
Telemetry::AutoTimer<Telemetry::LOCALDOMSTORAGE_CLEAR_MS> autoTimer;
bool refresh = false;
if (Persist(aStorage)) {
// We need to preload all data (know the size) before we can proceeed

View File

@ -7,6 +7,9 @@
class nsHapticFeedback MOZ_FINAL : public nsIHapticFeedback
{
private:
~nsHapticFeedback() {}
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIHAPTICFEEDBACK

View File

@ -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(&notificationAppId);
if (appId != notificationAppId) {
return NS_OK;
}
SendOfflineStatusChangeEventToAllWorkers(NS_IsAppOffline(appId));
}
NS_NOTREACHED("Unknown observer topic!");
return NS_OK;

View File

@ -3528,7 +3528,7 @@ WorkerPrivate::WorkerPrivate(JSContext* aCx,
else {
AssertIsOnMainThread();
RuntimeService::GetDefaultPreferences(mPreferences);
mOnLine = !NS_IsOffline() && !NS_IsAppOffline(aLoadInfo.mPrincipal);
mOnLine = !NS_IsOffline();
}
}

View File

@ -451,7 +451,7 @@ CompositorD3D11::CreateRenderTargetFromSource(const gfx::IntRect &aRect,
srcBox.front = 0;
srcBox.right = aSourcePoint.x + aRect.width;
srcBox.bottom = aSourcePoint.y + aRect.height;
srcBox.back = 0;
srcBox.back = 1;
const IntSize& srcSize = sourceD3D11->GetSize();
MOZ_ASSERT(srcSize.width >= 0 && srcSize.height >= 0,

View File

@ -44,6 +44,9 @@ static FT_Library gPlatformFTLibrary = nullptr;
class FreetypeReporter MOZ_FINAL : public nsIMemoryReporter,
public CountingAllocatorBase<FreetypeReporter>
{
private:
~FreetypeReporter() {}
public:
NS_DECL_ISUPPORTS

View File

@ -25,7 +25,6 @@ class nsIconChannel MOZ_FINAL : public nsIChannel {
NS_FORWARD_NSICHANNEL(mRealChannel->)
nsIconChannel() {}
~nsIconChannel() {}
/**
* Called by nsIconProtocolHandler after it creates this channel.
@ -33,7 +32,10 @@ class nsIconChannel MOZ_FINAL : public nsIChannel {
* If this method fails, no other function must be called on this object.
*/
nsresult Init(nsIURI* aURI);
private:
~nsIconChannel() {}
/**
* The channel to the temp icon file (e.g. to /tmp/2qy9wjqw.html).
* Will always be non-null after a successful Init.

View File

@ -4,4 +4,4 @@
/* Localized versions of Info.plist keys */
CFBundleName = "%APP_NAME% Plugin Process";
CFBundleName = "%APP_NAME%";

View File

@ -0,0 +1,20 @@
/* 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 "ProcessUtils.h"
#include "nsString.h"
#include "mozilla/plugins/PluginUtilsOSX.h"
namespace mozilla {
namespace ipc {
void SetThisProcessName(const char *aName)
{
mozilla::plugins::PluginUtilsOSX::SetProcessName(aName);
}
} // namespace ipc
} // namespace mozilla

View File

@ -85,6 +85,10 @@ elif CONFIG['OS_ARCH'] in ('DragonFly', 'FreeBSD', 'NetBSD', 'OpenBSD'):
UNIFIED_SOURCES += [
'ProcessUtils_bsd.cpp'
]
elif CONFIG['OS_ARCH'] in ('Darwin'):
UNIFIED_SOURCES += [
'ProcessUtils_mac.mm'
]
else:
UNIFIED_SOURCES += [
'ProcessUtils_none.cpp',

View File

@ -15,7 +15,11 @@
class JSAtom;
struct JSRuntime;
namespace js { class AsmJSActivation; class AsmJSProfilingFrameIterator; }
namespace js {
class Activation;
class AsmJSProfilingFrameIterator;
}
namespace JS {
@ -25,15 +29,15 @@ namespace JS {
// unwound.
class JS_PUBLIC_API(ProfilingFrameIterator)
{
js::AsmJSActivation *activation_;
js::Activation *activation_;
static const unsigned StorageSpace = 6 * sizeof(void*);
mozilla::AlignedStorage<StorageSpace> storage_;
js::AsmJSProfilingFrameIterator &iter() {
js::AsmJSProfilingFrameIterator &asmJSIter() {
JS_ASSERT(!done());
return *reinterpret_cast<js::AsmJSProfilingFrameIterator*>(storage_.addr());
}
const js::AsmJSProfilingFrameIterator &iter() const {
const js::AsmJSProfilingFrameIterator &asmJSIter() const {
JS_ASSERT(!done());
return *reinterpret_cast<const js::AsmJSProfilingFrameIterator*>(storage_.addr());
}
@ -64,6 +68,12 @@ class JS_PUBLIC_API(ProfilingFrameIterator)
// Return a label suitable for regexp-matching as performed by
// browser/devtools/profiler/cleopatra/js/parserWorker.js
const char *label() const;
private:
void iteratorConstruct(const RegisterState &state);
void iteratorConstruct();
void iteratorDestroy();
bool iteratorDone();
};
} // namespace JS

View File

@ -7,6 +7,7 @@
#ifndef ds_LifoAlloc_h
#define ds_LifoAlloc_h
#include "mozilla/Attributes.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/MathAlgorithms.h"
#include "mozilla/MemoryChecking.h"
@ -147,7 +148,7 @@ class BumpChunk
} // namespace detail
void
MOZ_NORETURN void
CrashAtUnhandlableOOM(const char *reason);
// LIFO bump allocator: used for phase-oriented and fast LIFO allocations.

View File

@ -379,13 +379,13 @@ class MinorCollectionTracer : public JSTracer
} /* namespace js */
static AllocKind
GetObjectAllocKindForCopy(JSRuntime *rt, JSObject *obj)
GetObjectAllocKindForCopy(const Nursery &nursery, JSObject *obj)
{
if (obj->is<ArrayObject>()) {
JS_ASSERT(obj->numFixedSlots() == 0);
/* Use minimal size object if we are just going to copy the pointer. */
if (!rt->gc.nursery.isInside(obj->getElementsHeader()))
if (!nursery.isInside(obj->getElementsHeader()))
return FINALIZE_OBJECT0_BACKGROUND;
size_t nelements = obj->getDenseCapacity();
@ -410,7 +410,7 @@ GetObjectAllocKindForCopy(JSRuntime *rt, JSObject *obj)
return GetBackgroundAllocKind(kind);
}
void *
MOZ_ALWAYS_INLINE void *
js::Nursery::allocateFromTenured(Zone *zone, AllocKind thingKind)
{
void *t = zone->allocator.arenas.allocateFromFreeList(thingKind, Arena::thingSize(thingKind));
@ -520,7 +520,8 @@ js::Nursery::traceObject(MinorCollectionTracer *trc, JSObject *obj)
if (clasp->trace)
clasp->trace(trc, obj);
if (!obj->isNative())
MOZ_ASSERT(obj->isNative() == clasp->isNative());
if (!clasp->isNative())
return;
// Note: the contents of copy on write elements pointers are filled in
@ -569,8 +570,8 @@ js::Nursery::markSlot(MinorCollectionTracer *trc, HeapSlot *slotp)
void *
js::Nursery::moveToTenured(MinorCollectionTracer *trc, JSObject *src)
{
AllocKind dstKind = GetObjectAllocKindForCopy(*this, src);
Zone *zone = src->zone();
AllocKind dstKind = GetObjectAllocKindForCopy(trc->runtime(), src);
JSObject *dst = static_cast<JSObject *>(allocateFromTenured(zone, dstKind));
if (!dst)
CrashAtUnhandlableOOM("Failed to allocate object while tenuring.");
@ -585,7 +586,7 @@ js::Nursery::moveToTenured(MinorCollectionTracer *trc, JSObject *src)
return static_cast<void *>(dst);
}
size_t
MOZ_ALWAYS_INLINE size_t
js::Nursery::moveObjectToTenured(JSObject *dst, JSObject *src, AllocKind dstKind)
{
size_t srcSize = Arena::thingSize(dstKind);
@ -646,7 +647,7 @@ js::Nursery::forwardTypedArrayPointers(JSObject *dst, JSObject *src)
nslots);
}
size_t
MOZ_ALWAYS_INLINE size_t
js::Nursery::moveSlotsToTenured(JSObject *dst, JSObject *src, AllocKind dstKind)
{
/* Fixed slots have already been copied over. */
@ -668,7 +669,7 @@ js::Nursery::moveSlotsToTenured(JSObject *dst, JSObject *src, AllocKind dstKind)
return count * sizeof(HeapSlot);
}
size_t
MOZ_ALWAYS_INLINE size_t
js::Nursery::moveElementsToTenured(JSObject *dst, JSObject *src, AllocKind dstKind)
{
if (src->hasEmptyElements() || src->denseElementsAreCopyOnWrite())

View File

@ -13,6 +13,7 @@
# error "Generational GC requires exact rooting."
#endif
#include "mozilla/Attributes.h"
#include "mozilla/DebugOnly.h"
#include "mozilla/ReentrancyGuard.h"
@ -25,7 +26,7 @@
namespace js {
void
MOZ_NORETURN void
CrashAtUnhandlableOOM(const char *reason);
namespace gc {

View File

@ -7542,7 +7542,7 @@ IonBuilder::addTypedArrayLengthAndData(MDefinition *obj,
#else
bool isTenured = true;
#endif
if (isTenured) {
if (isTenured && tarr->hasSingletonType()) {
// The 'data' pointer can change in rare circumstances
// (ArrayBufferObject::changeContents).
types::TypeObjectKey *tarrType = types::TypeObjectKey::get(tarr);
@ -8677,6 +8677,10 @@ IonBuilder::jsop_getprop(PropertyName *name)
MDefinition *obj = current->pop();
// Try to optimize to a specific constant.
if (!getPropTryInferredConstant(&emitted, obj, name) || emitted)
return emitted;
// Try to optimize arguments.length.
if (!getPropTryArgumentsLength(&emitted, obj) || emitted)
return emitted;
@ -8766,6 +8770,28 @@ IonBuilder::checkIsDefinitelyOptimizedArguments(MDefinition *obj, bool *isOptimi
return true;
}
bool
IonBuilder::getPropTryInferredConstant(bool *emitted, MDefinition *obj, PropertyName *name)
{
JS_ASSERT(*emitted == false);
// Need a result typeset to optimize.
types::TemporaryTypeSet *objTypes = obj->resultTypeSet();
if (!objTypes)
return true;
Value constVal = UndefinedValue();
if (objTypes->propertyIsConstant(constraints(), NameToId(name), &constVal)) {
spew("Optimized constant property");
obj->setImplicitlyUsedUnchecked();
if (!pushConstant(constVal))
return false;
*emitted = true;
}
return true;
}
bool
IonBuilder::getPropTryArgumentsLength(bool *emitted, MDefinition *obj)
{
@ -9380,13 +9406,16 @@ IonBuilder::jsop_setprop(PropertyName *name)
if (!setPropTryTypedObject(&emitted, obj, name, value) || emitted)
return emitted;
// Try to emit store from definite slots.
if (!setPropTryDefiniteSlot(&emitted, obj, name, value, barrier, objTypes) || emitted)
return emitted;
// Do not emit optimized stores to slots that may be constant.
if (objTypes && !objTypes->propertyMightBeConstant(constraints(), NameToId(name))) {
// Try to emit store from definite slots.
if (!setPropTryDefiniteSlot(&emitted, obj, name, value, barrier, objTypes) || emitted)
return emitted;
// Try to emit a monomorphic/polymorphic store based on baseline caches.
if (!setPropTryInlineAccess(&emitted, obj, name, value, barrier, objTypes) || emitted)
return emitted;
// Try to emit a monomorphic/polymorphic store based on baseline caches.
if (!setPropTryInlineAccess(&emitted, obj, name, value, barrier, objTypes) || emitted)
return emitted;
}
// Emit a polymorphic cache.
return setPropTryCache(&emitted, obj, name, value, barrier, objTypes);

View File

@ -399,6 +399,7 @@ class IonBuilder : public MIRGenerator
// jsop_getprop() helpers.
bool checkIsDefinitelyOptimizedArguments(MDefinition *obj, bool *isOptimizedArgs);
bool getPropTryInferredConstant(bool *emitted, MDefinition *obj, PropertyName *name);
bool getPropTryArgumentsLength(bool *emitted, MDefinition *obj);
bool getPropTryArgumentsCallee(bool *emitted, MDefinition *obj, PropertyName *name);
bool getPropTryConstant(bool *emitted, MDefinition *obj, PropertyName *name,

View File

@ -1754,6 +1754,69 @@ HeapTypeSetKey::nonWritable(CompilerConstraintList *constraints)
return false;
}
namespace {
class ConstraintDataConstantProperty
{
public:
explicit ConstraintDataConstantProperty() {}
const char *kind() { return "constantProperty"; }
bool invalidateOnNewType(Type type) { return false; }
bool invalidateOnNewPropertyState(TypeSet *property) {
return property->nonConstantProperty();
}
bool invalidateOnNewObjectState(TypeObject *object) { return false; }
bool constraintHolds(JSContext *cx,
const HeapTypeSetKey &property, TemporaryTypeSet *expected)
{
return !invalidateOnNewPropertyState(property.maybeTypes());
}
bool shouldSweep() { return false; }
};
} /* anonymous namespace */
bool
HeapTypeSetKey::constant(CompilerConstraintList *constraints, Value *valOut)
{
if (nonData(constraints))
return false;
if (!maybeTypes())
return false;
if (maybeTypes()->nonConstantProperty())
return false;
// Only singleton object properties can be marked as constants.
JS_ASSERT(object()->singleton());
// Get the current value of the property.
Shape *shape = object()->singleton()->nativeLookupPure(id());
if (!shape)
return false;
Value val = object()->singleton()->nativeGetSlot(shape->slot());
// If the value is a pointer to an object in the nursery, don't optimize.
if (val.isGCThing() && IsInsideNursery(val.toGCThing()))
return false;
// If the value is a string that's not atomic, don't optimize.
if (val.isString() && !val.toString()->isAtom())
return false;
*valOut = val;
LifoAlloc *alloc = constraints->alloc();
typedef CompilerConstraintInstance<ConstraintDataConstantProperty> T;
constraints->add(alloc->new_<T>(alloc, *this, ConstraintDataConstantProperty()));
return true;
}
bool
TemporaryTypeSet::filtersType(const TemporaryTypeSet *other, Type filteredType) const
{
@ -1781,6 +1844,95 @@ TemporaryTypeSet::filtersType(const TemporaryTypeSet *other, Type filteredType)
return true;
}
namespace {
// A constraint that never triggers recompilation.
class ConstraintDataInert
{
public:
explicit ConstraintDataInert() {}
const char *kind() { return "inert"; }
bool invalidateOnNewType(Type type) { return false; }
bool invalidateOnNewPropertyState(TypeSet *property) { return false; }
bool invalidateOnNewObjectState(TypeObject *object) { return false; }
bool constraintHolds(JSContext *cx,
const HeapTypeSetKey &property, TemporaryTypeSet *expected)
{
return true;
}
bool shouldSweep() { return false; }
};
} /* anonymous namespace */
bool
TemporaryTypeSet::propertyMightBeConstant(CompilerConstraintList *constraints, jsid id)
{
if (unknownObject())
return true;
for (size_t i = 0; i < getObjectCount(); i++) {
TypeObjectKey *type = getObject(i);
// Type sets are only marked as constants when they are lazily
// constructed from the properties of singleton typed objects. So watch
// for the cases when a property either already is or might be marked
// as constant in the future.
if (!type || !type->isSingleObject())
continue;
if (type->unknownProperties())
return true;
HeapTypeSetKey property = type->property(id);
if (!property.maybeTypes() || !property.maybeTypes()->nonConstantProperty())
return true;
}
// It is possible for a property that was not marked as constant to
// 'become' one, if we throw away the type property during a GC and
// regenerate it with the constant flag set. TypeObject::sweep only removes
// type properties if they have no constraints attached to them, so add
// inert constraints to pin these properties in place.
LifoAlloc *alloc = constraints->alloc();
for (size_t i = 0; i < getObjectCount(); i++) {
TypeObjectKey *type = getObject(i);
if (!type || !type->isSingleObject())
continue;
HeapTypeSetKey property = type->property(id);
typedef CompilerConstraintInstance<ConstraintDataInert> T;
constraints->add(alloc->new_<T>(alloc, property, ConstraintDataInert()));
}
return false;
}
bool
TemporaryTypeSet::propertyIsConstant(CompilerConstraintList *constraints, jsid id, Value *valOut)
{
JS_ASSERT(valOut);
JSObject *singleton = getSingleton();
if (!singleton)
return false;
TypeObjectKey *type = TypeObjectKey::get(singleton);
if (type->unknownProperties())
return false;
HeapTypeSetKey property = type->property(id);
return property.constant(constraints, valOut);
}
TemporaryTypeSet::DoubleConversion
TemporaryTypeSet::convertDoubleElements(CompilerConstraintList *constraints)
{
@ -2761,6 +2913,8 @@ static inline void
UpdatePropertyType(ExclusiveContext *cx, HeapTypeSet *types, JSObject *obj, Shape *shape,
bool indexed)
{
JS_ASSERT(obj->hasSingletonType() && !obj->hasLazyType());
if (!shape->writable())
types->setNonWritableProperty(cx);
@ -2782,6 +2936,14 @@ UpdatePropertyType(ExclusiveContext *cx, HeapTypeSet *types, JSObject *obj, Shap
Type type = GetValueType(value);
types->TypeSet::addType(type, &cx->typeLifoAlloc());
}
if (indexed || shape->hadOverwrite()) {
types->setNonConstantProperty(cx);
} else {
InferSpew(ISpewOps, "typeSet: %sT%p%s property %s %s - setConstant",
InferSpewColor(types), types, InferSpewColorReset(),
TypeObjectString(obj->type()), TypeIdString(shape->propid()));
}
}
}
@ -2792,8 +2954,10 @@ TypeObject::updateNewPropertyTypes(ExclusiveContext *cx, jsid id, HeapTypeSet *t
InferSpewColor(types), types, InferSpewColorReset(),
TypeObjectString(this), TypeIdString(id));
if (!singleton() || !singleton()->isNative())
if (!singleton() || !singleton()->isNative()) {
types->setNonConstantProperty(cx);
return;
}
/*
* Fill the property in with any type the object already has in an own
@ -2895,7 +3059,17 @@ InlineAddTypeProperty(ExclusiveContext *cx, TypeObject *obj, jsid id, Type type)
AutoEnterAnalysis enter(cx);
HeapTypeSet *types = obj->getProperty(cx, id);
if (!types || types->hasType(type))
if (!types)
return;
// Clear any constant flag if it exists.
if (!types->nonConstantProperty()) {
InferSpew(ISpewOps, "constantMutated: %sT%p%s %s",
InferSpewColor(types), types, InferSpewColorReset(), TypeString(type));
types->setNonConstantProperty(cx);
}
if (types->hasType(type))
return;
InferSpew(ISpewOps, "externalType: property %s %s: %s",

View File

@ -358,7 +358,7 @@ public:
/*
* For constraints attached to an object property's type set, mark the
* property as having its configuration changed.
* property as having changed somehow.
*/
virtual void newPropertyState(JSContext *cx, TypeSet *source) {}
@ -417,6 +417,9 @@ enum MOZ_ENUM_TYPE(uint32_t) {
/* Whether the property has ever been made non-writable. */
TYPE_FLAG_NON_WRITABLE_PROPERTY = 0x00010000,
/* Whether the property might not be constant. */
TYPE_FLAG_NON_CONSTANT_PROPERTY = 0x00020000,
/*
* Whether the property is definitely in a particular slot on all objects
* from which it has not been deleted or reconfigured. For singletons
@ -426,8 +429,8 @@ enum MOZ_ENUM_TYPE(uint32_t) {
* If the property is definite, mask and shift storing the slot + 1.
* Otherwise these bits are clear.
*/
TYPE_FLAG_DEFINITE_MASK = 0xfffe0000,
TYPE_FLAG_DEFINITE_SHIFT = 17
TYPE_FLAG_DEFINITE_MASK = 0xfffc0000,
TYPE_FLAG_DEFINITE_SHIFT = 18
};
typedef uint32_t TypeFlags;
@ -558,6 +561,9 @@ class TypeSet
bool nonWritableProperty() const {
return flags & TYPE_FLAG_NON_WRITABLE_PROPERTY;
}
bool nonConstantProperty() const {
return flags & TYPE_FLAG_NON_CONSTANT_PROPERTY;
}
bool definiteProperty() const { return flags & TYPE_FLAG_DEFINITE_MASK; }
unsigned definiteSlot() const {
JS_ASSERT(definiteProperty());
@ -676,6 +682,9 @@ class HeapTypeSet : public ConstraintTypeSet
/* Mark this type set as representing a non-writable property. */
inline void setNonWritableProperty(ExclusiveContext *cx);
// Mark this type set as being non-constant.
inline void setNonConstantProperty(ExclusiveContext *cx);
};
class CompilerConstraintList;
@ -766,6 +775,10 @@ class TemporaryTypeSet : public TypeSet
/* Whether any objects in the type set needs a barrier on id. */
bool propertyNeedsBarrier(CompilerConstraintList *constraints, jsid id);
/* Whether any objects in the type set might treat id as a constant property. */
bool propertyMightBeConstant(CompilerConstraintList *constraints, jsid id);
bool propertyIsConstant(CompilerConstraintList *constraints, jsid id, Value *valOut);
/*
* Whether this set contains all types in other, except (possibly) the
* specified type.
@ -1404,6 +1417,7 @@ class HeapTypeSetKey
bool knownSubset(CompilerConstraintList *constraints, const HeapTypeSetKey &other);
JSObject *singleton(CompilerConstraintList *constraints);
bool needsBarrier(CompilerConstraintList *constraints);
bool constant(CompilerConstraintList *constraints, Value *valOut);
};
/*

View File

@ -1108,6 +1108,16 @@ HeapTypeSet::setNonWritableProperty(ExclusiveContext *cx)
newPropertyState(cx);
}
inline void
HeapTypeSet::setNonConstantProperty(ExclusiveContext *cx)
{
if (flags & TYPE_FLAG_NON_CONSTANT_PROPERTY)
return;
flags |= TYPE_FLAG_NON_CONSTANT_PROPERTY;
newPropertyState(cx);
}
inline unsigned
TypeSet::getObjectCount() const
{

View File

@ -4056,10 +4056,10 @@ UpdateShapeTypeAndValue(typename ExecutionModeTraits<mode>::ExclusiveContextType
jsid id = shape->propid();
if (shape->hasSlot()) {
if (mode == ParallelExecution) {
if (!obj->nativeSetSlotIfHasType(shape, value))
if (!obj->nativeSetSlotIfHasType(shape, value, /* overwriting = */ false))
return false;
} else {
obj->nativeSetSlotWithType(cx->asExclusiveContext(), shape, value);
obj->nativeSetSlotWithType(cx->asExclusiveContext(), shape, value, /* overwriting = */ false);
}
}
if (!shape->hasSlot() || !shape->hasDefaultGetter() || !shape->hasDefaultSetter()) {

View File

@ -418,9 +418,10 @@ class JSObject : public js::ObjectImpl
return setSlot(slot, value);
}
inline bool nativeSetSlotIfHasType(js::Shape *shape, const js::Value &value);
inline bool nativeSetSlotIfHasType(js::Shape *shape, const js::Value &value,
bool overwriting = true);
inline void nativeSetSlotWithType(js::ExclusiveContext *cx, js::Shape *shape,
const js::Value &value);
const js::Value &value, bool overwriting = true);
inline const js::Value &getReservedSlot(uint32_t index) const {
JS_ASSERT(index < JSSLOT_FREE(getClass()));

View File

@ -665,19 +665,27 @@ JSObject::hasProperty(JSContext *cx, js::HandleObject obj,
}
inline bool
JSObject::nativeSetSlotIfHasType(js::Shape *shape, const js::Value &value)
JSObject::nativeSetSlotIfHasType(js::Shape *shape, const js::Value &value, bool overwriting)
{
if (!js::types::HasTypePropertyId(this, shape->propid(), value))
return false;
nativeSetSlot(shape->slot(), value);
if (overwriting)
shape->setOverwritten();
return true;
}
inline void
JSObject::nativeSetSlotWithType(js::ExclusiveContext *cx, js::Shape *shape,
const js::Value &value)
const js::Value &value, bool overwriting)
{
nativeSetSlot(shape->slot(), value);
if (overwriting)
shape->setOverwritten();
js::types::AddTypePropertyId(cx, this, shape->propid(), value);
}

View File

@ -267,6 +267,10 @@ class ForkJoinActivation : public Activation
public:
explicit ForkJoinActivation(JSContext *cx);
~ForkJoinActivation();
bool isProfiling() const {
return false;
}
};
class ForkJoinContext;

View File

@ -78,6 +78,7 @@ PerThreadData::PerThreadData(JSRuntime *runtime)
traceLogger(nullptr),
#endif
activation_(nullptr),
profilingActivation_(nullptr),
asmJSActivationStack_(nullptr),
autoFlushICache_(nullptr),
#if defined(JS_ARM_SIMULATOR) || defined(JS_MIPS_SIMULATOR)

View File

@ -567,6 +567,12 @@ class PerThreadData : public PerThreadDataFriendFields
*/
js::Activation *activation_;
/*
* Points to the most recent profiling activation running on the
* thread. Protected by rt->interruptLock.
*/
js::Activation * volatile profilingActivation_;
/* See AsmJSActivation comment. Protected by rt->interruptLock. */
js::AsmJSActivation * volatile asmJSActivationStack_;
@ -589,6 +595,10 @@ class PerThreadData : public PerThreadDataFriendFields
return offsetof(PerThreadData, activation_);
}
js::Activation *profilingActivation() const {
return profilingActivation_;
}
js::AsmJSActivation *asmJSActivationStack() const {
return asmJSActivationStack_;
}

View File

@ -823,7 +823,13 @@ class Shape : public gc::BarrieredCell<Shape>
/* Property stored in per-object dictionary, not shared property tree. */
IN_DICTIONARY = 0x02,
UNUSED_BITS = 0x3C
/*
* Slotful property was stored to more than once. This is used as a
* hint for type inference.
*/
OVERWRITTEN = 0x04,
UNUSED_BITS = 0x38
};
/* Get a shape identical to this one, without parent/kids information. */
@ -882,6 +888,13 @@ class Shape : public gc::BarrieredCell<Shape>
: UndefinedValue();
}
void setOverwritten() {
flags |= OVERWRITTEN;
}
bool hadOverwrite() const {
return flags & OVERWRITTEN;
}
void update(PropertyOp getter, StrictPropertyOp setter, uint8_t attrs);
bool matches(const Shape *other) const {

View File

@ -738,11 +738,16 @@ Activation::Activation(ThreadSafeContext *cx, Kind kind)
: cx_(cx),
compartment_(cx->compartment_),
prev_(cx->perThreadData->activation_),
prevProfiling_(prev_ ? prev_->mostRecentProfiling() : nullptr),
savedFrameChain_(0),
hideScriptedCallerCount_(0),
kind_(kind)
{
cx->perThreadData->activation_ = this;
// Link the activation into the list of profiling activations if needed.
if (isProfiling())
registerProfiling();
}
Activation::~Activation()
@ -750,6 +755,33 @@ Activation::~Activation()
JS_ASSERT(cx_->perThreadData->activation_ == this);
JS_ASSERT(hideScriptedCallerCount_ == 0);
cx_->perThreadData->activation_ = prev_;
if (isProfiling())
unregisterProfiling();
}
bool
Activation::isProfiling() const
{
if (isInterpreter())
return asInterpreter()->isProfiling();
if (isJit())
return asJit()->isProfiling();
if (isForkJoin())
return asForkJoin()->isProfiling();
JS_ASSERT(isAsmJS());
return asAsmJS()->isProfiling();
}
Activation *
Activation::mostRecentProfiling()
{
if (isProfiling())
return this;
return prevProfiling_;
}
InterpreterActivation::InterpreterActivation(RunState &state, JSContext *cx,

View File

@ -1618,6 +1618,23 @@ InterpreterFrameIterator::operator++()
return *this;
}
void
Activation::registerProfiling()
{
JS_ASSERT(isProfiling());
JSRuntime::AutoLockForInterrupt lock(cx_->asJSContext()->runtime());
cx_->perThreadData->profilingActivation_ = this;
}
void
Activation::unregisterProfiling()
{
JS_ASSERT(isProfiling());
JSRuntime::AutoLockForInterrupt lock(cx_->asJSContext()->runtime());
JS_ASSERT(cx_->perThreadData->profilingActivation_ == this);
cx_->perThreadData->profilingActivation_ = prevProfiling_;
}
ActivationIterator::ActivationIterator(JSRuntime *rt)
: jitTop_(rt->mainThread.jitTop),
activation_(rt->mainThread.activation_)
@ -1653,50 +1670,99 @@ ActivationIterator::settle()
}
JS::ProfilingFrameIterator::ProfilingFrameIterator(JSRuntime *rt, const RegisterState &state)
: activation_(rt->mainThread.asmJSActivationStack())
: activation_(rt->mainThread.profilingActivation())
{
if (!activation_)
return;
JS_ASSERT(activation_->isProfiling());
static_assert(sizeof(AsmJSProfilingFrameIterator) <= StorageSpace, "Need to increase storage");
new (storage_.addr()) AsmJSProfilingFrameIterator(*activation_, state);
iteratorConstruct(state);
settle();
}
JS::ProfilingFrameIterator::~ProfilingFrameIterator()
{
if (!done())
iter().~AsmJSProfilingFrameIterator();
if (!done()) {
JS_ASSERT(activation_->isProfiling());
iteratorDestroy();
}
}
void
JS::ProfilingFrameIterator::operator++()
{
JS_ASSERT(!done());
++iter();
JS_ASSERT(activation_->isAsmJS());
++asmJSIter();
settle();
}
void
JS::ProfilingFrameIterator::settle()
{
while (iter().done()) {
iter().~AsmJSProfilingFrameIterator();
activation_ = activation_->prevAsmJS();
while (iteratorDone()) {
iteratorDestroy();
activation_ = activation_->prevProfiling();
if (!activation_)
return;
new (storage_.addr()) AsmJSProfilingFrameIterator(*activation_);
iteratorConstruct();
}
}
void
JS::ProfilingFrameIterator::iteratorConstruct(const RegisterState &state)
{
JS_ASSERT(!done());
JS_ASSERT(activation_->isAsmJS());
new (storage_.addr()) AsmJSProfilingFrameIterator(*activation_->asAsmJS(), state);
}
void
JS::ProfilingFrameIterator::iteratorConstruct()
{
JS_ASSERT(!done());
JS_ASSERT(activation_->isAsmJS());
new (storage_.addr()) AsmJSProfilingFrameIterator(*activation_->asAsmJS());
}
void
JS::ProfilingFrameIterator::iteratorDestroy()
{
JS_ASSERT(!done());
JS_ASSERT(activation_->isAsmJS());
asmJSIter().~AsmJSProfilingFrameIterator();
}
bool
JS::ProfilingFrameIterator::iteratorDone()
{
JS_ASSERT(!done());
JS_ASSERT(activation_->isAsmJS());
return asmJSIter().done();
}
void *
JS::ProfilingFrameIterator::stackAddress() const
{
return iter().stackAddress();
JS_ASSERT(!done());
JS_ASSERT(activation_->isAsmJS());
return asmJSIter().stackAddress();
}
const char *
JS::ProfilingFrameIterator::label() const
{
return iter().label();
JS_ASSERT(!done());
JS_ASSERT(activation_->isAsmJS());
return asmJSIter().label();
}

View File

@ -1103,6 +1103,7 @@ class Activation
ThreadSafeContext *cx_;
JSCompartment *compartment_;
Activation *prev_;
Activation *prevProfiling_;
// Counter incremented by JS_SaveFrameChain on the top-most activation and
// decremented by JS_RestoreFrameChain. If > 0, ScriptFrameIter should stop
@ -1133,6 +1134,8 @@ class Activation
Activation *prev() const {
return prev_;
}
Activation *prevProfiling() const { return prevProfiling_; }
inline Activation *mostRecentProfiling();
bool isInterpreter() const {
return kind_ == Interpreter;
@ -1147,6 +1150,10 @@ class Activation
return kind_ == AsmJS;
}
inline bool isProfiling() const;
void registerProfiling();
void unregisterProfiling();
InterpreterActivation *asInterpreter() const {
JS_ASSERT(isInterpreter());
return (InterpreterActivation *)this;
@ -1238,6 +1245,10 @@ class InterpreterActivation : public Activation
return opMask_;
}
bool isProfiling() const {
return false;
}
// If this js::Interpret frame is running |script|, enable interrupts.
void enableInterruptsIfRunning(JSScript *script) {
if (regs_.fp()->script() == script)
@ -1323,6 +1334,10 @@ class JitActivation : public Activation
}
void setActive(JSContext *cx, bool active = true);
bool isProfiling() const {
return false;
}
uint8_t *prevJitTop() const {
return prevJitTop_;
}
@ -1481,6 +1496,10 @@ class AsmJSActivation : public Activation
AsmJSModule &module() const { return module_; }
AsmJSActivation *prevAsmJS() const { return prevAsmJS_; }
bool isProfiling() const {
return true;
}
// Returns a pointer to the base of the innermost stack frame of asm.js code
// in this activation.
uint8_t *fp() const { return fp_; }

View File

@ -0,0 +1,27 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<title>CSS Filters: Blur an HTML Element Using a Negative Calc Function Value</title>
<link rel="author" title="Max Vujovic" href="mailto:mvujovic@adobe.com">
<link rel="help" href="http://www.w3.org/TR/filter-effects-1/#funcdef-blur">
<link rel="match" href="blur-calc-negative-ref.html">
<meta name="assert"
content="Given a calc() value that evaluates to a negative result, the
CSS blur filter function should not blur an HTML element.">
<style type="text/css">
#target {
background-color: #0f0;
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<p>You should see a green square.</p>
<div id="target"></div>
</body>
</html>

View File

@ -0,0 +1,28 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<title>CSS Filters: Blur an HTML Element Using a Negative Calc Function Value</title>
<link rel="author" title="Max Vujovic" href="mailto:mvujovic@adobe.com">
<link rel="help" href="http://www.w3.org/TR/filter-effects-1/#funcdef-blur">
<link rel="match" href="blur-calc-negative-ref.html">
<meta name="assert"
content="Given a calc() value that evaluates to a negative result, the
CSS blur filter function should not blur an HTML element.">
<style type="text/css">
#target {
filter: blur(calc(-10px));
background-color: #0f0;
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<p>You should see a green square.</p>
<div id="target"></div>
</body>
</html>

View File

@ -0,0 +1,23 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<title>CSS Filters: Blur an HTML Element Using a Calc Function Value</title>
<link rel="author" title="Max Vujovic" href="mailto:mvujovic@adobe.com">
<style type="text/css">
#target {
filter: blur(10px);
background-color: #0f0;
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<p>You should see a blurred green square.</p>
<div id="target"></div>
</body>
</html>

View File

@ -0,0 +1,28 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
<html>
<head>
<title>CSS Filters: Blur an HTML Element Using a Calc Function Value</title>
<link rel="author" title="Max Vujovic" href="mailto:mvujovic@adobe.com">
<link rel="help" href="http://www.w3.org/TR/filter-effects-1/#funcdef-blur">
<link rel="match" href="blur-calc-ref.html">
<meta name="assert"
content="Given a calc() value that evaluates to a positive result, the
CSS blur filter function should blur an HTML element.">
<style type="text/css">
#target {
filter: blur(calc(2 * 5px));
background-color: #0f0;
width: 100px;
height: 100px;
}
</style>
</head>
<body>
<p>You should see a blurred green square.</p>
<div id="target"></div>
</body>
</html>

View File

@ -5,6 +5,8 @@ default-preferences pref(layout.css.filters.enabled,true)
== blur.html blur-ref.html
== blur.svg blur-ref.svg
== blur-calc.html blur-calc-ref.html
== blur-calc-negative.html blur-calc-negative-ref.html
== blur-zero-radius.html blur-zero-radius-ref.html
== blur-zoomed-page.html blur-zoomed-page-ref.html
== brightness.html brightness-ref.html

View File

@ -8708,7 +8708,9 @@ nsRuleNode::SetStyleFilterToCSSValue(nsStyleFilter* aStyleFilter,
int32_t mask = SETCOORD_PERCENT | SETCOORD_FACTOR;
if (type == NS_STYLE_FILTER_BLUR) {
mask = SETCOORD_LENGTH | SETCOORD_STORE_CALC;
mask = SETCOORD_LENGTH |
SETCOORD_CALC_LENGTH_ONLY |
SETCOORD_CALC_CLAMP_NONNEGATIVE;
} else if (type == NS_STYLE_FILTER_HUE_ROTATE) {
mask = SETCOORD_ANGLE;
}

View File

@ -249,7 +249,7 @@ public final class GeckoLoader {
loadMozGlue(context);
loadLibsSetup(context);
loadSQLiteLibsNative(apkName, false);
loadSQLiteLibsNative(apkName);
}
public static void loadNSSLibs(final Context context, final String apkName) {
@ -262,7 +262,7 @@ public final class GeckoLoader {
loadMozGlue(context);
loadLibsSetup(context);
loadNSSLibsNative(apkName, false);
loadNSSLibsNative(apkName);
}
/**
@ -537,6 +537,6 @@ public final class GeckoLoader {
// These methods are implemented in mozglue/android/APKOpen.cpp
public static native void nativeRun(String args);
private static native void loadGeckoLibsNative(String apkName);
private static native void loadSQLiteLibsNative(String apkName, boolean shouldExtract);
private static native void loadNSSLibsNative(String apkName, boolean shouldExtract);
private static native void loadSQLiteLibsNative(String apkName);
private static native void loadNSSLibsNative(String apkName);
}

View File

@ -15,11 +15,10 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSISHELLSERVICE
nsShellService() {};
nsShellService() {}
private:
~nsShellService() {};
~nsShellService() {}
};
#define nsShellService_CID \

View File

@ -317,11 +317,7 @@ Java_org_mozilla_gecko_mozglue_GeckoLoader_loadGeckoLibsNative(JNIEnv *jenv, jcl
}
extern "C" NS_EXPORT void JNICALL
Java_org_mozilla_gecko_mozglue_GeckoLoader_loadSQLiteLibsNative(JNIEnv *jenv, jclass jGeckoAppShellClass, jstring jApkName, jboolean jShouldExtract) {
if (jShouldExtract) {
putenv("MOZ_LINKER_EXTRACT=1");
}
Java_org_mozilla_gecko_mozglue_GeckoLoader_loadSQLiteLibsNative(JNIEnv *jenv, jclass jGeckoAppShellClass, jstring jApkName) {
const char* str;
// XXX: java doesn't give us true UTF8, we should figure out something
// better to do here
@ -339,11 +335,7 @@ Java_org_mozilla_gecko_mozglue_GeckoLoader_loadSQLiteLibsNative(JNIEnv *jenv, jc
}
extern "C" NS_EXPORT void JNICALL
Java_org_mozilla_gecko_mozglue_GeckoLoader_loadNSSLibsNative(JNIEnv *jenv, jclass jGeckoAppShellClass, jstring jApkName, jboolean jShouldExtract) {
if (jShouldExtract) {
putenv("MOZ_LINKER_EXTRACT=1");
}
Java_org_mozilla_gecko_mozglue_GeckoLoader_loadNSSLibsNative(JNIEnv *jenv, jclass jGeckoAppShellClass, jstring jApkName) {
const char* str;
// XXX: java doesn't give us true UTF8, we should figure out something
// better to do here

View File

@ -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"
%}

View File

@ -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
{
/**

View File

@ -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.
*

View File

@ -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

View File

@ -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__

View File

@ -225,9 +225,9 @@ class TicklerTimer MOZ_FINAL : public nsITimerCallback
mTickler = do_GetWeakReference(aTickler);
}
~TicklerTimer() {};
private:
~TicklerTimer() {}
nsWeakPtr mTickler;
};

View File

@ -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':

View File

@ -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, &params);
}
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;
}

View File

@ -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.
*/

View File

@ -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

View File

@ -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;
};
/**

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -17,9 +17,11 @@
#include "mozilla/ReentrantMonitor.h"
class AndroidCaptureProvider MOZ_FINAL : public nsDeviceCaptureProvider {
private:
~AndroidCaptureProvider();
public:
AndroidCaptureProvider();
~AndroidCaptureProvider();
NS_DECL_THREADSAFE_ISUPPORTS
@ -28,9 +30,11 @@ class AndroidCaptureProvider MOZ_FINAL : public nsDeviceCaptureProvider {
};
class AndroidCameraInputStream MOZ_FINAL : public nsIAsyncInputStream, mozilla::net::CameraStreamImpl::FrameCallback {
private:
~AndroidCameraInputStream();
public:
AndroidCameraInputStream();
~AndroidCameraInputStream();
NS_IMETHODIMP Init(nsACString& aContentType, nsCaptureParams* aParams);

View File

@ -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
//-----------------------------------------------------------------------------

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -16,6 +16,8 @@ public:
NS_DECL_NSINETWORKLINKSERVICE
nsAndroidNetworkLinkService();
private:
virtual ~nsAndroidNetworkLinkService();
};

View File

@ -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();
}

View File

@ -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();
}

View File

@ -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]

View File

@ -171,8 +171,12 @@ ProfileUnlockerWin::Unlock(uint32_t aSeverity)
if (error != ERROR_SUCCESS) {
return NS_ERROR_FAILURE;
}
if (numEntries == 0) {
// Nobody else is locking the file; the other process must have terminated
return NS_OK;
}
nsresult rv;
nsresult rv = NS_ERROR_FAILURE;
for (UINT i = 0; i < numEntries; ++i) {
rv = TryToTerminate(info[i].Process);
if (NS_SUCCEEDED(rv)) {
@ -188,6 +192,12 @@ ProfileUnlockerWin::Unlock(uint32_t aSeverity)
nsresult
ProfileUnlockerWin::TryToTerminate(RM_UNIQUE_PROCESS& aProcess)
{
// Subtle: If the target process terminated before this call to OpenProcess,
// this call will still succeed. This is because the restart manager session
// internally retains a handle to the target process. The rules for Windows
// PIDs state that the PID of a terminated process remains valid as long as
// at least one handle to that process remains open, so when we reach this
// point the PID is still valid and the process will open successfully.
DWORD accessRights = PROCESS_QUERY_LIMITED_INFORMATION | PROCESS_TERMINATE;
nsAutoHandle otherProcess(::OpenProcess(accessRights, FALSE,
aProcess.dwProcessId));
@ -207,7 +217,19 @@ ProfileUnlockerWin::TryToTerminate(RM_UNIQUE_PROCESS& aProcess)
WCHAR imageName[MAX_PATH];
DWORD imageNameLen = MAX_PATH;
if (!mQueryFullProcessImageName(otherProcess, 0, imageName, &imageNameLen)) {
return NS_ERROR_FAILURE;
// The error codes for this function are not very descriptive. There are
// actually two failure cases here: Either the call failed because the
// process is no longer running, or it failed for some other reason. We
// need to know which case that is.
DWORD otherProcessExitCode;
if (!::GetExitCodeProcess(otherProcess, &otherProcessExitCode) ||
otherProcessExitCode == STILL_ACTIVE) {
// The other process is still running.
return NS_ERROR_FAILURE;
}
// The other process must have terminated. We should return NS_OK so that
// this process may proceed with startup.
return NS_OK;
}
nsCOMPtr<nsIFile> otherProcessImageName;
if (NS_FAILED(NS_NewLocalFile(nsDependentString(imageName, imageNameLen),
@ -241,7 +263,11 @@ ProfileUnlockerWin::TryToTerminate(RM_UNIQUE_PROCESS& aProcess)
// We know that another process holds the lock and that it shares the same
// image name as our process. Let's kill it.
if (!::TerminateProcess(otherProcess, 1)) {
// Subtle: TerminateProcess returning ERROR_ACCESS_DENIED is actually an
// indicator that the target process managed to shut down on its own. In that
// case we should return NS_OK since we may proceed with startup.
if (!::TerminateProcess(otherProcess, 1) &&
::GetLastError() != ERROR_ACCESS_DENIED) {
return NS_ERROR_FAILURE;
}

Some files were not shown because too many files have changed in this diff Show More