Backed out changeset fb224386bea8 (bug 1003848) for bustage on a CLOSED TREE

This commit is contained in:
Carsten "Tomcat" Book 2014-12-03 16:43:15 +01:00
parent 8f484a8350
commit e1cc9c8763
8 changed files with 26 additions and 83 deletions

View File

@ -52,7 +52,6 @@
#include "nsIPermissionManager.h"
#include "nsISHistory.h"
#include "nsNullPrincipal.h"
#include "nsIScriptError.h"
#include "nsLayoutUtils.h"
#include "nsView.h"
@ -1763,30 +1762,6 @@ nsFrameLoader::MaybeCreateDocShell()
NS_LITERAL_STRING("chrome://global/content/BrowserElementChild.js"),
/* allowDelayedLoad = */ true,
/* aRunInGlobalScope */ true);
// For inproc frames, set the docshell properties.
nsCOMPtr<nsIDocShellTreeItem> item = do_GetInterface(docShell);
nsAutoString name;
if (mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::name, name)) {
item->SetName(name);
}
mDocShell->SetFullscreenAllowed(
mOwnerContent->HasAttr(kNameSpaceID_None, nsGkAtoms::allowfullscreen) ||
mOwnerContent->HasAttr(kNameSpaceID_None, nsGkAtoms::mozallowfullscreen));
bool isPrivate = mOwnerContent->HasAttr(kNameSpaceID_None, nsGkAtoms::mozprivatebrowsing);
if (isPrivate) {
bool nonBlank;
mDocShell->GetHasLoadedNonBlankURI(&nonBlank);
if (nonBlank) {
nsContentUtils::ReportToConsoleNonLocalized(
NS_LITERAL_STRING("We should not switch to Private Browsing after loading a document."),
nsIScriptError::warningFlag,
NS_LITERAL_CSTRING("mozprivatebrowsing"),
nullptr);
} else {
nsCOMPtr<nsILoadContext> context = do_GetInterface(mDocShell);
context->SetUsePrivateBrowsing(true);
}
}
}
return NS_OK;

View File

@ -52,5 +52,14 @@ if (!('BrowserElementIsPreloaded' in this)) {
var BrowserElementIsReady = true;
sendAsyncMessage('browser-element-api:call', { 'msg_name': 'hello' });
let infos = sendSyncMessage('browser-element-api:call',
{ 'msg_name': 'hello' })[0];
docShell.QueryInterface(Ci.nsIDocShellTreeItem).name = infos.name;
docShell.setFullscreenAllowed(infos.fullscreenAllowed);
if (infos.isPrivate) {
if (docShell.hasLoadedNonBlankURI) {
Cu.reportError("We should not switch to Private Browsing after loading a document.");
} else {
docShell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing = true;
}
}

View File

@ -325,6 +325,14 @@ BrowserElementParent.prototype = {
this._domRequestReady = true;
this._runPendingAPICall();
}
return {
name: this._frameElement.getAttribute('name'),
fullscreenAllowed:
this._frameElement.hasAttribute('allowfullscreen') ||
this._frameElement.hasAttribute('mozallowfullscreen'),
isPrivate: this._frameElement.hasAttribute('mozprivatebrowsing')
};
},
_fireCtxMenuEvent: function(data) {

View File

@ -15,6 +15,10 @@ iframe.addEventListener('mozbrowsershowmodalprompt', function(e) {
}, 0);
}, 0);
}
else {
// Pass the message up to our parent.
alert(e.detail.message);
}
});
document.body.appendChild(iframe);

View File

