зеркало из https://github.com/mozilla/gecko-dev.git
merge mozilla-inbound to mozilla-central a=merge
--HG-- rename : browser/base/content/test/general/accounts_testRemoteCommands.html => browser/base/content/test/sync/accounts_testRemoteCommands.html rename : browser/base/content/test/general/browser_fxa_web_channel.html => browser/base/content/test/sync/browser_fxa_web_channel.html rename : browser/base/content/test/general/content_aboutAccounts.js => browser/base/content/test/sync/content_aboutAccounts.js extra : amend_source : 38d33daae77f06915b30cab5327a6aa7ef0ef4ac
This commit is contained in:
Коммит
237cea8312
|
@ -7571,7 +7571,7 @@ nsDocShell::OnRedirectStateChange(nsIChannel* aOldChannel,
|
|||
secMan->GetDocShellCodebasePrincipal(newURI, this,
|
||||
getter_AddRefs(principal));
|
||||
appCacheChannel->SetChooseApplicationCache(
|
||||
NS_ShouldCheckAppCache(principal, UsePrivateBrowsing()));
|
||||
NS_ShouldCheckAppCache(principal));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11160,7 +11160,7 @@ nsDocShell::DoURILoad(nsIURI* aURI,
|
|||
secMan->GetDocShellCodebasePrincipal(aURI, this,
|
||||
getter_AddRefs(principal));
|
||||
appCacheChannel->SetChooseApplicationCache(
|
||||
NS_ShouldCheckAppCache(principal, UsePrivateBrowsing()));
|
||||
NS_ShouldCheckAppCache(principal));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3210,7 +3210,6 @@ Element::Closest(const nsAString& aSelector, ErrorResult& aResult)
|
|||
// is a pseudo-element-only selector that matches nothing.
|
||||
return nullptr;
|
||||
}
|
||||
OwnerDoc()->FlushPendingLinkUpdates();
|
||||
TreeMatchContext matchingContext(false,
|
||||
nsRuleWalker::eRelevantLinkUnvisited,
|
||||
OwnerDoc(),
|
||||
|
@ -3238,7 +3237,6 @@ Element::Matches(const nsAString& aSelector, ErrorResult& aError)
|
|||
return false;
|
||||
}
|
||||
|
||||
OwnerDoc()->FlushPendingLinkUpdates();
|
||||
TreeMatchContext matchingContext(false,
|
||||
nsRuleWalker::eRelevantLinkUnvisited,
|
||||
OwnerDoc(),
|
||||
|
|
|
@ -6769,6 +6769,34 @@ nsContentUtils::WidgetForDocument(const nsIDocument* aDoc)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
nsIWidget*
|
||||
nsContentUtils::WidgetForContent(const nsIContent* aContent)
|
||||
{
|
||||
nsIFrame* frame = aContent->GetPrimaryFrame();
|
||||
if (frame) {
|
||||
frame = nsLayoutUtils::GetDisplayRootFrame(frame);
|
||||
|
||||
nsView* view = frame->GetView();
|
||||
if (view) {
|
||||
return view->GetWidget();
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
already_AddRefed<LayerManager>
|
||||
nsContentUtils::LayerManagerForContent(const nsIContent *aContent)
|
||||
{
|
||||
nsIWidget* widget = nsContentUtils::WidgetForContent(aContent);
|
||||
if (widget) {
|
||||
RefPtr<LayerManager> manager = widget->GetLayerManager();
|
||||
return manager.forget();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static already_AddRefed<LayerManager>
|
||||
LayerManagerForDocumentInternal(const nsIDocument *aDoc, bool aRequirePersistent)
|
||||
{
|
||||
|
|
|
@ -2026,15 +2026,29 @@ public:
|
|||
* Returns the widget for this document if there is one. Looks at all ancestor
|
||||
* documents to try to find a widget, so for example this can still find a
|
||||
* widget for documents in display:none frames that have no presentation.
|
||||
*
|
||||
* You should probably use WidgetForContent() instead of this, unless you have
|
||||
* a good reason to do otherwise.
|
||||
*/
|
||||
static nsIWidget* WidgetForDocument(const nsIDocument* aDoc);
|
||||
|
||||
/**
|
||||
* Returns the appropriate widget for this element, if there is one. Unlike
|
||||
* WidgetForDocument(), this returns the correct widget for content in popups.
|
||||
*
|
||||
* You should probably use this instead of WidgetForDocument().
|
||||
*/
|
||||
static nsIWidget* WidgetForContent(const nsIContent* aContent);
|
||||
|
||||
/**
|
||||
* Returns a layer manager to use for the given document. Basically we
|
||||
* look up the document hierarchy for the first document which has
|
||||
* a presentation with an associated widget, and use that widget's
|
||||
* layer manager.
|
||||
*
|
||||
* You should probably use LayerManagerForContent() instead of this, unless
|
||||
* you have a good reason to do otherwise.
|
||||
*
|
||||
* @param aDoc the document for which to return a layer manager.
|
||||
* @param aAllowRetaining an outparam that states whether the returned
|
||||
* layer manager should be used for retained layers
|
||||
|
@ -2042,6 +2056,16 @@ public:
|
|||
static already_AddRefed<mozilla::layers::LayerManager>
|
||||
LayerManagerForDocument(const nsIDocument *aDoc);
|
||||
|
||||
/**
|
||||
* Returns a layer manager to use for the given content. Unlike
|
||||
* LayerManagerForDocument(), this returns the correct layer manager for
|
||||
* content in popups.
|
||||
*
|
||||
* You should probably use this instead of LayerManagerForDocument().
|
||||
*/
|
||||
static already_AddRefed<mozilla::layers::LayerManager>
|
||||
LayerManagerForContent(const nsIContent *aContent);
|
||||
|
||||
/**
|
||||
* Returns a layer manager to use for the given document. Basically we
|
||||
* look up the document hierarchy for the first document which has
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
#include "nsLayoutUtils.h"
|
||||
#include "nsMappedAttributes.h"
|
||||
#include "nsView.h"
|
||||
#include "nsBaseWidget.h"
|
||||
#include "GroupedSHistory.h"
|
||||
#include "PartialSHistory.h"
|
||||
|
||||
|
@ -1249,9 +1250,18 @@ nsFrameLoader::ShowRemoteFrame(const ScreenIntSize& size,
|
|||
return false;
|
||||
}
|
||||
|
||||
RefPtr<layers::LayerManager> layerManager =
|
||||
nsContentUtils::LayerManagerForDocument(mOwnerContent->GetComposedDoc());
|
||||
if (!layerManager) {
|
||||
// We never want to host remote frameloaders in simple popups, like menus.
|
||||
nsIWidget* widget = nsContentUtils::WidgetForContent(mOwnerContent);
|
||||
if (!widget || static_cast<nsBaseWidget*>(widget)->IsSmallPopup()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
RenderFrameParent* rfp = GetCurrentRenderFrame();
|
||||
if (!rfp) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!rfp->AttachLayerManager()) {
|
||||
// This is just not going to work.
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -2464,8 +2464,20 @@ public:
|
|||
// Add aLink to the set of links that need their status resolved.
|
||||
void RegisterPendingLinkUpdate(mozilla::dom::Link* aLink);
|
||||
|
||||
// Update state on links in mLinksToUpdate. This function must
|
||||
// be called prior to selector matching.
|
||||
// Update state on links in mLinksToUpdate. This function must be called
|
||||
// prior to selector matching that needs to differentiate between :link and
|
||||
// :visited. In particular, it does _not_ need to be called before doing any
|
||||
// selector matching that uses TreeMatchContext::eNeverMatchVisited. The only
|
||||
// reason we haven't moved all calls to this function entirely inside the
|
||||
// TreeMatchContext constructor is to not call it all the time during various
|
||||
// style system and frame construction operations (though it would likely be a
|
||||
// no-op for all but the first call).
|
||||
//
|
||||
// XXXbz Does this really need to be called before selector matching? All it
|
||||
// will do is ensure all the links involved are registered to observe history,
|
||||
// which won't synchronously change their state to :visited anyway! So
|
||||
// calling this won't affect selector matching done immediately afterward, as
|
||||
// far as I can tell.
|
||||
void FlushPendingLinkUpdates();
|
||||
|
||||
void FlushPendingLinkUpdatesFromRunnable();
|
||||
|
|
|
@ -2806,7 +2806,6 @@ FindMatchingElements(nsINode* aRoot, nsCSSSelectorList* aSelectorList, T &aList,
|
|||
|
||||
TreeMatchContext matchingContext(false, nsRuleWalker::eRelevantLinkUnvisited,
|
||||
doc, TreeMatchContext::eNeverMatchVisited);
|
||||
doc->FlushPendingLinkUpdates();
|
||||
AddScopeElements(matchingContext, aRoot);
|
||||
|
||||
// Fast-path selectors involving IDs. We can only do this if aRoot
|
||||
|
|
|
@ -295,7 +295,6 @@ HTMLContentElement::Match(nsIContent* aContent)
|
|||
|
||||
TreeMatchContext matchingContext(false, nsRuleWalker::eRelevantLinkUnvisited,
|
||||
doc, TreeMatchContext::eNeverMatchVisited);
|
||||
doc->FlushPendingLinkUpdates();
|
||||
matchingContext.SetHasSpecifiedScope();
|
||||
matchingContext.AddScopeElement(host->AsElement());
|
||||
|
||||
|
|
|
@ -2293,7 +2293,7 @@ TabParent::RecvGetDPI(float* aValue)
|
|||
{
|
||||
TryCacheDPIAndScale();
|
||||
|
||||
MOZ_ASSERT(mDPI > 0,
|
||||
MOZ_ASSERT(mDPI > 0 || mFrameElement,
|
||||
"Must not ask for DPI before OwnerElement is received!");
|
||||
*aValue = mDPI;
|
||||
return IPC_OK();
|
||||
|
@ -2304,7 +2304,7 @@ TabParent::RecvGetDefaultScale(double* aValue)
|
|||
{
|
||||
TryCacheDPIAndScale();
|
||||
|
||||
MOZ_ASSERT(mDefaultScale.scale > 0,
|
||||
MOZ_ASSERT(mDefaultScale.scale > 0 || mFrameElement,
|
||||
"Must not ask for scale before OwnerElement is received!");
|
||||
*aValue = mDefaultScale.scale;
|
||||
return IPC_OK();
|
||||
|
@ -2315,7 +2315,7 @@ TabParent::RecvGetWidgetRounding(int32_t* aValue)
|
|||
{
|
||||
TryCacheDPIAndScale();
|
||||
|
||||
MOZ_ASSERT(mRounding > 0,
|
||||
MOZ_ASSERT(mRounding > 0 || mFrameElement,
|
||||
"Must not ask for rounding before OwnerElement is received!");
|
||||
*aValue = mRounding;
|
||||
return IPC_OK();
|
||||
|
@ -2581,7 +2581,7 @@ TabParent::GetWidget() const
|
|||
if (!mFrameElement) {
|
||||
return nullptr;
|
||||
}
|
||||
nsCOMPtr<nsIWidget> widget = nsContentUtils::WidgetForDocument(mFrameElement->OwnerDoc());
|
||||
nsCOMPtr<nsIWidget> widget = nsContentUtils::WidgetForContent(mFrameElement);
|
||||
return widget.forget();
|
||||
}
|
||||
|
||||
|
|
|
@ -1008,9 +1008,9 @@ gfxFontconfigFontFamily::AddFontPattern(FcPattern* aFontPattern)
|
|||
NS_ASSERTION(!mHasStyles,
|
||||
"font patterns must not be added to already enumerated families");
|
||||
|
||||
FcBool scalable;
|
||||
if (FcPatternGetBool(aFontPattern, FC_SCALABLE, 0, &scalable) != FcResultMatch ||
|
||||
!scalable) {
|
||||
FcBool outline;
|
||||
if (FcPatternGetBool(aFontPattern, FC_OUTLINE, 0, &outline) != FcResultMatch ||
|
||||
!outline) {
|
||||
mHasNonScalableFaces = true;
|
||||
}
|
||||
|
||||
|
|
107
js/src/jsclist.h
107
js/src/jsclist.h
|
@ -1,107 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* vim: set ts=8 sts=4 et sw=4 tw=99:
|
||||
* 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 jsclist_h
|
||||
#define jsclist_h
|
||||
|
||||
#include "jstypes.h"
|
||||
|
||||
/*
|
||||
** Circular linked list
|
||||
*/
|
||||
typedef struct JSCListStr {
|
||||
struct JSCListStr* next;
|
||||
struct JSCListStr* prev;
|
||||
} JSCList;
|
||||
|
||||
/*
|
||||
** Insert element "_e" into the list, before "_l".
|
||||
*/
|
||||
#define JS_INSERT_BEFORE(_e,_l) \
|
||||
JS_BEGIN_MACRO \
|
||||
(_e)->next = (_l); \
|
||||
(_e)->prev = (_l)->prev; \
|
||||
(_l)->prev->next = (_e); \
|
||||
(_l)->prev = (_e); \
|
||||
JS_END_MACRO
|
||||
|
||||
/*
|
||||
** Insert element "_e" into the list, after "_l".
|
||||
*/
|
||||
#define JS_INSERT_AFTER(_e,_l) \
|
||||
JS_BEGIN_MACRO \
|
||||
(_e)->next = (_l)->next; \
|
||||
(_e)->prev = (_l); \
|
||||
(_l)->next->prev = (_e); \
|
||||
(_l)->next = (_e); \
|
||||
JS_END_MACRO
|
||||
|
||||
/*
|
||||
** Return the element following element "_e"
|
||||
*/
|
||||
#define JS_NEXT_LINK(_e) \
|
||||
((_e)->next)
|
||||
/*
|
||||
** Return the element preceding element "_e"
|
||||
*/
|
||||
#define JS_PREV_LINK(_e) \
|
||||
((_e)->prev)
|
||||
|
||||
/*
|
||||
** Append an element "_e" to the end of the list "_l"
|
||||
*/
|
||||
#define JS_APPEND_LINK(_e,_l) JS_INSERT_BEFORE(_e,_l)
|
||||
|
||||
/*
|
||||
** Insert an element "_e" at the head of the list "_l"
|
||||
*/
|
||||
#define JS_INSERT_LINK(_e,_l) JS_INSERT_AFTER(_e,_l)
|
||||
|
||||
/* Return the head/tail of the list */
|
||||
#define JS_LIST_HEAD(_l) (_l)->next
|
||||
#define JS_LIST_TAIL(_l) (_l)->prev
|
||||
|
||||
/*
|
||||
** Remove the element "_e" from it's circular list.
|
||||
*/
|
||||
#define JS_REMOVE_LINK(_e) \
|
||||
JS_BEGIN_MACRO \
|
||||
(_e)->prev->next = (_e)->next; \
|
||||
(_e)->next->prev = (_e)->prev; \
|
||||
JS_END_MACRO
|
||||
|
||||
/*
|
||||
** Remove the element "_e" from it's circular list. Also initializes the
|
||||
** linkage.
|
||||
*/
|
||||
#define JS_REMOVE_AND_INIT_LINK(_e) \
|
||||
JS_BEGIN_MACRO \
|
||||
(_e)->prev->next = (_e)->next; \
|
||||
(_e)->next->prev = (_e)->prev; \
|
||||
(_e)->next = (_e); \
|
||||
(_e)->prev = (_e); \
|
||||
JS_END_MACRO
|
||||
|
||||
/*
|
||||
** Return non-zero if the given circular list "_l" is empty, zero if the
|
||||
** circular list is not empty
|
||||
*/
|
||||
#define JS_CLIST_IS_EMPTY(_l) \
|
||||
bool((_l)->next == (_l))
|
||||
|
||||
/*
|
||||
** Initialize a circular list
|
||||
*/
|
||||
#define JS_INIT_CLIST(_l) \
|
||||
JS_BEGIN_MACRO \
|
||||
(_l)->next = (_l); \
|
||||
(_l)->prev = (_l); \
|
||||
JS_END_MACRO
|
||||
|
||||
#define JS_INIT_STATIC_CLIST(_l) \
|
||||
{(_l), (_l)}
|
||||
|
||||
#endif /* jsclist_h */
|
|
@ -81,7 +81,6 @@ EXPORTS += [
|
|||
'jsalloc.h',
|
||||
'jsapi.h',
|
||||
'jsbytecode.h',
|
||||
'jsclist.h',
|
||||
'jscpucfg.h',
|
||||
'jsfriendapi.h',
|
||||
'jsprf.h',
|
||||
|
|
|
@ -524,7 +524,6 @@ RequireGlobalObject(JSContext* cx, HandleValue dbgobj, HandleObject referent)
|
|||
BreakpointSite::BreakpointSite(Type type)
|
||||
: type_(type), enabledCount(0)
|
||||
{
|
||||
JS_INIT_CLIST(&breakpoints);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -547,21 +546,22 @@ BreakpointSite::dec(FreeOp* fop)
|
|||
bool
|
||||
BreakpointSite::isEmpty() const
|
||||
{
|
||||
return JS_CLIST_IS_EMPTY(&breakpoints);
|
||||
return breakpoints.isEmpty();
|
||||
}
|
||||
|
||||
Breakpoint*
|
||||
BreakpointSite::firstBreakpoint() const
|
||||
{
|
||||
if (JS_CLIST_IS_EMPTY(&breakpoints))
|
||||
if (isEmpty())
|
||||
return nullptr;
|
||||
return Breakpoint::fromSiteLinks(JS_NEXT_LINK(&breakpoints));
|
||||
return &(*breakpoints.begin());
|
||||
}
|
||||
|
||||
bool
|
||||
BreakpointSite::hasBreakpoint(Breakpoint* bp)
|
||||
BreakpointSite::hasBreakpoint(Breakpoint* toFind)
|
||||
{
|
||||
for (Breakpoint* p = firstBreakpoint(); p; p = p->nextInSite())
|
||||
const BreakpointList::Iterator bp(toFind);
|
||||
for (auto p = breakpoints.begin(); p; p++)
|
||||
if (p == bp)
|
||||
return true;
|
||||
return false;
|
||||
|
@ -571,20 +571,8 @@ Breakpoint::Breakpoint(Debugger* debugger, BreakpointSite* site, JSObject* handl
|
|||
: debugger(debugger), site(site), handler(handler)
|
||||
{
|
||||
MOZ_ASSERT(handler->compartment() == debugger->object->compartment());
|
||||
JS_APPEND_LINK(&debuggerLinks, &debugger->breakpoints);
|
||||
JS_APPEND_LINK(&siteLinks, &site->breakpoints);
|
||||
}
|
||||
|
||||
Breakpoint*
|
||||
Breakpoint::fromDebuggerLinks(JSCList* links)
|
||||
{
|
||||
return (Breakpoint*) ((unsigned char*) links - offsetof(Breakpoint, debuggerLinks));
|
||||
}
|
||||
|
||||
Breakpoint*
|
||||
Breakpoint::fromSiteLinks(JSCList* links)
|
||||
{
|
||||
return (Breakpoint*) ((unsigned char*) links - offsetof(Breakpoint, siteLinks));
|
||||
debugger->breakpoints.pushBack(this);
|
||||
site->breakpoints.pushBack(this);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -592,8 +580,8 @@ Breakpoint::destroy(FreeOp* fop)
|
|||
{
|
||||
if (debugger->enabled)
|
||||
site->dec(fop);
|
||||
JS_REMOVE_LINK(&debuggerLinks);
|
||||
JS_REMOVE_LINK(&siteLinks);
|
||||
debugger->breakpoints.remove(this);
|
||||
site->breakpoints.remove(this);
|
||||
site->destroyIfEmpty(fop);
|
||||
fop->delete_(this);
|
||||
}
|
||||
|
@ -601,15 +589,13 @@ Breakpoint::destroy(FreeOp* fop)
|
|||
Breakpoint*
|
||||
Breakpoint::nextInDebugger()
|
||||
{
|
||||
JSCList* link = JS_NEXT_LINK(&debuggerLinks);
|
||||
return (link == &debugger->breakpoints) ? nullptr : fromDebuggerLinks(link);
|
||||
return debuggerLink.mNext;
|
||||
}
|
||||
|
||||
Breakpoint*
|
||||
Breakpoint::nextInSite()
|
||||
{
|
||||
JSCList* link = JS_NEXT_LINK(&siteLinks);
|
||||
return (link == &site->breakpoints) ? nullptr : fromSiteLinks(link);
|
||||
return siteLink.mNext;
|
||||
}
|
||||
|
||||
JSBreakpointSite::JSBreakpointSite(JSScript* script, jsbytecode* pc)
|
||||
|
@ -684,9 +670,6 @@ Debugger::Debugger(JSContext* cx, NativeObject* dbg)
|
|||
{
|
||||
assertSameCompartment(cx, dbg);
|
||||
|
||||
JS_INIT_CLIST(&breakpoints);
|
||||
JS_INIT_CLIST(&onNewGlobalObjectWatchersLink);
|
||||
|
||||
#ifdef JS_TRACE_LOGGING
|
||||
TraceLoggerThread* logger = TraceLoggerForCurrentThread(cx);
|
||||
if (logger) {
|
||||
|
@ -705,15 +688,15 @@ Debugger::~Debugger()
|
|||
allocationsLog.clear();
|
||||
|
||||
/*
|
||||
* Since the inactive state for this link is a singleton cycle, it's always
|
||||
* safe to apply JS_REMOVE_LINK to it, regardless of whether we're in the list or not.
|
||||
*
|
||||
* We don't have to worry about locking here since Debugger is not
|
||||
* background finalized.
|
||||
*/
|
||||
JS_REMOVE_LINK(&onNewGlobalObjectWatchersLink);
|
||||
|
||||
JSContext* cx = TlsContext.get();
|
||||
if (onNewGlobalObjectWatchersLink.mPrev ||
|
||||
onNewGlobalObjectWatchersLink.mNext ||
|
||||
cx->runtime()->onNewGlobalObjectWatchers().begin() == JSRuntime::WatchersList::Iterator(this))
|
||||
cx->runtime()->onNewGlobalObjectWatchers().remove(this);
|
||||
|
||||
cx->runtime()->endSingleThreadedExecution(cx);
|
||||
}
|
||||
|
||||
|
@ -2178,7 +2161,7 @@ Debugger::fireNewGlobalObject(JSContext* cx, Handle<GlobalObject*> global, Mutab
|
|||
void
|
||||
Debugger::slowPathOnNewGlobalObject(JSContext* cx, Handle<GlobalObject*> global)
|
||||
{
|
||||
MOZ_ASSERT(!JS_CLIST_IS_EMPTY(&cx->runtime()->onNewGlobalObjectWatchers()));
|
||||
MOZ_ASSERT(!cx->runtime()->onNewGlobalObjectWatchers().isEmpty());
|
||||
if (global->compartment()->creationOptions().invisibleToDebugger())
|
||||
return;
|
||||
|
||||
|
@ -2188,13 +2171,9 @@ Debugger::slowPathOnNewGlobalObject(JSContext* cx, Handle<GlobalObject*> global)
|
|||
* can be mutated while we're walking it.
|
||||
*/
|
||||
AutoObjectVector watchers(cx);
|
||||
for (JSCList* link = JS_LIST_HEAD(&cx->runtime()->onNewGlobalObjectWatchers());
|
||||
link != &cx->runtime()->onNewGlobalObjectWatchers();
|
||||
link = JS_NEXT_LINK(link))
|
||||
{
|
||||
Debugger* dbg = fromOnNewGlobalObjectWatchersLink(link);
|
||||
MOZ_ASSERT(dbg->observesNewGlobalObject());
|
||||
JSObject* obj = dbg->object;
|
||||
for (auto& dbg : cx->runtime()->onNewGlobalObjectWatchers()) {
|
||||
MOZ_ASSERT(dbg.observesNewGlobalObject());
|
||||
JSObject* obj = dbg.object;
|
||||
JS::ExposeObjectToActiveJS(obj);
|
||||
if (!watchers.append(obj)) {
|
||||
if (cx->isExceptionPending())
|
||||
|
@ -3375,14 +3354,9 @@ Debugger::setEnabled(JSContext* cx, unsigned argc, Value* vp)
|
|||
*/
|
||||
if (dbg->getHook(OnNewGlobalObject)) {
|
||||
if (!wasEnabled) {
|
||||
/* If we were not enabled, the link should be a singleton list. */
|
||||
MOZ_ASSERT(JS_CLIST_IS_EMPTY(&dbg->onNewGlobalObjectWatchersLink));
|
||||
JS_APPEND_LINK(&dbg->onNewGlobalObjectWatchersLink,
|
||||
&cx->runtime()->onNewGlobalObjectWatchers());
|
||||
cx->runtime()->onNewGlobalObjectWatchers().pushBack(dbg);
|
||||
} else {
|
||||
/* If we were enabled, the link should be inserted in the list. */
|
||||
MOZ_ASSERT(!JS_CLIST_IS_EMPTY(&dbg->onNewGlobalObjectWatchersLink));
|
||||
JS_REMOVE_AND_INIT_LINK(&dbg->onNewGlobalObjectWatchersLink);
|
||||
cx->runtime()->onNewGlobalObjectWatchers().remove(dbg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3542,14 +3516,9 @@ Debugger::setOnNewGlobalObject(JSContext* cx, unsigned argc, Value* vp)
|
|||
if (dbg->enabled) {
|
||||
JSObject* newHook = dbg->getHook(OnNewGlobalObject);
|
||||
if (!oldHook && newHook) {
|
||||
/* If we didn't have a hook, the link should be a singleton list. */
|
||||
MOZ_ASSERT(JS_CLIST_IS_EMPTY(&dbg->onNewGlobalObjectWatchersLink));
|
||||
JS_APPEND_LINK(&dbg->onNewGlobalObjectWatchersLink,
|
||||
&cx->runtime()->onNewGlobalObjectWatchers());
|
||||
cx->runtime()->onNewGlobalObjectWatchers().pushBack(dbg);
|
||||
} else if (oldHook && !newHook) {
|
||||
/* If we did have a hook, the link should be inserted in the list. */
|
||||
MOZ_ASSERT(!JS_CLIST_IS_EMPTY(&dbg->onNewGlobalObjectWatchersLink));
|
||||
JS_REMOVE_AND_INIT_LINK(&dbg->onNewGlobalObjectWatchersLink);
|
||||
cx->runtime()->onNewGlobalObjectWatchers().remove(dbg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
#ifndef vm_Debugger_h
|
||||
#define vm_Debugger_h
|
||||
|
||||
#include "mozilla/DoublyLinkedList.h"
|
||||
#include "mozilla/GuardObjects.h"
|
||||
#include "mozilla/LinkedList.h"
|
||||
#include "mozilla/Range.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "mozilla/Vector.h"
|
||||
|
||||
#include "jsclist.h"
|
||||
#include "jscntxt.h"
|
||||
#include "jscompartment.h"
|
||||
#include "jsweakmap.h"
|
||||
|
@ -259,6 +259,7 @@ class Debugger : private mozilla::LinkedListElement<Debugger>
|
|||
{
|
||||
friend class Breakpoint;
|
||||
friend class DebuggerMemory;
|
||||
friend struct JSRuntime::GlobalObjectWatchersSiblingAccess<Debugger>;
|
||||
friend class SavedStacks;
|
||||
friend class ScriptedOnStepHandler;
|
||||
friend class ScriptedOnPopHandler;
|
||||
|
@ -386,7 +387,27 @@ class Debugger : private mozilla::LinkedListElement<Debugger>
|
|||
// Whether to enable code coverage on the Debuggee.
|
||||
bool collectCoverageInfo;
|
||||
|
||||
JSCList breakpoints; /* Circular list of all js::Breakpoints in this debugger */
|
||||
template<typename T>
|
||||
struct DebuggerSiblingAccess {
|
||||
static T* GetNext(T* elm) {
|
||||
return elm->debuggerLink.mNext;
|
||||
}
|
||||
static void SetNext(T* elm, T* next) {
|
||||
elm->debuggerLink.mNext = next;
|
||||
}
|
||||
static T* GetPrev(T* elm) {
|
||||
return elm->debuggerLink.mPrev;
|
||||
}
|
||||
static void SetPrev(T* elm, T* prev) {
|
||||
elm->debuggerLink.mPrev = prev;
|
||||
}
|
||||
};
|
||||
|
||||
// List of all js::Breakpoints in this debugger.
|
||||
using BreakpointList =
|
||||
mozilla::DoublyLinkedList<js::Breakpoint,
|
||||
DebuggerSiblingAccess<js::Breakpoint>>;
|
||||
BreakpointList breakpoints;
|
||||
|
||||
// The set of GC numbers for which one or more of this Debugger's observed
|
||||
// debuggees participated in.
|
||||
|
@ -446,11 +467,10 @@ class Debugger : private mozilla::LinkedListElement<Debugger>
|
|||
|
||||
/*
|
||||
* If this Debugger is enabled, and has a onNewGlobalObject handler, then
|
||||
* this link is inserted into the circular list headed by
|
||||
* JSRuntime::onNewGlobalObjectWatchers. Otherwise, this is set to a
|
||||
* singleton cycle.
|
||||
* this link is inserted into the list headed by
|
||||
* JSRuntime::onNewGlobalObjectWatchers.
|
||||
*/
|
||||
JSCList onNewGlobalObjectWatchersLink;
|
||||
mozilla::DoublyLinkedListElement<Debugger> onNewGlobalObjectWatchersLink;
|
||||
|
||||
/*
|
||||
* Map from stack frames that are currently on the stack to Debugger.Frame
|
||||
|
@ -790,8 +810,6 @@ class Debugger : private mozilla::LinkedListElement<Debugger>
|
|||
|
||||
inline Breakpoint* firstBreakpoint() const;
|
||||
|
||||
static inline Debugger* fromOnNewGlobalObjectWatchersLink(JSCList* link);
|
||||
|
||||
static MOZ_MUST_USE bool replaceFrameGuts(JSContext* cx, AbstractFramePtr from,
|
||||
AbstractFramePtr to,
|
||||
ScriptFrameIter& iter);
|
||||
|
@ -1563,7 +1581,27 @@ class BreakpointSite {
|
|||
private:
|
||||
Type type_;
|
||||
|
||||
JSCList breakpoints; /* cyclic list of all js::Breakpoints at this instruction */
|
||||
template<typename T>
|
||||
struct SiteSiblingAccess {
|
||||
static T* GetNext(T* elm) {
|
||||
return elm->siteLink.mNext;
|
||||
}
|
||||
static void SetNext(T* elm, T* next) {
|
||||
elm->siteLink.mNext = next;
|
||||
}
|
||||
static T* GetPrev(T* elm) {
|
||||
return elm->siteLink.mPrev;
|
||||
}
|
||||
static void SetPrev(T* elm, T* prev) {
|
||||
elm->siteLink.mPrev = prev;
|
||||
}
|
||||
};
|
||||
|
||||
// List of all js::Breakpoints at this instruction.
|
||||
using BreakpointList =
|
||||
mozilla::DoublyLinkedList<js::Breakpoint,
|
||||
SiteSiblingAccess<js::Breakpoint>>;
|
||||
BreakpointList breakpoints;
|
||||
size_t enabledCount; /* number of breakpoints in the list that are enabled */
|
||||
|
||||
protected:
|
||||
|
@ -1607,6 +1645,7 @@ class BreakpointSite {
|
|||
class Breakpoint {
|
||||
friend struct ::JSCompartment;
|
||||
friend class Debugger;
|
||||
friend class BreakpointSite;
|
||||
|
||||
public:
|
||||
Debugger * const debugger;
|
||||
|
@ -1614,12 +1653,14 @@ class Breakpoint {
|
|||
private:
|
||||
/* |handler| is marked unconditionally during minor GC. */
|
||||
js::PreBarrieredObject handler;
|
||||
JSCList debuggerLinks;
|
||||
JSCList siteLinks;
|
||||
|
||||
/**
|
||||
* Link elements for each list this breakpoint can be in.
|
||||
*/
|
||||
mozilla::DoublyLinkedListElement<Breakpoint> debuggerLink;
|
||||
mozilla::DoublyLinkedListElement<Breakpoint> siteLink;
|
||||
|
||||
public:
|
||||
static Breakpoint* fromDebuggerLinks(JSCList* links);
|
||||
static Breakpoint* fromSiteLinks(JSCList* links);
|
||||
Breakpoint(Debugger* debugger, BreakpointSite* site, JSObject* handler);
|
||||
void destroy(FreeOp* fop);
|
||||
Breakpoint* nextInDebugger();
|
||||
|
@ -1697,15 +1738,9 @@ Breakpoint::asWasm()
|
|||
Breakpoint*
|
||||
Debugger::firstBreakpoint() const
|
||||
{
|
||||
if (JS_CLIST_IS_EMPTY(&breakpoints))
|
||||
if (breakpoints.isEmpty())
|
||||
return nullptr;
|
||||
return Breakpoint::fromDebuggerLinks(JS_NEXT_LINK(&breakpoints));
|
||||
}
|
||||
|
||||
/* static */ Debugger*
|
||||
Debugger::fromOnNewGlobalObjectWatchersLink(JSCList* link) {
|
||||
char* p = reinterpret_cast<char*>(link);
|
||||
return reinterpret_cast<Debugger*>(p - offsetof(Debugger, onNewGlobalObjectWatchersLink));
|
||||
return &(*breakpoints.begin());
|
||||
}
|
||||
|
||||
const js::GCPtrNativeObject&
|
||||
|
@ -1766,7 +1801,7 @@ Debugger::onNewGlobalObject(JSContext* cx, Handle<GlobalObject*> global)
|
|||
#ifdef DEBUG
|
||||
global->compartment()->firedOnNewGlobalObject = true;
|
||||
#endif
|
||||
if (!JS_CLIST_IS_EMPTY(&cx->runtime()->onNewGlobalObjectWatchers()))
|
||||
if (!cx->runtime()->onNewGlobalObjectWatchers().isEmpty())
|
||||
Debugger::slowPathOnNewGlobalObject(cx, global);
|
||||
}
|
||||
|
||||
|
|
|
@ -177,7 +177,6 @@ JSRuntime::JSRuntime(JSRuntime* parentRuntime)
|
|||
liveRuntimesCount++;
|
||||
|
||||
/* Initialize infallibly first, so we can goto bad and JS_DestroyRuntime. */
|
||||
JS_INIT_CLIST(&onNewGlobalObjectWatchers());
|
||||
|
||||
PodZero(&asmJSCacheOps);
|
||||
lcovOutput().init();
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include "mozilla/Atomics.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/DoublyLinkedList.h"
|
||||
#include "mozilla/LinkedList.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/PodOperations.h"
|
||||
|
@ -19,7 +20,6 @@
|
|||
#include <setjmp.h>
|
||||
|
||||
#include "jsatom.h"
|
||||
#include "jsclist.h"
|
||||
#include "jsscript.h"
|
||||
|
||||
#ifdef XP_DARWIN
|
||||
|
@ -560,14 +560,34 @@ struct JSRuntime : public js::MallocProvider<JSRuntime>
|
|||
weakCaches().insertBack(cachep);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
struct GlobalObjectWatchersSiblingAccess {
|
||||
static T* GetNext(T* elm) {
|
||||
return elm->onNewGlobalObjectWatchersLink.mNext;
|
||||
}
|
||||
static void SetNext(T* elm, T* next) {
|
||||
elm->onNewGlobalObjectWatchersLink.mNext = next;
|
||||
}
|
||||
static T* GetPrev(T* elm) {
|
||||
return elm->onNewGlobalObjectWatchersLink.mPrev;
|
||||
}
|
||||
static void SetPrev(T* elm, T* prev) {
|
||||
elm->onNewGlobalObjectWatchersLink.mPrev = prev;
|
||||
}
|
||||
};
|
||||
|
||||
using WatchersList =
|
||||
mozilla::DoublyLinkedList<js::Debugger,
|
||||
GlobalObjectWatchersSiblingAccess<js::Debugger>>;
|
||||
private:
|
||||
/*
|
||||
* Head of circular list of all enabled Debuggers that have
|
||||
* onNewGlobalObject handler methods established.
|
||||
* List of all enabled Debuggers that have onNewGlobalObject handler
|
||||
* methods established.
|
||||
*/
|
||||
js::ActiveThreadData<JSCList> onNewGlobalObjectWatchers_;
|
||||
js::ActiveThreadData<WatchersList> onNewGlobalObjectWatchers_;
|
||||
|
||||
public:
|
||||
JSCList& onNewGlobalObjectWatchers() { return onNewGlobalObjectWatchers_.ref(); }
|
||||
WatchersList& onNewGlobalObjectWatchers() { return onNewGlobalObjectWatchers_.ref(); }
|
||||
|
||||
private:
|
||||
/*
|
||||
|
|
|
@ -513,8 +513,8 @@ inDOMUtils::SelectorMatchesElement(nsIDOMElement* aElement,
|
|||
sel->RemoveRightmostSelector();
|
||||
}
|
||||
|
||||
element->OwnerDoc()->FlushPendingLinkUpdates();
|
||||
// XXXbz what exactly should we do with visited state here?
|
||||
// XXXbz what exactly should we do with visited state here? If we ever start
|
||||
// caring about it, remember to do FlushPendingLinkUpdates().
|
||||
TreeMatchContext matchingContext(false,
|
||||
nsRuleWalker::eRelevantLinkUnvisited,
|
||||
element->OwnerDoc(),
|
||||
|
|
|
@ -146,6 +146,7 @@ void
|
|||
RenderFrameParent::Destroy()
|
||||
{
|
||||
mFrameLoaderDestroyed = true;
|
||||
mLayerManager = nullptr;
|
||||
}
|
||||
|
||||
already_AddRefed<Layer>
|
||||
|
@ -206,18 +207,35 @@ RenderFrameParent::BuildLayer(nsDisplayListBuilder* aBuilder,
|
|||
return layer.forget();
|
||||
}
|
||||
|
||||
LayerManager*
|
||||
RenderFrameParent::AttachLayerManager()
|
||||
{
|
||||
RefPtr<LayerManager> lm;
|
||||
|
||||
if (mFrameLoader) {
|
||||
nsIContent* content = mFrameLoader->GetOwnerContent();
|
||||
if (content) {
|
||||
lm = nsContentUtils::LayerManagerForContent(content);
|
||||
}
|
||||
}
|
||||
|
||||
// Perhaps the document containing this frame currently has no presentation?
|
||||
if (lm && lm->GetCompositorBridgeChild() && lm != mLayerManager) {
|
||||
mLayersConnected = lm->GetCompositorBridgeChild()->SendAdoptChild(mLayersId);
|
||||
FrameLayerBuilder::InvalidateAllLayers(lm);
|
||||
}
|
||||
|
||||
mLayerManager = lm.forget();
|
||||
return mLayerManager;
|
||||
}
|
||||
|
||||
void
|
||||
RenderFrameParent::OwnerContentChanged(nsIContent* aContent)
|
||||
{
|
||||
MOZ_ASSERT(!mFrameLoader || mFrameLoader->GetOwnerContent() == aContent,
|
||||
"Don't build new map if owner is same!");
|
||||
|
||||
RefPtr<LayerManager> lm = mFrameLoader ? GetFrom(mFrameLoader) : nullptr;
|
||||
// Perhaps the document containing this frame currently has no presentation?
|
||||
if (lm && lm->GetCompositorBridgeChild()) {
|
||||
mLayersConnected = lm->GetCompositorBridgeChild()->SendAdoptChild(mLayersId);
|
||||
FrameLayerBuilder::InvalidateAllLayers(lm);
|
||||
}
|
||||
Unused << AttachLayerManager();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -232,6 +250,7 @@ RenderFrameParent::ActorDestroy(ActorDestroyReason why)
|
|||
}
|
||||
|
||||
mFrameLoader = nullptr;
|
||||
mLayerManager = nullptr;
|
||||
}
|
||||
|
||||
mozilla::ipc::IPCResult
|
||||
|
|
|
@ -90,6 +90,8 @@ public:
|
|||
|
||||
void EnsureLayersConnected(CompositorOptions* aCompositorOptions);
|
||||
|
||||
LayerManager* AttachLayerManager();
|
||||
|
||||
protected:
|
||||
void ActorDestroy(ActorDestroyReason why) override;
|
||||
|
||||
|
@ -114,6 +116,7 @@ private:
|
|||
|
||||
RefPtr<nsFrameLoader> mFrameLoader;
|
||||
RefPtr<ContainerLayer> mContainer;
|
||||
RefPtr<LayerManager> mLayerManager;
|
||||
|
||||
// True after Destroy() has been called, which is triggered
|
||||
// originally by nsFrameLoader::Destroy(). After this point, we can
|
||||
|
|
|
@ -758,8 +758,6 @@ nsComputedDOMStyle::UpdateCurrentStyleSources(bool aNeedsLayoutFlush)
|
|||
return;
|
||||
}
|
||||
|
||||
document->FlushPendingLinkUpdates();
|
||||
|
||||
// Flush _before_ getting the presshell, since that could create a new
|
||||
// presshell. Also note that we want to flush the style on the document
|
||||
// we're computing style in, not on the document mContent is in -- the two
|
||||
|
|
|
@ -370,6 +370,13 @@ struct MOZ_STACK_CLASS TreeMatchContext {
|
|||
// for an HTML5 scoped style sheet.
|
||||
bool mForScopedStyle;
|
||||
|
||||
// An enum that communicates the consumer's intensions for this
|
||||
// TreeMatchContext in terms of :visited handling. eNeverMatchVisited means
|
||||
// that this TreeMatchContext's VisitedHandlingType will always be
|
||||
// eRelevantLinkUnvisited (in other words, this value will be passed to the
|
||||
// constructor and ResetForVisitedMatching() will never be called).
|
||||
// eMatchVisitedDefault doesn't communicate any information about the current
|
||||
// or future VisitedHandlingType of this TreeMatchContext.
|
||||
enum MatchVisited {
|
||||
eNeverMatchVisited,
|
||||
eMatchVisitedDefault
|
||||
|
@ -404,6 +411,9 @@ struct MOZ_STACK_CLASS TreeMatchContext {
|
|||
if (loadContext) {
|
||||
mUsingPrivateBrowsing = loadContext->UsePrivateBrowsing();
|
||||
}
|
||||
} else {
|
||||
MOZ_ASSERT(aVisitedHandling == nsRuleWalker::eRelevantLinkUnvisited,
|
||||
"You promised you'd never try to match :visited!");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
#include <algorithm>
|
||||
#include <iterator>
|
||||
|
||||
#include "mozilla/Assertions.h"
|
||||
|
||||
/**
|
||||
* Where mozilla::LinkedList strives for ease of use above all other
|
||||
* considerations, mozilla::DoublyLinkedList strives for flexibility. The
|
||||
|
|
|
@ -296,6 +296,24 @@ patched_LdrUnloadDll(HMODULE module)
|
|||
AutoSuppressStackWalking suppress;
|
||||
return stub_LdrUnloadDll(module);
|
||||
}
|
||||
|
||||
// These pointers are disguised as PVOID to avoid pulling in obscure headers
|
||||
typedef PVOID (WINAPI *LdrResolveDelayLoadedAPI_func)(PVOID ParentModuleBase,
|
||||
PVOID DelayloadDescriptor, PVOID FailureDllHook, PVOID FailureSystemHook,
|
||||
PVOID ThunkAddress, ULONG Flags);
|
||||
static LdrResolveDelayLoadedAPI_func stub_LdrResolveDelayLoadedAPI;
|
||||
|
||||
static PVOID WINAPI patched_LdrResolveDelayLoadedAPI(PVOID ParentModuleBase,
|
||||
PVOID DelayloadDescriptor, PVOID FailureDllHook, PVOID FailureSystemHook,
|
||||
PVOID ThunkAddress, ULONG Flags)
|
||||
{
|
||||
// Prevent the stack walker from suspending this thread when
|
||||
// LdrResolveDelayLoadAPI holds the RtlLookupFunctionEntry lock.
|
||||
AutoSuppressStackWalking suppress;
|
||||
return stub_LdrResolveDelayLoadedAPI(ParentModuleBase, DelayloadDescriptor,
|
||||
FailureDllHook, FailureSystemHook,
|
||||
ThunkAddress, Flags);
|
||||
}
|
||||
#endif // STACKWALK_HAS_DLL_INTERCEPTOR
|
||||
#endif // _M_AMD64
|
||||
|
||||
|
@ -388,6 +406,9 @@ EnsureWalkThreadReady()
|
|||
NtDllInterceptor.AddHook("LdrUnloadDll",
|
||||
reinterpret_cast<intptr_t>(patched_LdrUnloadDll),
|
||||
(void**)&stub_LdrUnloadDll);
|
||||
NtDllInterceptor.AddHook("LdrResolveDelayLoadedAPI",
|
||||
reinterpret_cast<intptr_t>(patched_LdrResolveDelayLoadedAPI),
|
||||
(void**)&stub_LdrResolveDelayLoadedAPI);
|
||||
#endif
|
||||
|
||||
InitializeDbgHelpCriticalSection();
|
||||
|
|
|
@ -1565,16 +1565,10 @@ NS_LoadPersistentPropertiesFromURISpec(nsIPersistentProperties **outResult,
|
|||
bool
|
||||
NS_UsePrivateBrowsing(nsIChannel *channel)
|
||||
{
|
||||
bool isPrivate = false;
|
||||
nsCOMPtr<nsIPrivateBrowsingChannel> pbChannel = do_QueryInterface(channel);
|
||||
if (pbChannel && NS_SUCCEEDED(pbChannel->GetIsChannelPrivate(&isPrivate))) {
|
||||
return isPrivate;
|
||||
}
|
||||
|
||||
// Some channels may not implement nsIPrivateBrowsingChannel
|
||||
nsCOMPtr<nsILoadContext> loadContext;
|
||||
NS_QueryNotificationCallbacks(channel, loadContext);
|
||||
return loadContext && loadContext->UsePrivateBrowsing();
|
||||
OriginAttributes attrs;
|
||||
bool result = NS_GetOriginAttributes(channel, attrs);
|
||||
NS_ENSURE_TRUE(result, result);
|
||||
return attrs.mPrivateBrowsingId > 0;
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -1587,7 +1581,19 @@ NS_GetOriginAttributes(nsIChannel *aChannel,
|
|||
}
|
||||
|
||||
loadInfo->GetOriginAttributes(&aAttributes);
|
||||
aAttributes.SyncAttributesWithPrivateBrowsing(NS_UsePrivateBrowsing(aChannel));
|
||||
|
||||
bool isPrivate = false;
|
||||
nsCOMPtr<nsIPrivateBrowsingChannel> pbChannel = do_QueryInterface(aChannel);
|
||||
if (pbChannel) {
|
||||
nsresult rv = pbChannel->GetIsChannelPrivate(&isPrivate);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
} else {
|
||||
// Some channels may not implement nsIPrivateBrowsingChannel
|
||||
nsCOMPtr<nsILoadContext> loadContext;
|
||||
NS_QueryNotificationCallbacks(aChannel, loadContext);
|
||||
isPrivate = loadContext && loadContext->UsePrivateBrowsing();
|
||||
}
|
||||
aAttributes.SyncAttributesWithPrivateBrowsing(isPrivate);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1650,9 +1656,11 @@ NS_HasBeenCrossOrigin(nsIChannel* aChannel, bool aReport)
|
|||
}
|
||||
|
||||
bool
|
||||
NS_ShouldCheckAppCache(nsIURI *aURI, bool usePrivateBrowsing)
|
||||
NS_ShouldCheckAppCache(nsIPrincipal *aPrincipal)
|
||||
{
|
||||
if (usePrivateBrowsing) {
|
||||
uint32_t privateBrowsingId = 0;
|
||||
nsresult rv = aPrincipal->GetPrivateBrowsingId(&privateBrowsingId);
|
||||
if (NS_SUCCEEDED(rv) && (privateBrowsingId > 0)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1663,29 +1671,7 @@ NS_ShouldCheckAppCache(nsIURI *aURI, bool usePrivateBrowsing)
|
|||
}
|
||||
|
||||
bool allowed;
|
||||
nsresult rv = offlineService->OfflineAppAllowedForURI(aURI,
|
||||
nullptr,
|
||||
&allowed);
|
||||
return NS_SUCCEEDED(rv) && allowed;
|
||||
}
|
||||
|
||||
bool
|
||||
NS_ShouldCheckAppCache(nsIPrincipal *aPrincipal, bool usePrivateBrowsing)
|
||||
{
|
||||
if (usePrivateBrowsing) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIOfflineCacheUpdateService> offlineService =
|
||||
do_GetService("@mozilla.org/offlinecacheupdate-service;1");
|
||||
if (!offlineService) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool allowed;
|
||||
nsresult rv = offlineService->OfflineAppAllowed(aPrincipal,
|
||||
nullptr,
|
||||
&allowed);
|
||||
rv = offlineService->OfflineAppAllowed(aPrincipal, nullptr, &allowed);
|
||||
return NS_SUCCEEDED(rv) && allowed;
|
||||
}
|
||||
|
||||
|
|
|
@ -659,11 +659,9 @@ bool NS_HasBeenCrossOrigin(nsIChannel* aChannel, bool aReport = false);
|
|||
"about.ef2a7dd5-93bc-417f-a698-142c3116864f.mozilla"
|
||||
|
||||
/**
|
||||
* Determines whether appcache should be checked for a given URI.
|
||||
* Determines whether appcache should be checked for a given principal.
|
||||
*/
|
||||
bool NS_ShouldCheckAppCache(nsIURI *aURI, bool usePrivateBrowsing);
|
||||
|
||||
bool NS_ShouldCheckAppCache(nsIPrincipal *aPrincipal, bool usePrivateBrowsing);
|
||||
bool NS_ShouldCheckAppCache(nsIPrincipal *aPrincipal);
|
||||
|
||||
/**
|
||||
* Wraps an nsIAuthPrompt so that it can be used as an nsIAuthPrompt2. This
|
||||
|
|
|
@ -27,8 +27,7 @@ namespace {
|
|||
// Ignore failures from this function, as they only affect whether we do or
|
||||
// don't show a dialog box in private browsing mode if the user sets a pref.
|
||||
void
|
||||
CreateDummyChannel(nsIURI* aHostURI, OriginAttributes& aAttrs, bool aIsPrivate,
|
||||
nsIChannel** aChannel)
|
||||
CreateDummyChannel(nsIURI* aHostURI, OriginAttributes& aAttrs, nsIChannel** aChannel)
|
||||
{
|
||||
nsCOMPtr<nsIPrincipal> principal =
|
||||
BasePrincipal::CreateCodebasePrincipal(aHostURI, aAttrs);
|
||||
|
@ -53,7 +52,7 @@ CreateDummyChannel(nsIURI* aHostURI, OriginAttributes& aAttrs, bool aIsPrivate,
|
|||
return;
|
||||
}
|
||||
|
||||
pbChannel->SetPrivate(aIsPrivate);
|
||||
pbChannel->SetPrivate(aAttrs.mPrivateBrowsingId > 0);
|
||||
dummyChannel.forget(aChannel);
|
||||
return;
|
||||
}
|
||||
|
@ -101,9 +100,7 @@ CookieServiceParent::RecvGetCookieString(const URIParams& aHost,
|
|||
if (!hostURI)
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
|
||||
bool isPrivate = aAttrs.mPrivateBrowsingId > 0;
|
||||
mCookieService->GetCookieStringInternal(hostURI, aIsForeign, false, aAttrs,
|
||||
isPrivate, *aResult);
|
||||
mCookieService->GetCookieStringInternal(hostURI, aIsForeign, false, aAttrs, *aResult);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
|
@ -123,8 +120,6 @@ CookieServiceParent::RecvSetCookieString(const URIParams& aHost,
|
|||
if (!hostURI)
|
||||
return IPC_FAIL_NO_REASON(this);
|
||||
|
||||
bool isPrivate = aAttrs.mPrivateBrowsingId > 0;
|
||||
|
||||
// This is a gross hack. We've already computed everything we need to know
|
||||
// for whether to set this cookie or not, but we need to communicate all of
|
||||
// this information through to nsICookiePermission, which indirectly
|
||||
|
@ -134,13 +129,13 @@ CookieServiceParent::RecvSetCookieString(const URIParams& aHost,
|
|||
// to use the channel to inspect it.
|
||||
nsCOMPtr<nsIChannel> dummyChannel;
|
||||
CreateDummyChannel(hostURI, const_cast<OriginAttributes&>(aAttrs),
|
||||
isPrivate, getter_AddRefs(dummyChannel));
|
||||
getter_AddRefs(dummyChannel));
|
||||
|
||||
// NB: dummyChannel could be null if something failed in CreateDummyChannel.
|
||||
nsDependentCString cookieString(aCookieString, 0);
|
||||
mCookieService->SetCookieStringInternal(hostURI, aIsForeign, cookieString,
|
||||
aServerTime, false, aAttrs,
|
||||
isPrivate, dummyChannel);
|
||||
dummyChannel);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
|
|
|
@ -2011,11 +2011,8 @@ nsCookieService::GetCookieStringCommon(nsIURI *aHostURI,
|
|||
NS_GetOriginAttributes(aChannel, attrs);
|
||||
}
|
||||
|
||||
bool isPrivate = aChannel && NS_UsePrivateBrowsing(aChannel);
|
||||
|
||||
nsAutoCString result;
|
||||
GetCookieStringInternal(aHostURI, isForeign, aHttpBound, attrs,
|
||||
isPrivate, result);
|
||||
GetCookieStringInternal(aHostURI, isForeign, aHttpBound, attrs, result);
|
||||
*aCookie = result.IsEmpty() ? nullptr : ToNewCString(result);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2084,13 +2081,10 @@ nsCookieService::SetCookieStringCommon(nsIURI *aHostURI,
|
|||
NS_GetOriginAttributes(aChannel, attrs);
|
||||
}
|
||||
|
||||
bool isPrivate = aChannel && NS_UsePrivateBrowsing(aChannel);
|
||||
|
||||
nsDependentCString cookieString(aCookieHeader);
|
||||
nsDependentCString serverTime(aServerTime ? aServerTime : "");
|
||||
SetCookieStringInternal(aHostURI, isForeign, cookieString,
|
||||
serverTime, aFromHttp, attrs,
|
||||
isPrivate, aChannel);
|
||||
serverTime, aFromHttp, attrs, aChannel);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -2101,7 +2095,6 @@ nsCookieService::SetCookieStringInternal(nsIURI *aHostURI,
|
|||
const nsCString &aServerTime,
|
||||
bool aFromHttp,
|
||||
const OriginAttributes &aOriginAttrs,
|
||||
bool aIsPrivate,
|
||||
nsIChannel *aChannel)
|
||||
{
|
||||
NS_ASSERTION(aHostURI, "null host!");
|
||||
|
@ -2112,7 +2105,7 @@ nsCookieService::SetCookieStringInternal(nsIURI *aHostURI,
|
|||
}
|
||||
|
||||
AutoRestore<DBState*> savePrevDBState(mDBState);
|
||||
mDBState = aIsPrivate ? mPrivateDBState : mDefaultDBState;
|
||||
mDBState = (aOriginAttrs.mPrivateBrowsingId > 0) ? mPrivateDBState : mDefaultDBState;
|
||||
|
||||
// get the base domain for the host URI.
|
||||
// e.g. for "www.bbc.co.uk", this would be "bbc.co.uk".
|
||||
|
@ -3208,7 +3201,6 @@ nsCookieService::GetCookieStringInternal(nsIURI *aHostURI,
|
|||
bool aIsForeign,
|
||||
bool aHttpBound,
|
||||
const OriginAttributes& aOriginAttrs,
|
||||
bool aIsPrivate,
|
||||
nsCString &aCookieString)
|
||||
{
|
||||
NS_ASSERTION(aHostURI, "null host!");
|
||||
|
@ -3219,7 +3211,7 @@ nsCookieService::GetCookieStringInternal(nsIURI *aHostURI,
|
|||
}
|
||||
|
||||
AutoRestore<DBState*> savePrevDBState(mDBState);
|
||||
mDBState = aIsPrivate ? mPrivateDBState : mDefaultDBState;
|
||||
mDBState = (aOriginAttrs.mPrivateBrowsingId > 0) ? mPrivateDBState : mDefaultDBState;
|
||||
|
||||
// get the base domain, host, and path from the URI.
|
||||
// e.g. for "www.bbc.co.uk", the base domain would be "bbc.co.uk".
|
||||
|
|
|
@ -294,9 +294,9 @@ class nsCookieService final : public nsICookieService
|
|||
nsresult GetBaseDomain(nsIURI *aHostURI, nsCString &aBaseDomain, bool &aRequireHostMatch);
|
||||
nsresult GetBaseDomainFromHost(const nsACString &aHost, nsCString &aBaseDomain);
|
||||
nsresult GetCookieStringCommon(nsIURI *aHostURI, nsIChannel *aChannel, bool aHttpBound, char** aCookie);
|
||||
void GetCookieStringInternal(nsIURI *aHostURI, bool aIsForeign, bool aHttpBound, const OriginAttributes& aOriginAttrs, bool aIsPrivate, nsCString &aCookie);
|
||||
void GetCookieStringInternal(nsIURI *aHostURI, bool aIsForeign, bool aHttpBound, const OriginAttributes& aOriginAttrs, nsCString &aCookie);
|
||||
nsresult SetCookieStringCommon(nsIURI *aHostURI, const char *aCookieHeader, const char *aServerTime, nsIChannel *aChannel, bool aFromHttp);
|
||||
void SetCookieStringInternal(nsIURI *aHostURI, bool aIsForeign, nsDependentCString &aCookieHeader, const nsCString &aServerTime, bool aFromHttp, const OriginAttributes &aOriginAttrs, bool aIsPrivate, nsIChannel* aChannel);
|
||||
void SetCookieStringInternal(nsIURI *aHostURI, bool aIsForeign, nsDependentCString &aCookieHeader, const nsCString &aServerTime, bool aFromHttp, const OriginAttributes &aOriginAttrs, nsIChannel* aChannel);
|
||||
bool SetCookieInternal(nsIURI *aHostURI, const nsCookieKey& aKey, bool aRequireHostMatch, CookieStatus aStatus, nsDependentCString &aCookieHeader, int64_t aServerTime, bool aFromHttp, nsIChannel* aChannel);
|
||||
void AddInternal(const nsCookieKey& aKey, nsCookie *aCookie, int64_t aCurrentTimeInUsec, nsIURI *aHostURI, const char *aCookieHeader, bool aFromHttp);
|
||||
void RemoveCookieFromList(const nsListIter &aIter, mozIStorageBindingParamsArray *aParamsArray = nullptr);
|
||||
|
|
|
@ -590,7 +590,7 @@ HttpChannelParent::DoAsyncOpen( const URIParams& aURI,
|
|||
bool chooseAppCache = false;
|
||||
// This works because we've already called SetNotificationCallbacks and
|
||||
// done mPBOverride logic by this point.
|
||||
chooseAppCache = NS_ShouldCheckAppCache(principal, NS_UsePrivateBrowsing(mChannel));
|
||||
chooseAppCache = NS_ShouldCheckAppCache(principal);
|
||||
|
||||
appCacheChan->SetChooseApplicationCache(chooseAppCache);
|
||||
}
|
||||
|
|
|
@ -243,6 +243,18 @@ bool TestLdrUnloadDll(void* aFunc)
|
|||
return patchedLdrUnloadDll(0) != 0;
|
||||
}
|
||||
|
||||
bool TestLdrResolveDelayLoadedAPI(void* aFunc)
|
||||
{
|
||||
// These pointers are disguised as PVOID to avoid pulling in obscure headers
|
||||
typedef PVOID (WINAPI *LdrResolveDelayLoadedAPIType)(PVOID, PVOID, PVOID,
|
||||
PVOID, PVOID, ULONG);
|
||||
auto patchedLdrResolveDelayLoadedAPI =
|
||||
reinterpret_cast<LdrResolveDelayLoadedAPIType>(aFunc);
|
||||
// No idea how to call this API. Flags==99 is just an arbitrary number that
|
||||
// doesn't crash when the other params are null.
|
||||
return patchedLdrResolveDelayLoadedAPI(0, 0, 0, 0, 0, 99) == 0;
|
||||
}
|
||||
|
||||
bool TestSetUnhandledExceptionFilter(void* aFunc)
|
||||
{
|
||||
auto patchedSetUnhandledExceptionFilter =
|
||||
|
@ -471,6 +483,7 @@ int main()
|
|||
#ifdef _M_X64
|
||||
TestHook(TestGetKeyState, "user32.dll", "GetKeyState") && // see Bug 1316415
|
||||
TestHook(TestLdrUnloadDll, "ntdll.dll", "LdrUnloadDll") &&
|
||||
TestHook(TestLdrResolveDelayLoadedAPI, "ntdll.dll", "LdrResolveDelayLoadedAPI") &&
|
||||
#endif
|
||||
MaybeTestHook(ShouldTestTipTsf(), TestProcessCaretEvents, "tiptsf.dll", "ProcessCaretEvents") &&
|
||||
#ifdef _M_IX86
|
||||
|
|
|
@ -922,7 +922,9 @@ bool
|
|||
nsBaseWidget::UseAPZ()
|
||||
{
|
||||
return (gfxPlatform::AsyncPanZoomEnabled() &&
|
||||
(WindowType() == eWindowType_toplevel || WindowType() == eWindowType_child));
|
||||
(WindowType() == eWindowType_toplevel ||
|
||||
WindowType() == eWindowType_child ||
|
||||
(WindowType() == eWindowType_popup && !IsSmallPopup())));
|
||||
}
|
||||
|
||||
void nsBaseWidget::CreateCompositor()
|
||||
|
|
Загрузка…
Ссылка в новой задаче