mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 786419 - Part 6 - Disable HTMLDNSPrefetches for offline apps r=jduell
This commit is contained in:
parent
831b1f1158
commit
1f8399dee4
@ -94,6 +94,10 @@ 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();
|
||||
}
|
||||
|
@ -539,6 +539,11 @@ child:
|
||||
*/
|
||||
UIResolutionChanged();
|
||||
|
||||
/**
|
||||
* Tell the child of an app's offline status
|
||||
*/
|
||||
AppOfflineStatus(uint32_t id, bool offline);
|
||||
|
||||
/*
|
||||
* FIXME: write protocol!
|
||||
|
||||
|
@ -80,6 +80,7 @@
|
||||
#include "UnitTransforms.h"
|
||||
#include "ClientLayerManager.h"
|
||||
#include "LayersLogging.h"
|
||||
#include "nsIOService.h"
|
||||
|
||||
#include "nsColorPickerProxy.h"
|
||||
|
||||
@ -2572,6 +2573,18 @@ 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:
|
||||
|
@ -374,6 +374,8 @@ 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,
|
||||
|
@ -240,6 +240,7 @@ TabParent::TabParent(nsIContentParent* aManager, const TabContext& aContext, uin
|
||||
, mMarkedDestroying(false)
|
||||
, mIsDestroyed(false)
|
||||
, mAppPackageFileDescriptorSent(false)
|
||||
, mSendOfflineStatus(true)
|
||||
, mChromeFlags(aChromeFlags)
|
||||
{
|
||||
MOZ_ASSERT(aManager);
|
||||
@ -499,6 +500,14 @@ 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
|
||||
|
@ -428,6 +428,10 @@ 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;
|
||||
|
Loading…
Reference in New Issue
Block a user