mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Backout 2201d650ac90 for not building on Windows on a CLOSED TREE
This commit is contained in:
parent
8878d58cc1
commit
fc2920533d
@ -426,7 +426,7 @@ public:
|
||||
*
|
||||
* @return The document or null if no JS Context.
|
||||
*/
|
||||
static nsIDocument* GetDocumentFromCaller();
|
||||
static nsIDOMDocument *GetDocumentFromCaller();
|
||||
|
||||
/**
|
||||
* Get the document through the JS context that's currently on the stack.
|
||||
@ -435,7 +435,7 @@ public:
|
||||
*
|
||||
* @return The document or null if no JS context
|
||||
*/
|
||||
static nsIDocument* GetDocumentFromContext();
|
||||
static nsIDOMDocument *GetDocumentFromContext();
|
||||
|
||||
// Check if a node is in the document prolog, i.e. before the document
|
||||
// element.
|
||||
|
@ -1710,7 +1710,7 @@ nsContentUtils::GetWindowFromCaller()
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsIDocument*
|
||||
nsIDOMDocument *
|
||||
nsContentUtils::GetDocumentFromCaller()
|
||||
{
|
||||
JSContext *cx = nullptr;
|
||||
@ -1726,10 +1726,10 @@ nsContentUtils::GetDocumentFromCaller()
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return win->GetExtantDoc();
|
||||
return win->GetExtantDocument();
|
||||
}
|
||||
|
||||
nsIDocument*
|
||||
nsIDOMDocument *
|
||||
nsContentUtils::GetDocumentFromContext()
|
||||
{
|
||||
JSContext *cx = nullptr;
|
||||
@ -1741,7 +1741,7 @@ nsContentUtils::GetDocumentFromContext()
|
||||
if (sgo) {
|
||||
nsCOMPtr<nsPIDOMWindow> pwin = do_QueryInterface(sgo);
|
||||
if (pwin) {
|
||||
return pwin->GetExtantDoc();
|
||||
return pwin->GetExtantDocument();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -260,7 +260,8 @@ nsDOMFileBase::MozSlice(int64_t aStart, int64_t aEnd,
|
||||
if (sgo) {
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(sgo);
|
||||
if (window) {
|
||||
nsCOMPtr<nsIDocument> document = window->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> document =
|
||||
do_QueryInterface(window->GetExtantDocument());
|
||||
if (document) {
|
||||
document->WarnOnceAbout(nsIDocument::eMozSlice);
|
||||
}
|
||||
@ -275,7 +276,7 @@ nsDOMFileBase::GetInternalStream(nsIInputStream **aStream)
|
||||
{
|
||||
// Must be overridden
|
||||
NS_NOTREACHED("Must override GetInternalStream");
|
||||
|
||||
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
@ -408,7 +408,7 @@ protected:
|
||||
bool Suppressed()
|
||||
{
|
||||
if (mOwner) {
|
||||
nsCOMPtr<nsIDocument> d = mOwner->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> d = do_QueryInterface(mOwner->GetExtantDocument());
|
||||
return d && d->IsInSyncOperation();
|
||||
}
|
||||
return false;
|
||||
|
@ -11295,7 +11295,7 @@ nsAutoSyncOperation::nsAutoSyncOperation(nsIDocument* aDoc)
|
||||
win->GetTop(getter_AddRefs(topWindow));
|
||||
nsCOMPtr<nsPIDOMWindow> top = do_QueryInterface(topWindow);
|
||||
if (top) {
|
||||
nsCOMPtr<nsIDocument> doc = top->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(top->GetExtantDocument());
|
||||
MarkDocumentTreeToBeInSyncOperation(doc, &mDocuments);
|
||||
}
|
||||
}
|
||||
|
@ -1095,8 +1095,10 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
|
||||
SameCOMIdentity(otherChromeEventHandler, otherContent),
|
||||
"How did that happen, exactly?");
|
||||
|
||||
nsCOMPtr<nsIDocument> ourChildDocument = ourWindow->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> otherChildDocument = otherWindow ->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> ourChildDocument =
|
||||
do_QueryInterface(ourWindow->GetExtantDocument());
|
||||
nsCOMPtr<nsIDocument> otherChildDocument =
|
||||
do_QueryInterface(otherWindow->GetExtantDocument());
|
||||
if (!ourChildDocument || !otherChildDocument) {
|
||||
// This shouldn't be happening
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
@ -390,7 +390,7 @@ nsXMLHttpRequest::InitParameters(bool aAnon, bool aSystem)
|
||||
// Chrome is always allowed access, so do the permission check only
|
||||
// for non-chrome pages.
|
||||
if (!nsContentUtils::IsCallerChrome()) {
|
||||
nsCOMPtr<nsIDocument> doc = window->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(window->GetExtantDocument());
|
||||
if (!doc) {
|
||||
return;
|
||||
}
|
||||
@ -560,7 +560,7 @@ static void LogMessage(const char* aWarning, nsPIDOMWindow* aWindow)
|
||||
{
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
if (aWindow) {
|
||||
doc = aWindow->GetExtantDoc();
|
||||
doc = do_QueryInterface(aWindow->GetExtantDocument());
|
||||
}
|
||||
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
|
||||
"DOM", doc,
|
||||
@ -2861,7 +2861,7 @@ nsXMLHttpRequest::Send(nsIVariant* aVariant, const Nullable<RequestBody>& aBody)
|
||||
nsCOMPtr<nsPIDOMWindow> suspendedWindow(do_QueryInterface(topWindow));
|
||||
if (suspendedWindow &&
|
||||
(suspendedWindow = suspendedWindow->GetCurrentInnerWindow())) {
|
||||
suspendedDoc = suspendedWindow->GetExtantDoc();
|
||||
suspendedDoc = do_QueryInterface(suspendedWindow->GetExtantDocument());
|
||||
if (suspendedDoc) {
|
||||
suspendedDoc->SuppressEventHandling();
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ nsDOMEvent::Initialize(nsISupports* aOwner, JSContext* aCx, JSObject* aObj,
|
||||
bool trusted = false;
|
||||
nsCOMPtr<nsPIDOMWindow> w = do_QueryInterface(aOwner);
|
||||
if (w) {
|
||||
nsCOMPtr<nsIDocument> d = w->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> d = do_QueryInterface(w->GetExtantDocument());
|
||||
if (d) {
|
||||
trusted = nsContentUtils::IsChromeDoc(d);
|
||||
nsIPresShell* s = d->GetShell();
|
||||
@ -369,7 +369,7 @@ nsDOMEvent::Init(mozilla::dom::EventTarget* aGlobal)
|
||||
bool trusted = false;
|
||||
nsCOMPtr<nsPIDOMWindow> w = do_QueryInterface(aGlobal);
|
||||
if (w) {
|
||||
nsCOMPtr<nsIDocument> d = w->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> d = do_QueryInterface(w->GetExtantDocument());
|
||||
if (d) {
|
||||
trusted = nsContentUtils::IsChromeDoc(d);
|
||||
nsIPresShell* s = d->GetShell();
|
||||
@ -521,7 +521,7 @@ nsDOMEvent::PreventDefault()
|
||||
if (!node) {
|
||||
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(mEvent->currentTarget);
|
||||
if (win) {
|
||||
node = win->GetExtantDoc();
|
||||
node = do_QueryInterface(win->GetExtantDocument());
|
||||
}
|
||||
}
|
||||
if (node && !nsContentUtils::IsChromeDoc(node->OwnerDoc())) {
|
||||
|
@ -26,8 +26,8 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsDOMEventTargetHelper)
|
||||
if (MOZ_UNLIKELY(cb.WantDebugInfo())) {
|
||||
char name[512];
|
||||
nsAutoString uri;
|
||||
if (tmp->mOwnerWindow && tmp->mOwnerWindow->GetExtantDoc()) {
|
||||
tmp->mOwnerWindow->GetExtantDoc()->GetDocumentURI(uri);
|
||||
if (tmp->mOwnerWindow && tmp->mOwnerWindow->GetExtantDocument()) {
|
||||
tmp->mOwnerWindow->GetExtantDocument()->GetDocumentURI(uri);
|
||||
}
|
||||
PR_snprintf(name, sizeof(name), "nsDOMEventTargetHelper %s",
|
||||
NS_ConvertUTF16toUTF8(uri).get());
|
||||
|
@ -463,7 +463,7 @@ nsEventDispatcher::Dispatch(nsISupports* aTarget,
|
||||
if (!node) {
|
||||
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(aTarget);
|
||||
if (win) {
|
||||
node = win->GetExtantDoc();
|
||||
node = do_QueryInterface(win->GetExtantDocument());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -282,7 +282,7 @@ nsEventListenerManager::AddEventListenerInternal(
|
||||
// Go from our target to the nearest enclosing DOM window.
|
||||
nsPIDOMWindow* window = GetInnerWindowForTarget();
|
||||
if (window) {
|
||||
nsCOMPtr<nsIDocument> doc = window->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(window->GetExtantDocument());
|
||||
if (doc) {
|
||||
doc->WarnOnceAbout(nsIDocument::eMutationEvent);
|
||||
}
|
||||
@ -336,7 +336,7 @@ nsEventListenerManager::AddEventListenerInternal(
|
||||
nsPIDOMWindow* window = GetInnerWindowForTarget();
|
||||
if (window) {
|
||||
#ifdef DEBUG
|
||||
nsCOMPtr<nsIDocument> d = window->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> d = do_QueryInterface(window->GetExtantDocument());
|
||||
NS_WARN_IF_FALSE(!nsContentUtils::IsChromeDoc(d),
|
||||
"Please do not use mouseenter/leave events in chrome. "
|
||||
"They are slower than mouseover/out!");
|
||||
@ -828,7 +828,7 @@ nsEventListenerManager::CompileEventHandlerInternal(nsListenerStruct *aListenerS
|
||||
} else {
|
||||
win = do_QueryInterface(mTarget);
|
||||
if (win) {
|
||||
doc = win->GetExtantDoc();
|
||||
doc = do_QueryInterface(win->GetExtantDocument());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -265,7 +265,13 @@ static nsIDocument *
|
||||
GetDocumentFromWindow(nsIDOMWindow *aWindow)
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(aWindow);
|
||||
return win ? win->GetExtantDoc() : nullptr;
|
||||
nsCOMPtr<nsIDocument> doc;
|
||||
|
||||
if (win) {
|
||||
doc = do_QueryInterface(win->GetExtantDocument());
|
||||
}
|
||||
|
||||
return doc;
|
||||
}
|
||||
|
||||
static int32_t
|
||||
@ -3251,7 +3257,7 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
||||
currentWindow->GetTop(getter_AddRefs(currentTop));
|
||||
mDocument->GetWindow()->GetTop(getter_AddRefs(newTop));
|
||||
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(currentWindow);
|
||||
nsCOMPtr<nsIDocument> currentDoc = win->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> currentDoc = do_QueryInterface(win->GetExtantDocument());
|
||||
if (nsContentUtils::IsChromeDoc(currentDoc) ||
|
||||
(currentTop && newTop && currentTop != newTop)) {
|
||||
fm->SetFocusedWindow(mDocument->GetWindow());
|
||||
|
@ -53,7 +53,8 @@ NS_NewHTMLImageElement(already_AddRefed<nsINodeInfo> aNodeInfo,
|
||||
*/
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo(aNodeInfo);
|
||||
if (!nodeInfo) {
|
||||
nsCOMPtr<nsIDocument> doc = nsContentUtils::GetDocumentFromCaller();
|
||||
nsCOMPtr<nsIDocument> doc =
|
||||
do_QueryInterface(nsContentUtils::GetDocumentFromCaller());
|
||||
NS_ENSURE_TRUE(doc, nullptr);
|
||||
|
||||
nodeInfo = doc->NodeInfoManager()->GetNodeInfo(nsGkAtoms::img, nullptr,
|
||||
|
@ -397,7 +397,8 @@ HTMLInputElement::AsyncClickHandler::Run()
|
||||
uint32_t permission;
|
||||
pm->TestPermission(doc->NodePrincipal(), &permission);
|
||||
if (permission == nsIPopupWindowManager::DENY_POPUP) {
|
||||
nsGlobalWindow::FirePopupBlockedEvent(doc, win, nullptr, EmptyString(), EmptyString());
|
||||
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(doc);
|
||||
nsGlobalWindow::FirePopupBlockedEvent(domDoc, win, nullptr, EmptyString(), EmptyString());
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,8 @@ NS_NewHTMLOptionElement(already_AddRefed<nsINodeInfo> aNodeInfo,
|
||||
*/
|
||||
nsCOMPtr<nsINodeInfo> nodeInfo(aNodeInfo);
|
||||
if (!nodeInfo) {
|
||||
nsCOMPtr<nsIDocument> doc = nsContentUtils::GetDocumentFromCaller();
|
||||
nsCOMPtr<nsIDocument> doc =
|
||||
do_QueryInterface(nsContentUtils::GetDocumentFromCaller());
|
||||
NS_ENSURE_TRUE(doc, nullptr);
|
||||
|
||||
nodeInfo = doc->NodeInfoManager()->GetNodeInfo(nsGkAtoms::option, nullptr,
|
||||
|
@ -1504,7 +1504,8 @@ nsHTMLDocument::Open(JSContext* cx,
|
||||
// Note: We want to use GetDocumentFromContext here because this document
|
||||
// should inherit the security information of the document that's opening us,
|
||||
// (since if it's secure, then it's presumably trusted).
|
||||
nsCOMPtr<nsIDocument> callerDoc = nsContentUtils::GetDocumentFromContext();
|
||||
nsCOMPtr<nsIDocument> callerDoc =
|
||||
do_QueryInterface(nsContentUtils::GetDocumentFromContext());
|
||||
if (!callerDoc) {
|
||||
// If we're called from C++ or in some other way without an originating
|
||||
// document we can't do a document.open w/o changing the principal of the
|
||||
|
@ -320,7 +320,8 @@ XMLDocument::Load(const nsAString& aUrl, ErrorResult& aRv)
|
||||
|
||||
ReportUseOfDeprecatedMethod(this, "UseOfDOM3LoadMethodWarning");
|
||||
|
||||
nsCOMPtr<nsIDocument> callingDoc = nsContentUtils::GetDocumentFromContext();
|
||||
nsCOMPtr<nsIDocument> callingDoc =
|
||||
do_QueryInterface(nsContentUtils::GetDocumentFromContext());
|
||||
|
||||
nsIURI *baseURI = mDocumentURI;
|
||||
nsAutoCString charset;
|
||||
|
@ -1074,7 +1074,8 @@ nsXULTemplateBuilder::Observe(nsISupports* aSubject,
|
||||
if (!strcmp(aTopic, DOM_WINDOW_DESTROYED_TOPIC)) {
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aSubject);
|
||||
if (window) {
|
||||
nsCOMPtr<nsIDocument> doc = window->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> doc =
|
||||
do_QueryInterface(window->GetExtantDocument());
|
||||
if (doc && doc == mObservedDocument)
|
||||
NodeWillBeDestroyed(doc);
|
||||
}
|
||||
|
@ -7048,7 +7048,10 @@ nsDocShell::CanSavePresentation(uint32_t aLoadType,
|
||||
|
||||
// If the document does not want its presentation cached, then don't.
|
||||
nsCOMPtr<nsIDocument> doc = mScriptGlobal->GetExtantDoc();
|
||||
return doc && doc->CanSavePresentation(aNewRequest);
|
||||
if (!doc || !doc->CanSavePresentation(aNewRequest))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
@ -8674,7 +8677,8 @@ nsDocShell::InternalLoad(nsIURI * aURI,
|
||||
// document in |newWin|, if any.
|
||||
nsCOMPtr<nsPIDOMWindow> piNewWin = do_QueryInterface(newWin);
|
||||
if (piNewWin) {
|
||||
nsCOMPtr<nsIDocument> newDoc = piNewWin->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> newDoc =
|
||||
do_QueryInterface(piNewWin->GetExtantDocument());
|
||||
if (!newDoc || newDoc->IsInitialDocument()) {
|
||||
isNewWindow = true;
|
||||
aFlags |= INTERNAL_LOAD_FLAGS_FIRST_LOAD;
|
||||
|
@ -481,7 +481,7 @@ Navigator::GetCookieEnabled(bool* aCookieEnabled)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = win->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(win->GetExtantDocument());
|
||||
if (!doc) {
|
||||
return NS_OK;
|
||||
}
|
||||
@ -626,16 +626,17 @@ namespace {
|
||||
class VibrateWindowListener : public nsIDOMEventListener
|
||||
{
|
||||
public:
|
||||
VibrateWindowListener(nsIDOMWindow* aWindow, nsIDocument* aDocument)
|
||||
VibrateWindowListener(nsIDOMWindow *aWindow, nsIDOMDocument *aDocument)
|
||||
{
|
||||
mWindow = do_GetWeakReference(aWindow);
|
||||
mDocument = do_GetWeakReference(aDocument);
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(aDocument);
|
||||
NS_NAMED_LITERAL_STRING(visibilitychange, "visibilitychange");
|
||||
aDocument->AddSystemEventListener(visibilitychange,
|
||||
this, /* listener */
|
||||
true, /* use capture */
|
||||
false /* wants untrusted */);
|
||||
target->AddSystemEventListener(visibilitychange,
|
||||
this, /* listener */
|
||||
true, /* use capture */
|
||||
false /* wants untrusted */);
|
||||
}
|
||||
|
||||
virtual ~VibrateWindowListener()
|
||||
@ -753,9 +754,12 @@ Navigator::Vibrate(const JS::Value& aPattern, JSContext* cx)
|
||||
nsCOMPtr<nsPIDOMWindow> win = do_QueryReferent(mWindow);
|
||||
NS_ENSURE_TRUE(win, NS_OK);
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = win->GetExtantDoc();
|
||||
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
|
||||
if (doc->Hidden()) {
|
||||
nsCOMPtr<nsIDOMDocument> domDoc = win->GetExtantDocument();
|
||||
NS_ENSURE_TRUE(domDoc, NS_ERROR_FAILURE);
|
||||
|
||||
bool hidden = true;
|
||||
domDoc->GetHidden(&hidden);
|
||||
if (hidden) {
|
||||
// Hidden documents cannot start or stop a vibration.
|
||||
return NS_OK;
|
||||
}
|
||||
@ -815,7 +819,7 @@ Navigator::Vibrate(const JS::Value& aPattern, JSContext* cx)
|
||||
else {
|
||||
gVibrateWindowListener->RemoveListener();
|
||||
}
|
||||
gVibrateWindowListener = new VibrateWindowListener(win, doc);
|
||||
gVibrateWindowListener = new VibrateWindowListener(win, domDoc);
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> domWindow =
|
||||
do_QueryInterface(static_cast<nsIDOMWindow*>(win));
|
||||
|
@ -3284,7 +3284,7 @@ nsWindowSH::GlobalScopePolluterNewResolve(JSContext *cx, JSHandleObject obj,
|
||||
// The rest of this function is for HTML documents only.
|
||||
//
|
||||
nsCOMPtr<nsIHTMLDocument> htmlDoc =
|
||||
do_QueryInterface(win->GetExtantDoc());
|
||||
do_QueryInterface(win->GetExtantDocument());
|
||||
if (!htmlDoc)
|
||||
return true;
|
||||
nsHTMLDocument *document = static_cast<nsHTMLDocument*>(htmlDoc.get());
|
||||
@ -6216,7 +6216,7 @@ nsDocumentSH::PostCreate(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIDocument* currentDoc = win->GetExtantDoc();
|
||||
nsIDOMDocument* currentDoc = win->GetExtantDocument();
|
||||
|
||||
if (SameCOMIdentity(doc, currentDoc)) {
|
||||
jsval winVal;
|
||||
|
@ -183,7 +183,8 @@ nsDOMException::GetCode(uint16_t* aCode)
|
||||
// Warn only when the code was changed (other than DOM Core)
|
||||
// or the code is useless (zero)
|
||||
if (NS_ERROR_GET_MODULE(mResult) != NS_ERROR_MODULE_DOM || !mCode) {
|
||||
nsCOMPtr<nsIDocument> doc = nsContentUtils::GetDocumentFromCaller();
|
||||
nsCOMPtr<nsIDocument> doc =
|
||||
do_QueryInterface(nsContentUtils::GetDocumentFromCaller());
|
||||
if (doc) {
|
||||
doc->WarnOnceAbout(nsIDocument::eDOMExceptionCode);
|
||||
}
|
||||
|
@ -188,14 +188,14 @@ nsDOMWindowUtils::GetDocumentMetadata(const nsAString& aName,
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
|
||||
if (window) {
|
||||
nsCOMPtr<nsIDocument> doc = window->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(window->GetExtantDocument()));
|
||||
if (doc) {
|
||||
nsCOMPtr<nsIAtom> name = do_GetAtom(aName);
|
||||
doc->GetHeaderData(name, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
aValue.Truncate();
|
||||
return NS_OK;
|
||||
}
|
||||
@ -266,7 +266,7 @@ nsDOMWindowUtils::GetViewportInfo(uint32_t aDisplayWidth,
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
|
||||
NS_ENSURE_STATE(window);
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = window->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(window->GetExtantDocument()));
|
||||
NS_ENSURE_STATE(doc);
|
||||
|
||||
nsViewportInfo info = nsContentUtils::GetViewportInfo(doc, aDisplayWidth, aDisplayHeight);
|
||||
@ -1247,7 +1247,7 @@ nsDOMWindowUtils::ElementFromPoint(float aX, float aY,
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
|
||||
NS_ENSURE_STATE(window);
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = window->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(window->GetExtantDocument()));
|
||||
NS_ENSURE_STATE(doc);
|
||||
|
||||
Element* el =
|
||||
@ -1272,7 +1272,7 @@ nsDOMWindowUtils::NodesFromRect(float aX, float aY,
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
|
||||
NS_ENSURE_STATE(window);
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = window->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(window->GetExtantDocument()));
|
||||
NS_ENSURE_STATE(doc);
|
||||
|
||||
return doc->NodesFromRectHelper(aX, aY, aTopSize, aRightSize, aBottomSize, aLeftSize,
|
||||
@ -1424,7 +1424,7 @@ nsDOMWindowUtils::SuppressEventHandling(bool aSuppress)
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
|
||||
NS_ENSURE_STATE(window);
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = window->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(window->GetExtantDocument()));
|
||||
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
|
||||
|
||||
if (aSuppress) {
|
||||
@ -1446,7 +1446,7 @@ nsDOMWindowUtils::GetScrollXY(bool aFlushLayout, int32_t* aScrollX, int32_t* aSc
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
|
||||
NS_ENSURE_STATE(window);
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = window->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(window->GetExtantDocument()));
|
||||
NS_ENSURE_STATE(doc);
|
||||
|
||||
if (aFlushLayout) {
|
||||
@ -2460,15 +2460,15 @@ nsDOMWindowUtils::GetCursorType(int16_t *aCursor)
|
||||
NS_ENSURE_ARG_POINTER(aCursor);
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
|
||||
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
|
||||
|
||||
bool isSameDoc = false;
|
||||
nsCOMPtr<nsIDocument> doc = window->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(window->GetExtantDocument()));
|
||||
|
||||
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
|
||||
|
||||
do {
|
||||
if (nsEventStateManager::sMouseOverDocument == doc) {
|
||||
if (nsEventStateManager::sMouseOverDocument == doc.get()) {
|
||||
isSameDoc = true;
|
||||
break;
|
||||
}
|
||||
@ -2937,13 +2937,17 @@ nsDOMWindowUtils::GetPlugins(JSContext* cx, JS::Value* aPlugins)
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
|
||||
NS_ENSURE_STATE(window);
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = window->GetExtantDoc();
|
||||
nsIDOMDocument* ddoc = window->GetExtantDocument();
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(ddoc, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsTArray<nsIObjectLoadingContent*> plugins;
|
||||
doc->GetPlugins(plugins);
|
||||
|
||||
JSObject* jsPlugins = nullptr;
|
||||
nsresult rv = nsTArrayToJSArray(cx, plugins, &jsPlugins);
|
||||
rv = nsTArrayToJSArray(cx, plugins, &jsPlugins);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
*aPlugins = OBJECT_TO_JSVAL(jsPlugins);
|
||||
@ -3010,7 +3014,7 @@ nsDOMWindowUtils::RemoteFrameFullscreenChanged(nsIDOMElement* aFrameElement,
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
|
||||
NS_ENSURE_STATE(window);
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = window->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(window->GetExtantDocument()));
|
||||
NS_ENSURE_STATE(doc);
|
||||
|
||||
doc->RemoteFrameFullscreenChanged(aFrameElement, aNewOrigin);
|
||||
@ -3027,7 +3031,7 @@ nsDOMWindowUtils::RemoteFrameFullscreenReverted()
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
|
||||
NS_ENSURE_STATE(window);
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = window->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(window->GetExtantDocument()));
|
||||
NS_ENSURE_STATE(doc);
|
||||
|
||||
doc->RemoteFrameFullscreenReverted();
|
||||
|
@ -2143,7 +2143,7 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
|
||||
}
|
||||
|
||||
NS_ASSERTION(!GetCurrentInnerWindow() ||
|
||||
GetCurrentInnerWindow()->GetExtantDoc() == mDoc,
|
||||
GetCurrentInnerWindow()->GetExtantDocument() == mDocument,
|
||||
"Uh, mDocument doesn't match the current inner window "
|
||||
"document!");
|
||||
|
||||
@ -6137,7 +6137,7 @@ nsGlobalWindow::SetResizable(bool aResizable)
|
||||
static void
|
||||
ReportUseOfDeprecatedMethod(nsGlobalWindow* aWindow, const char* aWarning)
|
||||
{
|
||||
nsCOMPtr<nsIDocument> doc = aWindow->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(aWindow->GetExtantDocument());
|
||||
nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
|
||||
"DOM Events", doc,
|
||||
nsContentUtils::eDOM_PROPERTIES,
|
||||
@ -6200,7 +6200,7 @@ bool IsPopupBlocked(nsIDOMDocument* aDoc)
|
||||
|
||||
/* static */
|
||||
void
|
||||
nsGlobalWindow::FirePopupBlockedEvent(nsIDocument* aDoc,
|
||||
nsGlobalWindow::FirePopupBlockedEvent(nsIDOMDocument* aDoc,
|
||||
nsIDOMWindow *aRequestingWindow, nsIURI *aPopupURI,
|
||||
const nsAString &aPopupWindowName,
|
||||
const nsAString &aPopupWindowFeatures)
|
||||
@ -6208,9 +6208,9 @@ nsGlobalWindow::FirePopupBlockedEvent(nsIDocument* aDoc,
|
||||
if (aDoc) {
|
||||
// Fire a "DOMPopupBlocked" event so that the UI can hear about
|
||||
// blocked popups.
|
||||
ErrorResult rv;
|
||||
nsCOMPtr<nsIDOMEvent> event =
|
||||
aDoc->CreateEvent(NS_LITERAL_STRING("PopupBlockedEvents"), rv);
|
||||
nsCOMPtr<nsIDOMEvent> event;
|
||||
aDoc->CreateEvent(NS_LITERAL_STRING("PopupBlockedEvents"),
|
||||
getter_AddRefs(event));
|
||||
if (event) {
|
||||
nsCOMPtr<nsIDOMPopupBlockedEvent> pbev(do_QueryInterface(event));
|
||||
pbev->InitPopupBlockedEvent(NS_LITERAL_STRING("DOMPopupBlocked"),
|
||||
@ -6219,8 +6219,9 @@ nsGlobalWindow::FirePopupBlockedEvent(nsIDocument* aDoc,
|
||||
aPopupWindowFeatures);
|
||||
event->SetTrusted(true);
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> targ(do_QueryInterface(aDoc));
|
||||
bool defaultActionEnabled;
|
||||
aDoc->DispatchEvent(event, &defaultActionEnabled);
|
||||
targ->DispatchEvent(event, &defaultActionEnabled);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6361,11 +6362,9 @@ nsGlobalWindow::FireAbuseEvents(bool aBlocked, bool aWindow,
|
||||
getter_AddRefs(popupURI));
|
||||
|
||||
// fire an event chock full of informative URIs
|
||||
if (aBlocked) {
|
||||
nsCOMPtr<nsIDocument> topDocument = do_QueryInterface(topDoc);
|
||||
FirePopupBlockedEvent(topDocument, this, popupURI, aPopupWindowName,
|
||||
if (aBlocked)
|
||||
FirePopupBlockedEvent(topDoc, this, popupURI, aPopupWindowName,
|
||||
aPopupWindowFeatures);
|
||||
}
|
||||
if (aWindow)
|
||||
FirePopupWindowEvent(topDoc);
|
||||
}
|
||||
@ -6892,7 +6891,7 @@ nsGlobalWindow::PostMessageMoz(const JS::Value& aMessage,
|
||||
}
|
||||
else if (callerInnerWin) {
|
||||
// otherwise use the URI of the document to generate origin
|
||||
nsCOMPtr<nsIDocument> doc = callerInnerWin->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(callerInnerWin->GetExtantDocument());
|
||||
if (!doc)
|
||||
return NS_OK;
|
||||
callerOuterURI = doc->GetDocumentURI();
|
||||
@ -7212,7 +7211,7 @@ nsGlobalWindow::EnterModalState()
|
||||
if (topWin->mModalStateDepth == 0) {
|
||||
NS_ASSERTION(!mSuspendedDoc, "Shouldn't have mSuspendedDoc here!");
|
||||
|
||||
mSuspendedDoc = topWin->GetExtantDoc();
|
||||
mSuspendedDoc = do_QueryInterface(topWin->GetExtantDocument());
|
||||
if (mSuspendedDoc && mSuspendedDoc->EventHandlingSuppressed()) {
|
||||
mSuspendedDoc->SuppressEventHandling();
|
||||
} else {
|
||||
@ -7325,7 +7324,8 @@ nsGlobalWindow::LeaveModalState(nsIDOMWindow *aCallerWin)
|
||||
NS_WARNING("failed to dispatch pending timeout runnable");
|
||||
|
||||
if (mSuspendedDoc) {
|
||||
nsCOMPtr<nsIDocument> currentDoc = topWin->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> currentDoc =
|
||||
do_QueryInterface(topWin->GetExtantDocument());
|
||||
mSuspendedDoc->UnsuppressEventHandlingAndFireEvents(currentDoc == mSuspendedDoc);
|
||||
mSuspendedDoc = nullptr;
|
||||
}
|
||||
@ -7815,7 +7815,7 @@ nsGlobalWindow::UpdateCommands(const nsAString& anAction)
|
||||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMXULDocument> xulDoc =
|
||||
do_QueryInterface(rootWindow->GetExtantDoc());
|
||||
do_QueryInterface(rootWindow->GetExtantDocument());
|
||||
// See if we contain a XUL document.
|
||||
if (xulDoc) {
|
||||
// Retrieve the command dispatcher and call updateCommands on it.
|
||||
@ -9960,7 +9960,10 @@ nsGlobalWindow::OpenInternal(const nsAString& aUrl, const nsAString& aName,
|
||||
#ifdef DEBUG_jst
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> pidomwin(do_QueryInterface(*aReturn));
|
||||
NS_ASSERTION(pidomwin->GetExtantDoc(), "No document in new window!!!");
|
||||
|
||||
nsIDOMDocument *temp = pidomwin->GetExtantDocument();
|
||||
|
||||
NS_ASSERTION(temp, "No document in new window!!!");
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -9968,7 +9971,7 @@ nsGlobalWindow::OpenInternal(const nsAString& aUrl, const nsAString& aName,
|
||||
(*aReturn)->GetDocument(getter_AddRefs(doc));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (checkForPopup) {
|
||||
if (abuseLevel >= openControlled) {
|
||||
nsGlobalWindow *opened = static_cast<nsGlobalWindow *>(*aReturn);
|
||||
|
@ -584,7 +584,7 @@ public:
|
||||
mCleanedUp);
|
||||
}
|
||||
|
||||
static void FirePopupBlockedEvent(nsIDocument* aDoc,
|
||||
static void FirePopupBlockedEvent(nsIDOMDocument* aDoc,
|
||||
nsIDOMWindow *aRequestingWindow, nsIURI *aPopupURI,
|
||||
const nsAString &aPopupWindowName,
|
||||
const nsAString &aPopupWindowFeatures);
|
||||
|
@ -345,7 +345,7 @@ nsClipboardCommand::IsCommandEnabled(const char* aCommandName, nsISupports *aCon
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aContext);
|
||||
NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = window->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(window->GetExtantDocument());
|
||||
*outCmdEnabled = nsCopySupport::CanCopy(doc);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -231,7 +231,8 @@ nsHistory::Go(int32_t aDelta)
|
||||
// trick to work around gecko reflow bugs, and this should have
|
||||
// the same effect.
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = window->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> doc =
|
||||
do_QueryInterface(window->GetExtantDocument());
|
||||
|
||||
nsIPresShell *shell;
|
||||
nsPresContext *pcx;
|
||||
@ -337,7 +338,8 @@ nsHistory::GetState(nsIVariant **aState)
|
||||
if (!nsContentUtils::CanCallerAccess(win->GetOuterWindow()))
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = win->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> doc =
|
||||
do_QueryInterface(win->GetExtantDocument());
|
||||
if (!doc)
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
|
@ -620,7 +620,7 @@ PrintWinURI(nsGlobalWindow *win)
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = win->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(win->GetExtantDocument());
|
||||
if (!doc) {
|
||||
printf("No document in the window.\n");
|
||||
return;
|
||||
|
@ -241,7 +241,7 @@ nsJSScriptTimeoutHandler::Init(nsGlobalWindow *aWindow, bool *aIsInterval,
|
||||
if (expr) {
|
||||
// if CSP is enabled, and setTimeout/setInterval was called with a string
|
||||
// or object, disable the registration and log an error
|
||||
nsCOMPtr<nsIDocument> doc = aWindow->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(aWindow->GetExtantDocument());
|
||||
|
||||
if (doc) {
|
||||
nsCOMPtr<nsIContentSecurityPolicy> csp;
|
||||
|
@ -787,7 +787,7 @@ nsLocation::Reload(bool aForceget)
|
||||
// page since some sites may use this trick to work around gecko
|
||||
// reflow bugs, and this should have the same effect.
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = window->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(window->GetExtantDocument()));
|
||||
|
||||
nsIPresShell *shell;
|
||||
nsPresContext *pcx;
|
||||
|
@ -172,6 +172,11 @@ public:
|
||||
virtual void MaybeUpdateTouchState() {}
|
||||
virtual void UpdateTouchState() {}
|
||||
|
||||
// GetExtantDocument provides a backdoor to the DOM GetDocument accessor
|
||||
nsIDOMDocument* GetExtantDocument() const
|
||||
{
|
||||
return mDocument;
|
||||
}
|
||||
nsIDocument* GetExtantDoc() const
|
||||
{
|
||||
return mDoc;
|
||||
|
@ -58,7 +58,7 @@ GetWindowURI(nsIDOMWindow *aWindow)
|
||||
nsCOMPtr<nsPIDOMWindow> pWindow = do_QueryInterface(aWindow);
|
||||
NS_ENSURE_TRUE(pWindow, NULL);
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = pWindow->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(pWindow->GetExtantDocument());
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
|
||||
if (doc) {
|
||||
|
@ -102,7 +102,8 @@ public:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = GetOwner()->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> doc =
|
||||
do_QueryInterface(GetOwner()->GetExtantDocument());
|
||||
return doc.forget();
|
||||
}
|
||||
|
||||
|
@ -975,8 +975,9 @@ MediaManager::GetUserMedia(bool aPrivileged, nsPIDOMWindow* aWindow,
|
||||
nsCOMPtr<nsIDocument> doc = aWindow->GetExtantDoc();
|
||||
pm->TestPermission(doc->NodePrincipal(), &permission);
|
||||
if (permission == nsIPopupWindowManager::DENY_POPUP) {
|
||||
nsCOMPtr<nsIDOMDocument> domDoc = aWindow->GetExtantDocument();
|
||||
nsGlobalWindow::FirePopupBlockedEvent(
|
||||
doc, aWindow, nullptr, EmptyString(), EmptyString()
|
||||
domDoc, aWindow, nullptr, EmptyString(), EmptyString()
|
||||
);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "nsError.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "PowerManager.h"
|
||||
@ -68,9 +69,9 @@ WakeLock::Init(const nsAString &aTopic, nsIDOMWindow *aWindow)
|
||||
* is always considered invisible.
|
||||
*/
|
||||
if (window) {
|
||||
nsCOMPtr<nsIDocument> doc = window->GetExtantDoc();
|
||||
NS_ENSURE_STATE(doc);
|
||||
mHidden = doc->Hidden();
|
||||
nsCOMPtr<nsIDOMDocument> domDoc = window->GetExtantDocument();
|
||||
NS_ENSURE_STATE(domDoc);
|
||||
domDoc->GetHidden(&mHidden);
|
||||
}
|
||||
|
||||
AttachEventListener();
|
||||
@ -167,16 +168,17 @@ void
|
||||
WakeLock::AttachEventListener()
|
||||
{
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
|
||||
|
||||
|
||||
if (window) {
|
||||
nsCOMPtr<nsIDocument> doc = window->GetExtantDoc();
|
||||
if (doc) {
|
||||
doc->AddSystemEventListener(NS_LITERAL_STRING("visibilitychange"),
|
||||
this,
|
||||
/* useCapture = */ true,
|
||||
/* wantsUntrusted = */ false);
|
||||
nsCOMPtr<nsIDOMDocument> domDoc = window->GetExtantDocument();
|
||||
if (domDoc) {
|
||||
nsCOMPtr<EventTarget> target = do_QueryInterface(domDoc);
|
||||
target->AddSystemEventListener(NS_LITERAL_STRING("visibilitychange"),
|
||||
this,
|
||||
/* useCapture = */ true,
|
||||
/* wantsUntrusted = */ false);
|
||||
|
||||
nsCOMPtr<EventTarget> target = do_QueryInterface(window);
|
||||
target = do_QueryInterface(window);
|
||||
target->AddSystemEventListener(NS_LITERAL_STRING("pagehide"),
|
||||
this,
|
||||
/* useCapture = */ true,
|
||||
@ -195,12 +197,13 @@ WakeLock::DetachEventListener()
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);
|
||||
|
||||
if (window) {
|
||||
nsCOMPtr<nsIDocument> doc = window->GetExtantDoc();
|
||||
if (doc) {
|
||||
doc->RemoveSystemEventListener(NS_LITERAL_STRING("visibilitychange"),
|
||||
this,
|
||||
/* useCapture = */ true);
|
||||
nsCOMPtr<EventTarget> target = do_QueryInterface(window);
|
||||
nsCOMPtr<nsIDOMDocument> domDoc = window->GetExtantDocument();
|
||||
if (domDoc) {
|
||||
nsCOMPtr<EventTarget> target = do_QueryInterface(domDoc);
|
||||
target->RemoveSystemEventListener(NS_LITERAL_STRING("visibilitychange"),
|
||||
this,
|
||||
/* useCapture = */ true);
|
||||
target = do_QueryInterface(window);
|
||||
target->RemoveSystemEventListener(NS_LITERAL_STRING("pagehide"),
|
||||
this,
|
||||
/* useCapture = */ true);
|
||||
|
@ -641,7 +641,8 @@ nsJSChannel::AsyncOpen(nsIStreamListener *aListener, nsISupports *aContext)
|
||||
}
|
||||
}
|
||||
|
||||
mDocumentOnloadBlockedOn = mOriginalInnerWindow->GetExtantDoc();
|
||||
mDocumentOnloadBlockedOn =
|
||||
do_QueryInterface(mOriginalInnerWindow->GetExtantDocument());
|
||||
if (mDocumentOnloadBlockedOn) {
|
||||
// If we're a document channel, we need to actually block onload on our
|
||||
// _parent_ document. This is because we don't actually set our
|
||||
@ -666,7 +667,7 @@ nsJSChannel::AsyncOpen(nsIStreamListener *aListener, nsISupports *aContext)
|
||||
if (mIsAsync) {
|
||||
// post an event to do the rest
|
||||
method = &nsJSChannel::EvaluateScript;
|
||||
} else {
|
||||
} else {
|
||||
EvaluateScript();
|
||||
if (mOpenedStreamChannel) {
|
||||
// That will handle notifying things
|
||||
|
@ -2505,7 +2505,7 @@ WorkerPrivate::Create(JSContext* aCx, JSObject* aObj, WorkerPrivate* aParent,
|
||||
|
||||
// If we're called from a window then we can dig out the principal and URI
|
||||
// from the document.
|
||||
document = window->GetExtantDoc();
|
||||
document = do_QueryInterface(window->GetExtantDocument());
|
||||
if (!document) {
|
||||
JS_ReportError(aCx, "No document in this window!");
|
||||
return nullptr;
|
||||
@ -3114,7 +3114,7 @@ WorkerPrivate::CheckXHRParamsAllowed(nsPIDOMWindow* aWindow)
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = aWindow->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(aWindow->GetExtantDocument());
|
||||
if (!doc) {
|
||||
return false;
|
||||
}
|
||||
|
@ -5,18 +5,13 @@
|
||||
|
||||
#include "nsAutoWindowStateHelper.h"
|
||||
|
||||
#include "nsDOMEvent.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsString.h"
|
||||
#include "nsGUIEvent.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
/****************************************************************
|
||||
****************** nsAutoWindowStateHelper *********************
|
||||
****************************************************************/
|
||||
@ -55,21 +50,18 @@ nsAutoWindowStateHelper::DispatchEventToChrome(const char *aEventName)
|
||||
|
||||
// The functions of nsContentUtils do not provide the required behavior,
|
||||
// so the following is inlined.
|
||||
nsIDocument* doc = window->GetExtantDoc();
|
||||
nsIDOMDocument* doc = window->GetExtantDocument();
|
||||
if (!doc) {
|
||||
return true;
|
||||
}
|
||||
|
||||
ErrorResult rv;
|
||||
nsRefPtr<nsDOMEvent> event = doc->CreateEvent(NS_LITERAL_STRING("Events"), rv);
|
||||
if (rv.Failed()) {
|
||||
return false;
|
||||
}
|
||||
nsCOMPtr<nsIDOMEvent> event;
|
||||
doc->CreateEvent(NS_LITERAL_STRING("Events"), getter_AddRefs(event));
|
||||
NS_ENSURE_TRUE(NS_SUCCEEDED(event->InitEvent(NS_ConvertASCIItoUTF16(aEventName), true, true)), false);
|
||||
event->SetTrusted(true);
|
||||
event->GetInternalNSEvent()->mFlags.mOnlyChromeDispatch = true;
|
||||
|
||||
nsCOMPtr<EventTarget> target = do_QueryInterface(window);
|
||||
nsCOMPtr<nsIDOMEventTarget> target(do_QueryInterface(window));
|
||||
bool defaultActionEnabled;
|
||||
target->DispatchEvent(event, &defaultActionEnabled);
|
||||
return defaultActionEnabled;
|
||||
|
@ -772,7 +772,8 @@ nsWindowWatcher::OpenWindowInternal(nsIDOMWindow *aParent,
|
||||
nsCOMPtr<nsIDocShellTreeItem> callerItem = GetCallerTreeItem(parentItem);
|
||||
nsCOMPtr<nsPIDOMWindow> callerWin = do_GetInterface(callerItem);
|
||||
if (callerWin) {
|
||||
nsCOMPtr<nsIDocument> doc = callerWin->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> doc =
|
||||
do_QueryInterface(callerWin->GetExtantDocument());
|
||||
if (doc) {
|
||||
newMuCV->SetDefaultCharacterSet(doc->GetDocumentCharacterSet());
|
||||
}
|
||||
@ -910,8 +911,8 @@ nsWindowWatcher::OpenWindowInternal(nsIDOMWindow *aParent,
|
||||
Also using GetDocument to force document creation seems to
|
||||
screw up focus in the hidden window; see bug 36016.
|
||||
*/
|
||||
nsCOMPtr<nsIDocument> doc = w->GetExtantDoc();
|
||||
if (doc) {
|
||||
nsCOMPtr<nsIDocument> doc(do_QueryInterface(w->GetExtantDocument()));
|
||||
if (doc) {
|
||||
// Set the referrer
|
||||
loadInfo->SetReferrer(doc->GetDocumentURI());
|
||||
}
|
||||
@ -1798,7 +1799,8 @@ nsWindowWatcher::ReadyOpenedDocShellItem(nsIDocShellTreeItem *aOpenedItem,
|
||||
NS_ASSERTION(!chan, "Why is there a document channel?");
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = piOpenedWindow->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> doc =
|
||||
do_QueryInterface(piOpenedWindow->GetExtantDocument());
|
||||
if (doc) {
|
||||
doc->SetIsInitialDocument(true);
|
||||
}
|
||||
|
@ -4934,7 +4934,8 @@ ContentComponentsGetterOp(JSContext *cx, JSHandleObject obj, JSHandleId id,
|
||||
nsCOMPtr<nsPIDOMWindow> win =
|
||||
do_QueryInterface(nsJSUtils::GetStaticScriptGlobal(obj));
|
||||
if (win) {
|
||||
nsCOMPtr<nsIDocument> doc = win->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> doc =
|
||||
do_QueryInterface(win->GetExtantDocument());
|
||||
if (doc)
|
||||
doc->WarnOnceAbout(nsIDocument::eComponents, /* asError = */ true);
|
||||
}
|
||||
|
@ -933,7 +933,8 @@ nsDocumentViewer::InitInternal(nsIWidget* aParentWidget,
|
||||
getter_AddRefs(window));
|
||||
|
||||
if (window) {
|
||||
nsCOMPtr<nsIDocument> curDoc = window->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> curDoc =
|
||||
do_QueryInterface(window->GetExtantDocument());
|
||||
if (aForceSetNewDocument || curDoc != mDocument) {
|
||||
window->SetNewDocument(mDocument, aState, false);
|
||||
nsJSContext::LoadStart();
|
||||
@ -3342,7 +3343,7 @@ nsDocumentViewer::GetPopupNode(nsIDOMNode** aNode)
|
||||
if (!node) {
|
||||
nsPIDOMWindow* rootWindow = root->GetWindow();
|
||||
if (rootWindow) {
|
||||
nsCOMPtr<nsIDocument> rootDoc = rootWindow->GetExtantDoc();
|
||||
nsCOMPtr<nsIDocument> rootDoc = do_QueryInterface(rootWindow->GetExtantDocument());
|
||||
if (rootDoc) {
|
||||
nsXULPopupManager* pm = nsXULPopupManager::GetInstance();
|
||||
if (pm) {
|
||||
|
@ -5980,7 +5980,7 @@ PresShell::HandleEvent(nsIFrame *aFrame,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
retargetEventDoc = window->GetExtantDoc();
|
||||
retargetEventDoc = do_QueryInterface(window->GetExtantDocument());
|
||||
if (!retargetEventDoc)
|
||||
return NS_OK;
|
||||
} else if (capturingContent) {
|
||||
|
Loading…
Reference in New Issue
Block a user