@ -69,13 +69,6 @@ union MaybeNativeKeyBinding
void_t;
};
struct ShowInfo
{
nsString name;
bool fullscreenAllowed;
bool isPrivate;
};
prio(normal upto urgent) intr protocol PBrowser
{
manager PContent or PContentBridge;
@ -418,7 +411,6 @@ child:
* point.
*/
Show(nsIntSize size,
ShowInfo info,
ScrollingBehavior scrolling,
TextureFactoryIdentifier textureFactoryIdentifier,
uint64_t layersId,

View File

@ -1881,36 +1881,10 @@ TabChild::DoFakeShow(const ScrollingBehavior& aScrolling,
const uint64_t& aLayersId,
PRenderFrameChild* aRenderFrame)
{
ShowInfo info(EmptyString(), false, false);
RecvShow(nsIntSize(0, 0), info, aScrolling, aTextureFactoryIdentifier, aLayersId, aRenderFrame);
RecvShow(nsIntSize(0, 0), aScrolling, aTextureFactoryIdentifier, aLayersId, aRenderFrame);
mDidFakeShow = true;
}
void
TabChild::ApplyShowInfo(const ShowInfo& aInfo)
{
nsCOMPtr<nsIDocShell> docShell = do_GetInterface(WebNavigation());
if (docShell) {
nsCOMPtr<nsIDocShellTreeItem> item = do_GetInterface(docShell);
item->SetName(aInfo.name());
docShell->SetFullscreenAllowed(aInfo.fullscreenAllowed());
if (aInfo.isPrivate()) {
bool nonBlank;
docShell->GetHasLoadedNonBlankURI(&nonBlank);
if (nonBlank) {
nsContentUtils::ReportToConsoleNonLocalized(
NS_LITERAL_STRING("We should not switch to Private Browsing after loading a document."),
nsIScriptError::warningFlag,
NS_LITERAL_CSTRING("mozprivatebrowsing"),
nullptr);
} else {
nsCOMPtr<nsILoadContext> context = do_GetInterface(docShell);
context->SetUsePrivateBrowsing(true);
}
}
}
}
#ifdef MOZ_WIDGET_GONK
void
TabChild::MaybeRequestPreinitCamera()
@ -1971,7 +1945,6 @@ TabChild::MaybeRequestPreinitCamera()
bool
TabChild::RecvShow(const nsIntSize& aSize,
const ShowInfo& aInfo,
const ScrollingBehavior& aScrolling,
const TextureFactoryIdentifier& aTextureFactoryIdentifier,
const uint64_t& aLayersId,
@ -1980,7 +1953,6 @@ TabChild::RecvShow(const nsIntSize& aSize,
MOZ_ASSERT((!mDidFakeShow && aRenderFrame) || (mDidFakeShow && !aRenderFrame));
if (mDidFakeShow) {
ApplyShowInfo(aInfo);
return true;
}
@ -2004,9 +1976,7 @@ TabChild::RecvShow(const nsIntSize& aSize,
MaybeRequestPreinitCamera();
#endif
bool res = InitTabChildGlobal();
ApplyShowInfo(aInfo);
return res;
return InitTabChildGlobal();
}
bool

View File

@ -317,7 +317,6 @@ public:
const FileDescriptor& aFileDescriptor)
MOZ_OVERRIDE;
virtual bool RecvShow(const nsIntSize& aSize,
const ShowInfo& aInfo,
const ScrollingBehavior& aScrolling,
const TextureFactoryIdentifier& aTextureFactoryIdentifier,
const uint64_t& aLayersId,
@ -553,8 +552,6 @@ private:
const uint64_t& aLayersId,
PRenderFrameChild* aRenderFrame);
void ApplyShowInfo(const ShowInfo& aInfo);
// These methods are used for tracking synthetic mouse events
// dispatched for compatibility. On each touch event, we
// UpdateTapState(). If we've detected that the current gesture

View File

@ -600,19 +600,7 @@ TabParent::Show(const nsIntSize& size)
unused << SendPRenderFrameConstructor(renderFrame);
}
}
ShowInfo info(EmptyString(), false, false);
if (mFrameElement) {
nsAutoString name;
mFrameElement->GetAttr(kNameSpaceID_None, nsGkAtoms::name, name);
bool allowFullscreen =
mFrameElement->HasAttr(kNameSpaceID_None, nsGkAtoms::allowfullscreen) ||
mFrameElement->HasAttr(kNameSpaceID_None, nsGkAtoms::mozallowfullscreen);
bool isPrivate = mFrameElement->HasAttr(kNameSpaceID_None, nsGkAtoms::mozprivatebrowsing);
info = ShowInfo(name, allowFullscreen, isPrivate);
}
unused << SendShow(size, info, scrolling, textureFactoryIdentifier, layersId, renderFrame);
unused << SendShow(size, scrolling, textureFactoryIdentifier, layersId, renderFrame);
}
void