Merging with mozilla-central. Manually merged: content/canvas/src/nsCanvasRenderingContext2D.cpp ipc/ipdl/Makefile.in toolkit/toolkit-tiers.mk toolkit/xre/nsEmbedFunctions.cpp

--HG--
rename : gfx/thebes/src/gfxSharedImageSurface.cpp => gfx/thebes/gfxSharedImageSurface.cpp
rename : gfx/thebes/public/gfxSharedImageSurface.h => gfx/thebes/gfxSharedImageSurface.h
This commit is contained in:
Doug Turner 2010-06-28 16:33:19 -07:00
Родитель 9c5c736f47 75a2c8a1a0
Коммит e5c86fcd42
705 изменённых файлов: 10092 добавлений и 5652 удалений

Просмотреть файл

@ -44,7 +44,10 @@
#include "nsIAccessibleRetrieval.h"
#include "nsIAccessibleEvent.h"
#include "nsAutoPtr.h"
class nsAccessible;
class nsINode;
class nsIContent;
class nsIDocument;
class nsIFrame;
@ -68,74 +71,63 @@ public:
* @param aPresShell [in] the presentation shell which contains layout info
* for the DOM node
*/
virtual nsAccessible* GetAccessibleInShell(nsIDOMNode *aNode,
nsIPresShell *aPresShell) = 0;
virtual nsAccessible* GetAccessibleInShell(nsINode* aNode,
nsIPresShell* aPresShell) = 0;
/**
* Creates accessible for the given DOM node or frame.
*/
virtual nsresult CreateOuterDocAccessible(nsIDOMNode *aNode,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTML4ButtonAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHyperTextAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTMLBRAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTMLButtonAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTMLLIAccessible(nsIFrame *aFrame,
nsIFrame *aBulletFrame,
const nsAString& aBulletText,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTMLCheckboxAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTMLComboboxAccessible(nsIDOMNode *aNode,
nsIWeakReference *aPresShell,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTMLGenericAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTMLGroupboxAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTMLHRAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTMLImageAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTMLLabelAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTMLListboxAccessible(nsIDOMNode *aNode,
nsIWeakReference *aPresShell,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTMLMediaAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTMLObjectFrameAccessible(nsObjectFrame *aFrame,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTMLRadioButtonAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTMLSelectOptionAccessible(nsIDOMNode *aNode,
nsIAccessible *aAccParent,
nsIWeakReference *aPresShell,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTMLTableAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTMLTableCellAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTMLTextAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTMLTextFieldAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible) = 0;
virtual nsresult CreateHTMLCaptionAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible) = 0;
virtual already_AddRefed<nsAccessible>
CreateHTMLBRAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
virtual already_AddRefed<nsAccessible>
CreateHTML4ButtonAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
virtual already_AddRefed<nsAccessible>
CreateHTMLButtonAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
virtual already_AddRefed<nsAccessible>
CreateHTMLCaptionAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
virtual already_AddRefed<nsAccessible>
CreateHTMLCheckboxAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
virtual already_AddRefed<nsAccessible>
CreateHTMLComboboxAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
virtual already_AddRefed<nsAccessible>
CreateHTMLGroupboxAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
virtual already_AddRefed<nsAccessible>
CreateHTMLHRAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
virtual already_AddRefed<nsAccessible>
CreateHTMLImageAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
virtual already_AddRefed<nsAccessible>
CreateHTMLLabelAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
virtual already_AddRefed<nsAccessible>
CreateHTMLLIAccessible(nsIContent* aContent, nsIPresShell* aPresShell,
const nsAString& aBulletText) = 0;
virtual already_AddRefed<nsAccessible>
CreateHTMLListboxAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
virtual already_AddRefed<nsAccessible>
CreateHTMLMediaAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
virtual already_AddRefed<nsAccessible>
CreateHTMLObjectFrameAccessible(nsObjectFrame* aFrame, nsIContent* aContent,
nsIPresShell* aPresShell) = 0;
virtual already_AddRefed<nsAccessible>
CreateHTMLRadioButtonAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
virtual already_AddRefed<nsAccessible>
CreateHTMLTableAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
virtual already_AddRefed<nsAccessible>
CreateHTMLTableCellAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
virtual already_AddRefed<nsAccessible>
CreateHTMLTextAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
virtual already_AddRefed<nsAccessible>
CreateHTMLTextFieldAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
virtual already_AddRefed<nsAccessible>
CreateHyperTextAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
virtual already_AddRefed<nsAccessible>
CreateOuterDocAccessible(nsIContent* aContent, nsIPresShell* aPresShell) = 0;
/**
* Adds/remove ATK root accessible for gtk+ native window to/from children
* of the application accessible.
*/
virtual nsresult AddNativeRootAccessible(void *aAtkAccessible,
nsIAccessible **aAccessible) = 0;
virtual nsresult
RemoveNativeRootAccessible(nsIAccessible *aRootAccessible) = 0;
virtual nsAccessible* AddNativeRootAccessible(void* aAtkAccessible) = 0;
virtual void RemoveNativeRootAccessible(nsAccessible* aRootAccessible) = 0;
/**
* Used to describe sort of changes leading to accessible tree invalidation.

Просмотреть файл

@ -653,16 +653,13 @@ gboolean fireRootAccessibleAddedCB(gpointer data)
return FALSE;
}
nsresult
nsApplicationAccessibleWrap::AddRootAccessible(nsIAccessible *aRootAccWrap)
PRBool
nsApplicationAccessibleWrap::AppendChild(nsAccessible *aChild)
{
NS_ENSURE_ARG_POINTER(aRootAccWrap);
if (!nsApplicationAccessible::AppendChild(aChild))
return PR_FALSE;
// add by weak reference
nsresult rv = nsApplicationAccessible::AddRootAccessible(aRootAccWrap);
NS_ENSURE_SUCCESS(rv, rv);
AtkObject *atkAccessible = nsAccessibleWrap::GetAtkObject(aRootAccWrap);
AtkObject *atkAccessible = nsAccessibleWrap::GetAtkObject(aChild);
atk_object_set_parent(atkAccessible, mAtkObject);
PRUint32 count = mChildren.Length();
@ -680,22 +677,20 @@ nsApplicationAccessibleWrap::AddRootAccessible(nsIAccessible *aRootAccWrap)
g_timeout_add(0, fireRootAccessibleAddedCB, eventData);
}
return NS_OK;
return PR_TRUE;
}
nsresult
nsApplicationAccessibleWrap::RemoveRootAccessible(nsIAccessible *aRootAccWrap)
PRBool
nsApplicationAccessibleWrap::RemoveChild(nsAccessible* aChild)
{
NS_ENSURE_ARG_POINTER(aRootAccWrap);
PRInt32 index = aChild->GetIndexInParent();
PRInt32 index = mChildren.IndexOf(aRootAccWrap);
AtkObject *atkAccessible = nsAccessibleWrap::GetAtkObject(aRootAccWrap);
AtkObject *atkAccessible = nsAccessibleWrap::GetAtkObject(aChild);
atk_object_set_parent(atkAccessible, NULL);
g_signal_emit_by_name(mAtkObject, "children_changed::remove", index,
atkAccessible, NULL);
return nsApplicationAccessible::RemoveRootAccessible(aRootAccWrap);
return nsApplicationAccessible::RemoveChild(aChild);
}
void

Просмотреть файл

@ -57,12 +57,12 @@ public:
// nsAccessNode
virtual PRBool Init();
// nsAccessible
virtual PRBool AppendChild(nsAccessible* aChild);
virtual PRBool RemoveChild(nsAccessible* aChild);
// return the atk object for app root accessible
NS_IMETHOD GetNativeInterface(void **aOutAccessible);
// nsApplicationAccessible
virtual nsresult AddRootAccessible(nsIAccessible *aRootAccWrap);
virtual nsresult RemoveRootAccessible(nsIAccessible *aRootAccWrap);
};
#endif /* __NS_APP_ROOT_ACCESSIBLE_H__ */

Просмотреть файл

@ -439,7 +439,7 @@ nsAccDocManager::CreateDocOrRootAccessible(nsIDocument *aDocument)
return nsnull;
// Ignore documents without presshell.
nsIPresShell *presShell = aDocument->GetPrimaryShell();
nsIPresShell *presShell = aDocument->GetShell();
if (!presShell)
return nsnull;

Просмотреть файл

@ -259,7 +259,7 @@ private:
printf(", %sactive", aDocument->IsActive() ? "" : "not ");
#define NS_LOG_ACCDOC_DOCPRESSHELL(aDocument) \
nsIPresShell *ps = aDocument->GetPrimaryShell(); \
nsIPresShell *ps = aDocument->GetShell(); \
printf("presshell: %p", ps); \
nsIScrollableFrame *sf = ps ? \
ps->GetRootScrollFrameAsScrollableExternal() : nsnull; \

Просмотреть файл

@ -159,10 +159,10 @@ nsAccUtils::GetPositionAndSizeForXULSelectControlItem(nsIContent *aContent,
for (PRUint32 index = 0; index < itemsCount; index++) {
nsCOMPtr<nsIDOMXULSelectControlItemElement> currItem;
control->GetItemAtIndex(index, getter_AddRefs(currItem));
nsCOMPtr<nsIDOMNode> currNode(do_QueryInterface(currItem));
nsCOMPtr<nsINode> currNode(do_QueryInterface(currItem));
nsAccessible* itemAcc = GetAccService()->GetAccessible(currNode);
nsCOMPtr<nsIAccessible> itemAcc;
GetAccService()->GetAccessibleFor(currNode, getter_AddRefs(itemAcc));
if (!itemAcc ||
State(itemAcc) & nsIAccessibleStates::STATE_INVISIBLE) {
(*aSetSize)--;
@ -201,9 +201,9 @@ nsAccUtils::GetPositionAndSizeForXULContainerItem(nsIContent *aContent,
for (PRInt32 index = indexOf; index >= 0; index--) {
nsCOMPtr<nsIDOMXULElement> item;
container->GetItemAtIndex(index, getter_AddRefs(item));
nsCOMPtr<nsINode> itemNode(do_QueryInterface(item));
nsCOMPtr<nsIAccessible> itemAcc;
GetAccService()->GetAccessibleFor(item, getter_AddRefs(itemAcc));
nsAccessible* itemAcc = GetAccService()->GetAccessible(itemNode);
if (itemAcc) {
PRUint32 itemRole = Role(itemAcc);
@ -222,9 +222,9 @@ nsAccUtils::GetPositionAndSizeForXULContainerItem(nsIContent *aContent,
index++) {
nsCOMPtr<nsIDOMXULElement> item;
container->GetItemAtIndex(index, getter_AddRefs(item));
nsCOMPtr<nsINode> itemNode(do_QueryInterface(item));
nsCOMPtr<nsIAccessible> itemAcc;
GetAccService()->GetAccessibleFor(item, getter_AddRefs(itemAcc));
nsAccessible* itemAcc = GetAccService()->GetAccessible(itemNode);
if (itemAcc) {
PRUint32 itemRole = Role(itemAcc);

Просмотреть файл

@ -176,12 +176,6 @@ public:
*/
already_AddRefed<nsIPresShell> GetPresShell();
/**
* Return true if the accessible still has presentation shell. Light-weight
* version of IsDefunct() method.
*/
PRBool HasWeakShell() const { return !!mWeakShell; }
protected:
nsPresContext* GetPresContext();

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -58,65 +58,56 @@ public:
NS_DECL_NSIOBSERVER
// nsIAccessibilityService
virtual nsAccessible* GetAccessibleInShell(nsIDOMNode *aNode,
nsIPresShell *aPresShell);
virtual nsAccessible* GetAccessibleInShell(nsINode* aNode,
nsIPresShell* aPresShell);
virtual nsresult CreateOuterDocAccessible(nsIDOMNode *aNode,
nsIAccessible **aAccessible);
virtual nsresult CreateHTML4ButtonAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible);
virtual nsresult CreateHyperTextAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible);
virtual nsresult CreateHTMLBRAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible);
virtual nsresult CreateHTMLButtonAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible);
virtual nsresult CreateHTMLLIAccessible(nsIFrame *aFrame,
nsIFrame *aBulletFrame,
const nsAString& aBulletText,
nsIAccessible **aAccessible);
virtual nsresult CreateHTMLCheckboxAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible);
virtual nsresult CreateHTMLComboboxAccessible(nsIDOMNode *aNode,
nsIWeakReference *aPresShell,
nsIAccessible **aAccessible);
virtual nsresult CreateHTMLGenericAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible);
virtual nsresult CreateHTMLGroupboxAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible);
virtual nsresult CreateHTMLHRAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible);
virtual nsresult CreateHTMLImageAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible);
virtual nsresult CreateHTMLLabelAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible);
virtual nsresult CreateHTMLListboxAccessible(nsIDOMNode *aNode,
nsIWeakReference *aPresShell,
nsIAccessible **aAccessible);
virtual nsresult CreateHTMLMediaAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible);
virtual nsresult CreateHTMLObjectFrameAccessible(nsObjectFrame *aFrame,
nsIAccessible **aAccessible);
virtual nsresult CreateHTMLRadioButtonAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible);
virtual nsresult CreateHTMLSelectOptionAccessible(nsIDOMNode *aNode,
nsIAccessible *aAccParent,
nsIWeakReference *aPresShell,
nsIAccessible **aAccessible);
virtual nsresult CreateHTMLTableAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible);
virtual nsresult CreateHTMLTableCellAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible);
virtual nsresult CreateHTMLTextAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible);
virtual nsresult CreateHTMLTextFieldAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible);
virtual nsresult CreateHTMLCaptionAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible);
virtual already_AddRefed<nsAccessible>
CreateHTMLBRAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
virtual already_AddRefed<nsAccessible>
CreateHTML4ButtonAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
virtual already_AddRefed<nsAccessible>
CreateHTMLButtonAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
virtual already_AddRefed<nsAccessible>
CreateHTMLCaptionAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
virtual already_AddRefed<nsAccessible>
CreateHTMLCheckboxAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
virtual already_AddRefed<nsAccessible>
CreateHTMLComboboxAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
virtual already_AddRefed<nsAccessible>
CreateHTMLGroupboxAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
virtual already_AddRefed<nsAccessible>
CreateHTMLHRAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
virtual already_AddRefed<nsAccessible>
CreateHTMLImageAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
virtual already_AddRefed<nsAccessible>
CreateHTMLLabelAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
virtual already_AddRefed<nsAccessible>
CreateHTMLLIAccessible(nsIContent* aContent, nsIPresShell* aPresShell,
const nsAString& aBulletText);
virtual already_AddRefed<nsAccessible>
CreateHTMLListboxAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
virtual already_AddRefed<nsAccessible>
CreateHTMLMediaAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
virtual already_AddRefed<nsAccessible>
CreateHTMLObjectFrameAccessible(nsObjectFrame* aFrame, nsIContent* aContent,
nsIPresShell* aPresShell);
virtual already_AddRefed<nsAccessible>
CreateHTMLRadioButtonAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
virtual already_AddRefed<nsAccessible>
CreateHTMLTableAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
virtual already_AddRefed<nsAccessible>
CreateHTMLTableCellAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
virtual already_AddRefed<nsAccessible>
CreateHTMLTextAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
virtual already_AddRefed<nsAccessible>
CreateHTMLTextFieldAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
virtual already_AddRefed<nsAccessible>
CreateHyperTextAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
virtual already_AddRefed<nsAccessible>
CreateOuterDocAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
virtual nsresult AddNativeRootAccessible(void *aAtkAccessible,
nsIAccessible **aAccessible);
virtual nsresult RemoveNativeRootAccessible(nsIAccessible *aRootAccessible);
virtual nsAccessible* AddNativeRootAccessible(void* aAtkAccessible);
virtual void RemoveNativeRootAccessible(nsAccessible* aRootAccessible);
virtual nsresult InvalidateSubtreeFor(nsIPresShell *aPresShell,
nsIContent *aContent,
@ -240,52 +231,39 @@ private:
*/
void Shutdown();
/**
* Return presentation shell, DOM node for the given frame.
*
* @param aFrame [in] the given frame
* @param aShell [out] presentation shell for DOM node associated with the
* given frame
* @param aContent [out] DOM node associated with the given frame
*/
nsresult GetInfo(nsIFrame *aFrame, nsIWeakReference **aShell,
nsIContent **aContent);
/**
* Return accessible for HTML area element associated with an image map.
*/
already_AddRefed<nsAccessible>
GetAreaAccessible(nsIFrame *aImageFrame, nsINode *aAreaNode,
nsIWeakReference *aWeakShell);
nsAccessible* GetAreaAccessible(nsIFrame* aImageFrame, nsINode* aAreaNode,
nsIWeakReference* aWeakShell);
/**
* Create accessible for the element implementing nsIAccessibleProvider
* interface.
*/
already_AddRefed<nsAccessible>
CreateAccessibleByType(nsIContent *aContent, nsIWeakReference *aWeakShell);
CreateAccessibleByType(nsIContent* aContent, nsIWeakReference* aWeakShell);
/**
* Create accessible for HTML node by tag name.
*/
already_AddRefed<nsAccessible>
CreateHTMLAccessibleByMarkup(nsIFrame *aFrame, nsIWeakReference *aWeakShell,
nsINode *aNode);
CreateHTMLAccessibleByMarkup(nsIFrame* aFrame, nsIContent* aContent,
nsIWeakReference* aWeakShell);
/**
* Create accessible if parent is a deck frame.
*/
already_AddRefed<nsAccessible>
CreateAccessibleForDeckChild(nsIFrame *aFrame, nsIContent *aContent,
nsIWeakReference *aWeakShell);
CreateAccessibleForDeckChild(nsIFrame* aFrame, nsIContent* aContent,
nsIWeakReference* aWeakShell);
#ifdef MOZ_XUL
/**
* Create accessible for XUL tree element.
*/
already_AddRefed<nsAccessible>
CreateAccessibleForXULTree(nsIContent *aContent,
nsIWeakReference *aWeakShell);
CreateAccessibleForXULTree(nsIContent* aContent, nsIWeakReference* aWeakShell);
#endif
/**

Просмотреть файл

@ -3008,7 +3008,7 @@ PRBool nsAccessible::CheckVisibilityInParentChain(nsIDocument* aDocument, nsIVie
if (parentDoc != nsnull) {
nsIContent* content = parentDoc->FindContentForSubDocument(document);
if (content != nsnull) {
nsIPresShell* shell = parentDoc->GetPrimaryShell();
nsIPresShell* shell = parentDoc->GetShell();
if (!shell) {
return PR_FALSE;
}

Просмотреть файл

@ -414,8 +414,8 @@ nsApplicationAccessible::GetParent()
void
nsApplicationAccessible::InvalidateChildren()
{
// Do nothing because application children are kept updated by
// AddRootAccessible() and RemoveRootAccessible() method calls.
// Do nothing because application children are kept updated by AppendChild()
// and RemoveChild() method calls.
}
////////////////////////////////////////////////////////////////////////////////
@ -428,8 +428,8 @@ nsApplicationAccessible::CacheChildren()
// children are requested because empty InvalidateChldren() prevents its
// repeated calls.
// Basically children are kept updated by Add/RemoveRootAccessible method
// calls. However if there are open windows before accessibility was started
// Basically children are kept updated by Append/RemoveChild method calls.
// However if there are open windows before accessibility was started
// then we need to make sure root accessibles for open windows are created so
// that all root accessibles are stored in application accessible children
// array.
@ -453,9 +453,8 @@ nsApplicationAccessible::CacheChildren()
nsCOMPtr<nsIDOMDocument> DOMDocument;
DOMWindow->GetDocument(getter_AddRefs(DOMDocument));
if (DOMDocument) {
nsCOMPtr<nsIAccessible> accessible;
GetAccService()->GetAccessibleFor(DOMDocument,
getter_AddRefs(accessible));
nsCOMPtr<nsIDocument> docNode(do_QueryInterface(DOMDocument));
GetAccService()->GetDocAccessible(docNode); // ensure creation
}
}
windowEnumerator->HasMoreElements(&hasMore);
@ -481,30 +480,22 @@ nsApplicationAccessible::GetSiblingAtOffset(PRInt32 aOffset, nsresult* aError)
////////////////////////////////////////////////////////////////////////////////
// Public methods
nsresult
nsApplicationAccessible::AddRootAccessible(nsIAccessible *aRootAccessible)
PRBool
nsApplicationAccessible::AppendChild(nsAccessible* aChild)
{
NS_ENSURE_ARG_POINTER(aRootAccessible);
if (!mChildren.AppendElement(aChild))
return PR_FALSE;
nsRefPtr<nsAccessible> rootAcc = do_QueryObject(aRootAccessible);
if (!mChildren.AppendElement(rootAcc))
return NS_ERROR_FAILURE;
rootAcc->SetParent(this);
return NS_OK;
aChild->SetParent(this);
return PR_TRUE;
}
nsresult
nsApplicationAccessible::RemoveRootAccessible(nsIAccessible *aRootAccessible)
PRBool
nsApplicationAccessible::RemoveChild(nsAccessible* aChild)
{
NS_ENSURE_ARG_POINTER(aRootAccessible);
// It's not needed to void root accessible parent because this method is
// called on root accessible shutdown and its parent will be cleared
// properly.
return mChildren.RemoveElement(aRootAccessible) ? NS_OK : NS_ERROR_FAILURE;
// It's not needed to unbind root accessible from parent because this method
// is called when root accessible is shutdown and it'll be unbound properly.
return mChildren.RemoveElement(aChild);
}
////////////////////////////////////////////////////////////////////////////////

Просмотреть файл

@ -116,10 +116,8 @@ public:
virtual nsAccessible* GetParent();
virtual void InvalidateChildren();
// nsApplicationAccessible
virtual nsresult AddRootAccessible(nsIAccessible *aRootAccWrap);
virtual nsresult RemoveRootAccessible(nsIAccessible *aRootAccWrap);
virtual PRBool AppendChild(nsAccessible* aChild);
virtual PRBool RemoveChild(nsAccessible* aChild);
protected:

Просмотреть файл

@ -361,7 +361,7 @@ nsCaretAccessible::GetSelectionControllerForNode(nsIContent *aContent)
if (!document)
return nsnull;
nsIPresShell *presShell = document->GetPrimaryShell();
nsIPresShell *presShell = document->GetShell();
if (!presShell)
return nsnull;

Просмотреть файл

@ -107,7 +107,7 @@ nsCoreUtils::DispatchClickEvent(nsITreeBoxObject *aTreeBoxObj,
return;
nsIPresShell *presShell = nsnull;
presShell = document->GetPrimaryShell();
presShell = document->GetShell();
if (!presShell)
return;
@ -219,7 +219,7 @@ nsCoreUtils::GetAccessKeyFor(nsIContent *aContent)
if (!doc)
return 0;
nsCOMPtr<nsIPresShell> presShell = doc->GetPrimaryShell();
nsCOMPtr<nsIPresShell> presShell = doc->GetShell();
if (!presShell)
return 0;

Просмотреть файл

@ -256,7 +256,7 @@ public:
static nsIPresShell *GetPresShellFor(nsINode *aNode)
{
nsIDocument *document = aNode->GetOwnerDoc();
return document ? document->GetPrimaryShell() : nsnull;
return document ? document->GetShell() : nsnull;
}
static already_AddRefed<nsIWeakReference> GetWeakShellFor(nsINode *aNode)
{

Просмотреть файл

@ -673,7 +673,7 @@ void nsDocAccessible::GetBoundsRect(nsRect& aBounds, nsIFrame** aRelativeFrame)
nsIDocument *parentDoc = nsnull;
while (document) {
nsIPresShell *presShell = document->GetPrimaryShell();
nsIPresShell *presShell = document->GetShell();
if (!presShell) {
return;
}

Просмотреть файл

@ -195,10 +195,6 @@ nsAccEventQueue::WillRefresh(mozilla::TimeStamp aTime)
if (!mDocument)
return;
nsCOMPtr<nsIPresShell> presShell = mDocument->GetPresShell();
if (!presShell)
return;
// Process only currently queued events. Newly appended events during events
// flushing won't be processed.
nsTArray < nsRefPtr<nsAccEvent> > events;
@ -208,14 +204,13 @@ nsAccEventQueue::WillRefresh(mozilla::TimeStamp aTime)
for (PRUint32 index = 0; index < length; index ++) {
// No presshell means the document was shut down during event handling
// by AT.
if (!mDocument || !mDocument->HasWeakShell())
break;
nsAccEvent *accEvent = events[index];
if (accEvent->mEventRule != nsAccEvent::eDoNotEmit)
mDocument->ProcessPendingEvent(accEvent);
// No document means it was shut down during event handling by AT
if (!mDocument)
return;
}
if (mEvents.Length() == 0) {

Просмотреть файл

@ -91,10 +91,7 @@ nsRelUtils::AddTargetFromContent(PRUint32 aRelationType,
if (!aContent)
return NS_OK_NO_RELATION_TARGET;
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(aContent));
nsCOMPtr<nsIAccessible> accessible;
GetAccService()->GetAccessibleFor(node, getter_AddRefs(accessible));
nsAccessible* accessible = GetAccService()->GetAccessible(aContent);
return AddTarget(aRelationType, aRelation, accessible);
}

Просмотреть файл

@ -831,11 +831,9 @@ PRBool
nsRootAccessible::Init()
{
nsApplicationAccessible *applicationAcc = GetApplicationAccessible();
if (!applicationAcc)
if (!applicationAcc || !applicationAcc->AppendChild(this))
return PR_FALSE;
applicationAcc->AddRootAccessible(this);
return nsDocAccessibleWrap::Init();
}
@ -850,7 +848,7 @@ nsRootAccessible::Shutdown()
if (!applicationAcc)
return;
applicationAcc->RemoveRootAccessible(this);
applicationAcc->RemoveChild(this);
mCurrentARIAMenubar = nsnull;
@ -940,8 +938,8 @@ nsRootAccessible::GetRelationByType(PRUint32 aRelationType,
nsAccessible*
nsRootAccessible::GetParent()
{
// Parent has been setted in nsApplicationAccesible::AddRootAccessible()
// when root accessible was intialized.
// Parent has been set in nsApplicationAccesible::AppendChild() when root
// accessible was initialized.
return mParent;
}

Просмотреть файл

@ -822,10 +822,8 @@ nsIContent* nsHTMLSelectOptionAccessible::GetSelectState(PRUint32* aState,
content = content->GetParent();
}
nsCOMPtr<nsIDOMNode> selectNode(do_QueryInterface(content));
if (selectNode) {
nsCOMPtr<nsIAccessible> selAcc;
GetAccService()->GetAccessibleFor(selectNode, getter_AddRefs(selAcc));
if (content) {
nsAccessible* selAcc = GetAccService()->GetAccessible(content);
if (selAcc) {
selAcc->GetState(aState, aExtraState);
return content;

Просмотреть файл

@ -72,7 +72,7 @@ CAccessibleAction::nActions(long *aNumActions)
__try {
*aNumActions = 0;
nsCOMPtr<nsIAccessible> acc(do_QueryInterface(this));
nsCOMPtr<nsIAccessible> acc(do_QueryObject(this));
if (!acc)
return E_FAIL;
@ -92,7 +92,7 @@ STDMETHODIMP
CAccessibleAction::doAction(long aActionIndex)
{
__try {
nsCOMPtr<nsIAccessible> acc(do_QueryInterface(this));
nsCOMPtr<nsIAccessible> acc(do_QueryObject(this));
if (!acc)
return E_FAIL;
@ -110,7 +110,7 @@ CAccessibleAction::get_description(long aActionIndex, BSTR *aDescription)
__try {
*aDescription = NULL;
nsCOMPtr<nsIAccessible> acc(do_QueryInterface(this));
nsCOMPtr<nsIAccessible> acc(do_QueryObject(this));
if (!acc)
return E_FAIL;
@ -140,7 +140,7 @@ __try {
*aKeyBinding = NULL;
*aNumBinding = 0;
nsCOMPtr<nsIAccessible> acc(do_QueryInterface(this));
nsCOMPtr<nsIAccessible> acc(do_QueryObject(this));
if (!acc)
return E_FAIL;
@ -197,7 +197,7 @@ CAccessibleAction::get_name(long aActionIndex, BSTR *aName)
__try {
*aName = NULL;
nsCOMPtr<nsIAccessible> acc(do_QueryInterface(this));
nsCOMPtr<nsIAccessible> acc(do_QueryObject(this));
if (!acc)
return E_FAIL;

Просмотреть файл

@ -45,8 +45,7 @@
#include "AccessibleAction.h"
class CAccessibleAction: public nsISupports,
public IAccessibleAction
class CAccessibleAction: public IAccessibleAction
{
public:
@ -78,6 +77,9 @@ public:
/* [in] */ long actionIndex,
/* [retval][out] */ BSTR *localizedName);
// nsISupports
NS_IMETHOD QueryInterface(const nsIID& uuid, void** result) = 0;
};

Просмотреть файл

@ -85,7 +85,7 @@ __try {
*aX = 0;
*aY = 0;
nsCOMPtr<nsIAccessible> acc(do_QueryInterface(this));
nsCOMPtr<nsIAccessible> acc(do_QueryObject(this));
if (!acc)
return E_FAIL;
@ -160,7 +160,7 @@ CAccessibleComponent::GetARGBValueFromCSSProperty(const nsAString& aPropName,
__try {
*aColorValue = 0;
nsCOMPtr<nsIAccessNode> acc(do_QueryInterface(this));
nsCOMPtr<nsIAccessNode> acc(do_QueryObject(this));
if (!acc)
return E_FAIL;

Просмотреть файл

@ -45,8 +45,7 @@
#include "AccessibleComponent.h"
class CAccessibleComponent: public nsISupports,
public IAccessibleComponent
class CAccessibleComponent: public IAccessibleComponent
{
public:
@ -64,6 +63,9 @@ public:
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_background(
/* [retval][out] */ IA2Color *background);
// nsISupports
NS_IMETHOD QueryInterface(const nsIID& uuid, void** result) = 0;
protected:
/**

Просмотреть файл

@ -48,7 +48,7 @@
#include "nsString.h"
#define GET_NSIACCESSIBLEEDITABLETEXT \
nsCOMPtr<nsIAccessibleEditableText> textAcc(do_QueryInterface(this));\
nsCOMPtr<nsIAccessibleEditableText> textAcc(do_QueryObject(this));\
NS_ASSERTION(textAcc,\
"Subclass of CAccessibleEditableText doesn't implement nsIAccessibleEditableText");\
if (!textAcc)\
@ -62,7 +62,7 @@ CAccessibleEditableText::QueryInterface(REFIID iid, void** ppv)
*ppv = NULL;
if (IID_IAccessibleEditableText == iid) {
nsCOMPtr<nsIAccessibleEditableText> editTextAcc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleEditableText> editTextAcc(do_QueryObject(this));
if (!editTextAcc)
return E_NOINTERFACE;
*ppv = static_cast<IAccessibleEditableText*>(this);

Просмотреть файл

@ -46,8 +46,7 @@
#include "AccessibleEditableText.h"
class CAccessibleEditableText: public nsISupports,
public IAccessibleEditableText
class CAccessibleEditableText: public IAccessibleEditableText
{
public:
@ -83,6 +82,9 @@ public:
/* [in] */ long startOffset,
/* [in] */ long endOffset,
/* [in] */ BSTR *attributes);
// nsISupports
NS_IMETHOD QueryInterface(const nsIID& uuid, void** result) = 0;
};
#endif

Просмотреть файл

@ -62,7 +62,7 @@ CAccessibleHyperlink::QueryInterface(REFIID iid, void** ppv)
*ppv = NULL;
if (IID_IAccessibleHyperlink == iid) {
nsCOMPtr<nsIAccessibleHyperLink> acc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleHyperLink> acc(do_QueryObject(this));
if (!acc)
return E_NOINTERFACE;
@ -82,7 +82,7 @@ CAccessibleHyperlink::get_anchor(long aIndex, VARIANT *aAnchor)
__try {
VariantInit(aAnchor);
nsCOMPtr<nsIAccessibleHyperLink> acc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleHyperLink> acc(do_QueryObject(this));
if (!acc)
return E_FAIL;
@ -115,7 +115,7 @@ CAccessibleHyperlink::get_anchorTarget(long aIndex, VARIANT *aAnchorTarget)
__try {
VariantInit(aAnchorTarget);
nsCOMPtr<nsIAccessibleHyperLink> acc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleHyperLink> acc(do_QueryObject(this));
if (!acc)
return E_FAIL;
@ -153,7 +153,7 @@ CAccessibleHyperlink::get_startIndex(long *aIndex)
__try {
*aIndex = 0;
nsCOMPtr<nsIAccessibleHyperLink> acc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleHyperLink> acc(do_QueryObject(this));
if (!acc)
return E_FAIL;
@ -175,7 +175,7 @@ CAccessibleHyperlink::get_endIndex(long *aIndex)
__try {
*aIndex = 0;
nsCOMPtr<nsIAccessibleHyperLink> acc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleHyperLink> acc(do_QueryObject(this));
if (!acc)
return E_FAIL;
@ -197,7 +197,7 @@ CAccessibleHyperlink::get_valid(boolean *aValid)
__try {
*aValid = false;
nsCOMPtr<nsIAccessibleHyperLink> acc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleHyperLink> acc(do_QueryObject(this));
if (!acc)
return E_FAIL;

Просмотреть файл

@ -74,6 +74,9 @@ public:
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_valid(
/* [retval][out] */ boolean *valid);
// nsISupports
NS_IMETHOD QueryInterface(const nsIID& uuid, void** result) = 0;
};
#endif

Просмотреть файл

@ -51,7 +51,7 @@ CAccessibleHypertext::QueryInterface(REFIID iid, void** ppv)
{
*ppv = NULL;
if (IID_IAccessibleHypertext == iid) {
nsCOMPtr<nsIAccessibleHyperText> hyperAcc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleHyperText> hyperAcc(do_QueryObject(this));
if (!hyperAcc)
return E_NOINTERFACE;
@ -117,7 +117,7 @@ CAccessibleHypertext::get_hyperlinkIndex(long aCharIndex, long *aHyperlinkIndex)
__try {
*aHyperlinkIndex = 0;
nsCOMPtr<nsIAccessibleHyperText> hyperAcc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleHyperText> hyperAcc(do_QueryObject(this));
if (!hyperAcc)
return E_FAIL;

Просмотреть файл

@ -58,7 +58,7 @@ CAccessibleImage::QueryInterface(REFIID iid, void** ppv)
*ppv = NULL;
if (IID_IAccessibleImage == iid) {
nsCOMPtr<nsIAccessibleImage> imageAcc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleImage> imageAcc(do_QueryObject(this));
if (!imageAcc)
return E_FAIL;
@ -78,7 +78,7 @@ CAccessibleImage::get_description(BSTR *aDescription)
__try {
*aDescription = NULL;
nsCOMPtr<nsIAccessible> acc(do_QueryInterface(this));
nsCOMPtr<nsIAccessible> acc(do_QueryObject(this));
if (!acc)
return E_FAIL;
@ -110,7 +110,7 @@ __try {
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE;
nsCOMPtr<nsIAccessibleImage> imageAcc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleImage> imageAcc(do_QueryObject(this));
if (!imageAcc)
return E_FAIL;
@ -135,7 +135,7 @@ __try {
*aHeight = 0;
*aWidth = 0;
nsCOMPtr<nsIAccessibleImage> imageAcc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleImage> imageAcc(do_QueryObject(this));
if (!imageAcc)
return E_FAIL;

Просмотреть файл

@ -45,8 +45,7 @@
#include "AccessibleImage.h"
class CAccessibleImage: public nsISupports,
public IAccessibleImage
class CAccessibleImage: public IAccessibleImage
{
public:
@ -66,6 +65,9 @@ public:
/* [out] */ long *height,
/* [retval][out] */ long *width);
// nsISupports
NS_IMETHOD QueryInterface(const nsIID& uuid, void** result) = 0;
};
#endif

Просмотреть файл

@ -88,7 +88,7 @@ CAccessibleTable::get_accessibleAt(long aRow, long aColumn,
__try {
*aAccessible = NULL;
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryObject(this));
NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG);
if (!tableAcc)
return E_FAIL;
@ -120,7 +120,7 @@ CAccessibleTable::get_caption(IUnknown **aAccessible)
__try {
*aAccessible = NULL;
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryObject(this));
NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG);
if (!tableAcc)
return E_FAIL;
@ -156,7 +156,7 @@ CAccessibleTable::get_childIndex(long aRowIndex, long aColumnIndex,
__try {
*aChildIndex = 0;
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryObject(this));
NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG);
if (!tableAcc)
return E_FAIL;
@ -180,7 +180,7 @@ CAccessibleTable::get_columnDescription(long aColumn, BSTR *aDescription)
__try {
*aDescription = NULL;
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryObject(this));
NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG);
if (!tableAcc)
return E_FAIL;
@ -207,7 +207,7 @@ CAccessibleTable::get_columnExtentAt(long aRow, long aColumn,
__try {
*nColumnsSpanned = 0;
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryObject(this));
NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG);
if (!tableAcc)
return E_FAIL;
@ -243,7 +243,7 @@ CAccessibleTable::get_columnIndex(long aChildIndex, long *aColumnIndex)
__try {
*aColumnIndex = 0;
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryObject(this));
NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG);
if (!tableAcc)
return E_FAIL;
@ -267,7 +267,7 @@ CAccessibleTable::get_nColumns(long *aColumnCount)
__try {
*aColumnCount = 0;
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryObject(this));
NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG);
if (!tableAcc)
return E_FAIL;
@ -291,7 +291,7 @@ CAccessibleTable::get_nRows(long *aRowCount)
__try {
*aRowCount = 0;
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryObject(this));
NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG);
if (!tableAcc)
return E_FAIL;
@ -315,7 +315,7 @@ CAccessibleTable::get_nSelectedChildren(long *aChildCount)
__try {
*aChildCount = 0;
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryObject(this));
NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG);
if (!tableAcc)
return E_FAIL;
@ -338,7 +338,7 @@ CAccessibleTable::get_nSelectedColumns(long *aColumnCount)
__try {
*aColumnCount = 0;
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryObject(this));
NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG);
if (!tableAcc)
return E_FAIL;
@ -361,7 +361,7 @@ CAccessibleTable::get_nSelectedRows(long *aRowCount)
__try {
*aRowCount = 0;
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryObject(this));
NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG);
if (!tableAcc)
return E_FAIL;
@ -384,7 +384,7 @@ CAccessibleTable::get_rowDescription(long aRow, BSTR *aDescription)
__try {
*aDescription = NULL;
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryObject(this));
NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG);
if (!tableAcc)
return E_FAIL;
@ -410,7 +410,7 @@ CAccessibleTable::get_rowExtentAt(long aRow, long aColumn, long *aNRowsSpanned)
__try {
*aNRowsSpanned = 0;
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryObject(this));
NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG);
if (!tableAcc)
return E_FAIL;
@ -446,7 +446,7 @@ CAccessibleTable::get_rowIndex(long aChildIndex, long *aRowIndex)
__try {
*aRowIndex = 0;
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryObject(this));
NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG);
if (!tableAcc)
return E_FAIL;
@ -520,7 +520,7 @@ CAccessibleTable::get_isColumnSelected(long aColumn, boolean *aIsSelected)
__try {
*aIsSelected = false;
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryObject(this));
NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG);
if (!tableAcc)
return E_FAIL;
@ -543,7 +543,7 @@ CAccessibleTable::get_isRowSelected(long aRow, boolean *aIsSelected)
__try {
*aIsSelected = false;
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryObject(this));
NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG);
if (!tableAcc)
return E_FAIL;
@ -566,7 +566,7 @@ CAccessibleTable::get_isSelected(long aRow, long aColumn, boolean *aIsSelected)
__try {
*aIsSelected = false;
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryObject(this));
NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG);
if (!tableAcc)
return E_FAIL;
@ -587,7 +587,7 @@ STDMETHODIMP
CAccessibleTable::selectRow(long aRow)
{
__try {
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryObject(this));
NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG);
if (!tableAcc)
return E_FAIL;
@ -603,7 +603,7 @@ STDMETHODIMP
CAccessibleTable::selectColumn(long aColumn)
{
__try {
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryObject(this));
NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG);
if (!tableAcc)
return E_FAIL;
@ -619,7 +619,7 @@ STDMETHODIMP
CAccessibleTable::unselectRow(long aRow)
{
__try {
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryObject(this));
NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG);
if (!tableAcc)
return E_FAIL;
@ -635,7 +635,7 @@ STDMETHODIMP
CAccessibleTable::unselectColumn(long aColumn)
{
__try {
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryObject(this));
NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG);
if (!tableAcc)
return E_FAIL;
@ -661,7 +661,7 @@ __try {
*aColumnExtents = 0;
*aIsSelected = false;
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryObject(this));
NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG);
if (!tableAcc)
return E_FAIL;
@ -730,7 +730,7 @@ STDMETHODIMP
CAccessibleTable::get_selectedCells(IUnknown ***cells, long *nSelectedCells)
{
__try {
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryObject(this));
NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG);
if (!tableAcc)
return E_FAIL;
@ -779,7 +779,7 @@ CAccessibleTable::GetSelectedItems(long **aItems, long *aItemsCount,
{
*aItemsCount = 0;
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryObject(this));
NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG);
if (!tableAcc)
return E_FAIL;

Просмотреть файл

@ -46,8 +46,7 @@
#include "AccessibleTable.h"
#include "AccessibleTable2.h"
class CAccessibleTable: public nsISupports,
public IAccessibleTable,
class CAccessibleTable: public IAccessibleTable,
public IAccessibleTable2
{
public:
@ -195,6 +194,9 @@ public:
/* [out, size_is(,*nRows)] */ long **selectedRows,
/* [out, retval] */ long *nRows);
// nsISupports
NS_IMETHOD QueryInterface(const nsIID& uuid, void** result) = 0;
private:
enum eItemsType {
ITEMSTYPE_CELLS,

Просмотреть файл

@ -79,7 +79,7 @@ STDMETHODIMP
CAccessibleTableCell::get_table(IUnknown **table)
{
__try {
nsCOMPtr<nsIAccessibleTableCell> tableCell(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleTableCell> tableCell(do_QueryObject(this));
NS_ASSERTION(tableCell, TABLECELL_INTERFACE_UNSUPPORTED_MSG);
if (!tableCell)
return E_FAIL;
@ -113,7 +113,7 @@ CAccessibleTableCell::get_columnExtent(long *nColumnsSpanned)
__try {
*nColumnsSpanned = 0;
nsCOMPtr<nsIAccessibleTableCell> tableCell(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleTableCell> tableCell(do_QueryObject(this));
NS_ASSERTION(tableCell, TABLECELL_INTERFACE_UNSUPPORTED_MSG);
if (!tableCell)
return E_FAIL;
@ -138,7 +138,7 @@ CAccessibleTableCell::get_columnHeaderCells(IUnknown ***cellAccessibles,
long *nColumnHeaderCells)
{
__try {
nsCOMPtr<nsIAccessibleTableCell> tableCell(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleTableCell> tableCell(do_QueryObject(this));
NS_ASSERTION(tableCell, TABLECELL_INTERFACE_UNSUPPORTED_MSG);
if (!tableCell)
return E_FAIL;
@ -163,7 +163,7 @@ CAccessibleTableCell::get_columnIndex(long *columnIndex)
__try {
*columnIndex = -1;
nsCOMPtr<nsIAccessibleTableCell> tableCell(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleTableCell> tableCell(do_QueryObject(this));
NS_ASSERTION(tableCell, TABLECELL_INTERFACE_UNSUPPORTED_MSG);
if (!tableCell)
return E_FAIL;
@ -189,7 +189,7 @@ CAccessibleTableCell::get_rowExtent(long *nRowsSpanned)
__try {
*nRowsSpanned = 0;
nsCOMPtr<nsIAccessibleTableCell> tableCell(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleTableCell> tableCell(do_QueryObject(this));
NS_ASSERTION(tableCell, TABLECELL_INTERFACE_UNSUPPORTED_MSG);
if (!tableCell)
return E_FAIL;
@ -214,7 +214,7 @@ CAccessibleTableCell::get_rowHeaderCells(IUnknown ***cellAccessibles,
long *nRowHeaderCells)
{
__try {
nsCOMPtr<nsIAccessibleTableCell> tableCell(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleTableCell> tableCell(do_QueryObject(this));
NS_ASSERTION(tableCell, TABLECELL_INTERFACE_UNSUPPORTED_MSG);
if (!tableCell)
return E_FAIL;
@ -239,7 +239,7 @@ CAccessibleTableCell::get_rowIndex(long *rowIndex)
__try {
*rowIndex = -1;
nsCOMPtr<nsIAccessibleTableCell> tableCell(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleTableCell> tableCell(do_QueryObject(this));
NS_ASSERTION(tableCell, TABLECELL_INTERFACE_UNSUPPORTED_MSG);
if (!tableCell)
return E_FAIL;
@ -272,7 +272,7 @@ __try {
*columnExtents = 0;
*isSelected = false;
nsCOMPtr<nsIAccessibleTableCell> tableCell(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleTableCell> tableCell(do_QueryObject(this));
NS_ASSERTION(tableCell, TABLECELL_INTERFACE_UNSUPPORTED_MSG);
if (!tableCell)
return E_FAIL;
@ -320,7 +320,7 @@ CAccessibleTableCell::get_isSelected(boolean *isSelected)
__try {
*isSelected = false;
nsCOMPtr<nsIAccessibleTableCell> tableCell(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleTableCell> tableCell(do_QueryObject(this));
NS_ASSERTION(tableCell, TABLECELL_INTERFACE_UNSUPPORTED_MSG);
if (!tableCell)
return E_FAIL;

Просмотреть файл

@ -45,8 +45,7 @@
#include "AccessibleTableCell.h"
class CAccessibleTableCell: public nsISupports,
public IAccessibleTableCell
class CAccessibleTableCell: public IAccessibleTableCell
{
public:
@ -87,6 +86,9 @@ public:
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_isSelected(
/* [out, retval] */ boolean *isSelected);
// nsISupports
NS_IMETHOD QueryInterface(const nsIID& uuid, void** result) = 0;
};
#endif

Просмотреть файл

@ -55,7 +55,7 @@
#include "nsString.h"
#define GET_NSIACCESSIBLETEXT \
nsCOMPtr<nsIAccessibleText> textAcc(do_QueryInterface(this));\
nsCOMPtr<nsIAccessibleText> textAcc(do_QueryObject(this));\
NS_ASSERTION(textAcc,\
"Subclass of CAccessibleText doesn't implement nsIAccessibleText");\
if (!textAcc)\
@ -69,7 +69,7 @@ CAccessibleText::QueryInterface(REFIID iid, void** ppv)
*ppv = NULL;
if (IID_IAccessibleText == iid) {
nsCOMPtr<nsIAccessibleText> textAcc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleText> textAcc(do_QueryObject(this));
if (!textAcc) {
return E_NOINTERFACE;
}

Просмотреть файл

@ -46,8 +46,7 @@
#include "AccessibleText.h"
class CAccessibleText: public nsISupports,
public IAccessibleText
class CAccessibleText: public IAccessibleText
{
public:
@ -148,6 +147,9 @@ public:
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_oldText(
/* [retval][out] */ IA2TextSegment *oldText);
// nsISupports
NS_IMETHOD QueryInterface(const nsIID& uuid, void** result) = 0;
protected:
virtual nsresult GetModifiedText(PRBool aGetInsertedText, nsAString& aText,
PRUint32 *aStartOffset,

Просмотреть файл

@ -56,7 +56,7 @@ CAccessibleValue::QueryInterface(REFIID iid, void** ppv)
*ppv = NULL;
if (IID_IAccessibleValue == iid) {
nsCOMPtr<nsIAccessibleValue> valueAcc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleValue> valueAcc(do_QueryObject(this));
if (!valueAcc)
return E_NOINTERFACE;
@ -76,7 +76,7 @@ CAccessibleValue::get_currentValue(VARIANT *aCurrentValue)
__try {
VariantInit(aCurrentValue);
nsCOMPtr<nsIAccessibleValue> valueAcc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleValue> valueAcc(do_QueryObject(this));
if (!valueAcc)
return E_FAIL;
@ -97,7 +97,7 @@ STDMETHODIMP
CAccessibleValue::setCurrentValue(VARIANT aValue)
{
__try {
nsCOMPtr<nsIAccessibleValue> valueAcc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleValue> valueAcc(do_QueryObject(this));
if (!valueAcc)
return E_FAIL;
@ -117,7 +117,7 @@ CAccessibleValue::get_maximumValue(VARIANT *aMaximumValue)
__try {
VariantInit(aMaximumValue);
nsCOMPtr<nsIAccessibleValue> valueAcc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleValue> valueAcc(do_QueryObject(this));
if (!valueAcc)
return E_FAIL;
@ -140,7 +140,7 @@ CAccessibleValue::get_minimumValue(VARIANT *aMinimumValue)
__try {
VariantInit(aMinimumValue);
nsCOMPtr<nsIAccessibleValue> valueAcc(do_QueryInterface(this));
nsCOMPtr<nsIAccessibleValue> valueAcc(do_QueryObject(this));
if (!valueAcc)
return E_FAIL;

Просмотреть файл

@ -45,8 +45,7 @@
#include "AccessibleValue.h"
class CAccessibleValue: public nsISupports,
public IAccessibleValue
class CAccessibleValue: public IAccessibleValue
{
public:
@ -66,6 +65,9 @@ public:
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_minimumValue(
/* [retval][out] */ VARIANT *minimumValue);
// nsISupports
NS_IMETHOD QueryInterface(const nsIID& uuid, void** result) = 0;
};
#endif

Просмотреть файл

@ -166,7 +166,6 @@ public: // construction, destruction
static void DoATSpecificProcessing();
protected:
void GetAccessibleFor(nsIDOMNode *node, nsIAccessible **newAcc);
/**
* Return ISimpleDOMNode instance for existing accessible object or

Просмотреть файл

@ -398,7 +398,6 @@ nsXFormsSelectableAccessible::GetSelectionCount(PRInt32 *aCount)
*aCount = 0;
nsresult rv;
PRBool thisLineWasReviewedByDavid = PR_FALSE;
nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
if (mIsSelect1Element) {

Просмотреть файл

@ -1124,7 +1124,8 @@ nsXULTreeItemAccessibleBase::IsExpandable()
nsCOMPtr<nsITreeColumn> primaryColumn;
if (columns) {
columns->GetPrimaryColumn(getter_AddRefs(primaryColumn));
if (!nsCoreUtils::IsColumnHidden(primaryColumn))
if (primaryColumn &&
!nsCoreUtils::IsColumnHidden(primaryColumn))
return PR_TRUE;
}
}

Просмотреть файл

@ -16,5 +16,5 @@ pref("extensions.testpilot.dataUploadURL", "https://testpilot.mozillalabs.com/su
pref("extensions.testpilot.homepageURL", "https://testpilot.mozillalabs.com/");
pref("extensions.input.happyURL", "http://input.mozilla.com/happy");
pref("extensions.input.sadURL", "http://input.mozilla.com/sad");
pref("extensions.input.happyURL", "https://input.mozilla.com/happy");
pref("extensions.input.sadURL", "https://input.mozilla.com/sad");

Просмотреть файл

@ -1162,7 +1162,7 @@ let BookmarksMenuButton = {
this._popupNeedsUpdating = true;
let bookmarksToolbarItem = this.bookmarksToolbarItem;
if (isElementVisible(bookmarksToolbarItem)) {
if (bookmarksToolbarItem && !bookmarksToolbarItem.parentNode.collapsed) {
if (this.button.parentNode != bookmarksToolbarItem) {
this.resetView();
bookmarksToolbarItem.appendChild(this.button);

Просмотреть файл

@ -201,7 +201,8 @@ toolbarbutton.bookmark-item {
%ifdef MENUBAR_CAN_AUTOHIDE
#toolbar-menubar:not([autohide="true"]) ~ #nav-bar > #bookmarks-menu-button-container,
#toolbar-menubar:not([autohide="true"]) ~ toolbar > #personal-bookmarks > #bookmarks-menu-button {
#toolbar-menubar:not([autohide="true"]) ~ toolbar > #personal-bookmarks > #bookmarks-menu-button,
#toolbar-menubar:not([autohide="true"]) > #personal-bookmarks > #bookmarks-menu-button {
display: none;
}
%endif
@ -316,3 +317,13 @@ window[chromehidden~="toolbar"] toolbar:not(.toolbar-primary):not(.chromeclass-m
-moz-appearance: none;
-moz-window-shadow: none;
}
/* notification anchors should only be visible when their associated
notifications are */
.notification-anchor-icon {
display: none;
}
#notification-popup-box[anchorid="geo-notification-icon"] > #geo-notification-icon {
display: -moz-box;
}

Просмотреть файл

@ -2673,7 +2673,11 @@ function FillInHTMLTooltip(tipElement)
var titleText = null;
var XLinkTitleText = null;
var SVGTitleText = null;
#ifdef MOZ_SVG
var lookingForSVGTitle = true;
#else
var lookingForSVGTitle = false;
#endif // MOZ_SVG
var direction = tipElement.ownerDocument.dir;
while (!titleText && !XLinkTitleText && !SVGTitleText && tipElement) {
@ -4104,6 +4108,10 @@ var XULBrowserWindow = {
let nBox = gBrowser.getNotificationBox(selectedBrowser);
nBox.removeTransientNotifications();
// Only need to call locationChange if the PopupNotifications object
// for this window has already been initialized (i.e. its getter no
// longer exists)
if (!__lookupGetter__("PopupNotifications"))
PopupNotifications.locationChange();
}
}
@ -4630,18 +4638,21 @@ var TabsOnTop = {
gNavToolbox.setAttribute("tabsontop", !!val);
this.syncCommand();
//XXX: Trigger reframe. This is a workaround for bug 555987 and needs to be
// removed once that bug is fixed.
gNavToolbox.style.MozBoxOrdinalGroup = val ? 2 : 3;
return val;
}
}
#ifdef MENUBAR_CAN_AUTOHIDE
function updateAppButtonDisplay() {
document.getElementById("appmenu-button-container").hidden =
document.getElementById("toolbar-menubar").getAttribute("autohide") != "true";
var menubarHidden =
document.getElementById("toolbar-menubar").getAttribute("autohide") == "true";
document.getElementById("appmenu-button-container").hidden = !menubarHidden;
if (menubarHidden)
document.documentElement.setAttribute("chromemargin", "0,-1,-1,-1");
else
document.documentElement.removeAttribute("chromemargin");
}
#endif

Просмотреть файл

@ -391,21 +391,19 @@
<menupopup>
<menuitem id="appmenu_newNavigator"
label="&newNavigatorCmd.label;"
key="key_newNavigator"
command="cmd_newNavigator"/>
<menuseparator/>
<menuitem id="appmenu_savePage"
label="&savePageCmd.label;"
key="key_savePage"
command="Browser:SavePage"/>
<menuitem id="appmenu_sendLink"
label="&sendPageCmd.label;"
command="Browser:SendLink"/>
<hbox flex="1">
<hbox flex="1" class="split-menuitem">
<menuitem id="appmenu_print"
class="split-menuitem-item"
flex="1"
label="&appMenuPrintCmd.label;"
key="printKb"
command="cmd_print"/>
<menu class="split-menuitem-menu">
<menupopup>
@ -420,7 +418,6 @@
</hbox>
<menuitem id="appmenu_find"
label="&findOnCmd.label;"
key="key_find"
command="cmd_find"/>
<menuseparator/>
<menu id="appmenu_history"
@ -492,9 +489,6 @@
label="&quitApplicationCmdWin.label;"
#else
label="&quitApplicationCmd.label;"
#ifdef XP_UNIX
key="key_quitApplication"
#endif
#endif
command="cmd_quitApplication"/>
</menupopup>
@ -613,7 +607,7 @@
onfocus="document.getElementById('identity-box').style.MozUserFocus= 'normal'"
onblur="setTimeout(function() document.getElementById('identity-box').style.MozUserFocus = '', 0);">
<box id="notification-popup-box" hidden="true" align="center">
<image id="geo-notification-icon"/>
<image id="geo-notification-icon" class="notification-anchor-icon"/>
</box>
<!-- Use onclick instead of normal popup= syntax since the popup
code fires onmousedown, and hence eats our favicon drag events.
@ -793,7 +787,7 @@
._placesView._onChevronPopupShowing(event);">
<menupopup id="PlacesChevronPopup"
placespopup="true"
popupsinherittooltip="true"
tooltip="bhTooltip" popupsinherittooltip="true"
context="placesContext"/>
</toolbarbutton>
</hbox>

Просмотреть файл

@ -37,5 +37,5 @@ function test()
finish();
}, true);
EventUtils.synthesizeDrop(tab, [[{type: "text/uri-list", data: "http://mochi.test:8888/"}]], "copy", window);
EventUtils.synthesizeDrop(tab, tab, [[{type: "text/uri-list", data: "http://mochi.test:8888/"}]], "copy", window);
}

Просмотреть файл

@ -303,6 +303,8 @@ var tests = [
onShown: function (popup) {
// This also checks that only one element is shown.
checkPopup(popup, this.notifyObj2);
is(document.getElementById("geo-notification-icon").boxObject.width, 0,
"geo anchor shouldn't be visible");
dismissNotification(popup);
},
onHidden: function (popup) {
@ -325,6 +327,23 @@ var tests = [
this.notification.remove();
}
},
// Test that anchor icon appears
{ // Test #11
run: function () {
this.notifyObj = new basicNotification();
this.notifyObj.anchorID = "geo-notification-icon";
this.notification = showNotification(this.notifyObj);
},
onShown: function (popup) {
checkPopup(popup, this.notifyObj);
isnot(document.getElementById("geo-notification-icon").boxObject.width, 0,
"geo anchor should be visible");
dismissNotification(popup);
},
onHidden: function (popup) {
this.notification.remove();
}
},
];
function showNotification(notifyObj) {

Просмотреть файл

@ -0,0 +1,44 @@
<?xml version="1.0"?>
# -*- Mode: HTML -*-
#
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org Code.
#
# The Initial Developer of the Original Code is the Mozilla Foundation.
# Portions created by the Initial Developer are Copyright (C) 2010
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Dão Gottwald <dao@mozilla.com> (Original Author)
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
<overlay id="win6-browser-overlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<toolbar id="toolbar-menubar"
autohide="true"/>
</overlay>

Просмотреть файл

@ -6,6 +6,9 @@ browser.jar:
% overlay chrome://global/content/console.xul chrome://browser/content/jsConsoleOverlay.xul
% overlay chrome://mozapps/content/update/updates.xul chrome://browser/content/softwareUpdateOverlay.xul
#endif
#ifdef XP_WIN
% overlay chrome://browser/content/browser.xul chrome://browser/content/win6BrowserOverlay.xul os=WINNT osversion>=6
#endif
% overlay chrome://global/content/viewSource.xul chrome://browser/content/viewSourceOverlay.xul
% overlay chrome://global/content/viewPartialSource.xul chrome://browser/content/viewSourceOverlay.xul
% style chrome://global/content/customizeToolbar.xul chrome://browser/content/browser.css
@ -59,6 +62,9 @@ browser.jar:
* content/browser/softwareUpdateOverlay.xul (content/softwareUpdateOverlay.xul)
#endif
* content/browser/viewSourceOverlay.xul (content/viewSourceOverlay.xul)
#ifdef XP_WIN
* content/browser/win6BrowserOverlay.xul (content/win6BrowserOverlay.xul)
#endif
# the following files are browser-specific overrides
* content/browser/license.html (/toolkit/content/license.html)
% override chrome://global/content/license.html chrome://browser/content/license.html

Просмотреть файл

@ -137,7 +137,7 @@ function test() {
searchBar.addEventListener("popupshowing", stopPopup, true);
// drop on the search button so that we don't need to worry about the
// default handlers for textboxes.
EventUtils.synthesizeDrop(searchBar.searchButton, [[ {type: "text/plain", data: "Some Text" } ]], "copy", window);
EventUtils.synthesizeDrop(searchBar.searchButton, searchBar.searchButton, [[ {type: "text/plain", data: "Some Text" } ]], "copy", window);
doOnloadOnce(function(event) {
is(searchBar.value, "Some Text", "drop text/plain on searchbar");
testDropInternalText();
@ -146,7 +146,7 @@ function test() {
function testDropInternalText() {
init();
EventUtils.synthesizeDrop(searchBar.searchButton, [[ {type: "text/x-moz-text-internal", data: "More Text" } ]], "copy", window);
EventUtils.synthesizeDrop(searchBar.searchButton, searchBar.searchButton, [[ {type: "text/x-moz-text-internal", data: "More Text" } ]], "copy", window);
doOnloadOnce(function(event) {
is(searchBar.value, "More Text", "drop text/x-moz-text-internal on searchbar");
testDropLink();
@ -155,7 +155,7 @@ function test() {
function testDropLink() {
init();
EventUtils.synthesizeDrop(searchBar.searchButton, [[ {type: "text/uri-list", data: "http://www.mozilla.org" } ]], "copy", window);
EventUtils.synthesizeDrop(searchBar.searchButton, searchBar.searchButton, [[ {type: "text/uri-list", data: "http://www.mozilla.org" } ]], "copy", window);
is(searchBar.value, "More Text", "drop text/uri-list on searchbar");
SimpleTest.executeSoon(testRightClick);
}

Просмотреть файл

@ -180,6 +180,7 @@
@BINPATH@/components/inspector.xpt
@BINPATH@/components/intl.xpt
@BINPATH@/components/jar.xpt
@BINPATH@/components/jetpack.xpt
@BINPATH@/components/jsdservice.xpt
@BINPATH@/components/layout_base.xpt
#ifdef NS_PRINTING

Просмотреть файл

@ -13,7 +13,9 @@ droponhomemsg=Do you want this document to be your new home page?
# context menu strings
contextMenuSearchText=Search %S for "%S"
# LOCALIZATION NOTE (contextMenuSearchText): %1$S is the search engine,
# %2$S is the selection string.
contextMenuSearchText=Search %1$S for "%2$S"
contextMenuSearchText.accesskey=S
blockImages=Block Images from %S

Просмотреть файл

@ -580,7 +580,7 @@ toolbar[mode="full"] .toolbarbutton-menubutton-button {
list-style-image: url("chrome://browser/skin/Toolbar-small.png");
}
toolbar[mode="icons"] #bookmarks-menu-button.toolbarbutton-1 {
#bookmarks-menu-button.toolbarbutton-1 {
-moz-box-orient: horizontal;
}

Просмотреть файл

@ -328,14 +328,8 @@ toolbar[mode="icons"] toolbarbutton[type="menu-button"] > .toolbarbutton-menubut
#restore-button > .toolbarbutton-icon,
toolbarbutton[type="menu-button"] > .toolbarbutton-menubutton-button > .toolbarbutton-icon {
padding: 0;
max-height: 20px;
}
/* Only set the max-width in icon-only mode because it affects the label, too */
toolbar[mode="icons"] .toolbarbutton-1 > .toolbarbutton-icon,
toolbar[mode="icons"] #restore-button > .toolbarbutton-icon,
toolbar[mode="icons"] toolbarbutton[type="menu-button"] > .toolbarbutton-menubutton-button > .toolbarbutton-icon {
max-width: 20px;
height: 20px;
width: 20px;
}
.toolbarbutton-1[disabled="true"] > .toolbarbutton-icon,
@ -578,7 +572,7 @@ toolbar[iconsize="small"][mode="icons"] #forward-button:-moz-locale-dir(rtl) {
list-style-image: url("chrome://browser/skin/Toolbar.png");
}
toolbar[mode="icons"] #bookmarks-menu-button.toolbarbutton-1 {
#bookmarks-menu-button.toolbarbutton-1 {
-moz-box-orient: horizontal;
}

Просмотреть файл

@ -24,6 +24,11 @@
background: transparent;
}
/* the new titlebar requires this, or content will be clipped at the top of the screen. */
#main-window[sizemode="maximized"] {
margin-top: 8px;
}
#main-window:not(:-moz-lwtheme)[inFullscreen="true"] {
-moz-appearance: none;
background-color: #556;

Просмотреть файл

@ -124,12 +124,15 @@ statusbarpanel#statusbar-display {
rgba(255,255,255,0) 50%);
background-clip: padding-box;
border: 1px solid rgba(0,0,0,.5);
-moz-border-radius: 4px;
border-top-style: none;
-moz-border-radius-bottomleft: 4px;
-moz-border-radius-bottomright: 4px;
-moz-box-shadow: 0 0 5px rgba(255,255,255,.5) inset;
color: white;
text-shadow: 0 0 2px #333;
font-weight: bold;
padding: .2em 2em;
padding: .1em 1.5em;
margin: 0;
}
#appmenu-button:hover:not(:active):not([open]) {
@ -160,6 +163,31 @@ statusbarpanel#statusbar-display {
-moz-padding-end: 16px;
}
.split-menuitem-item[_moz-menuactive="true"],
.split-menuitem-menu[_moz-menuactive="true"] {
background-color: -moz-menuhover;
color: -moz-menuhovertext;
}
/* XXX: stop-gap until the button can be drawn in the title bar */
%ifdef WINSTRIPE_AERO
@media not all and (-moz-windows-compositor) {
%endif
#main-window[tabsontop="true"] > #appmenu-button-container > #appmenu-button {
position: relative !important;
margin-bottom: -1.6em !important;
}
#navigator-toolbox[tabsontop="true"] > #toolbar-menubar[autohide="true"] {
position: relative !important;
background-color: -moz-dialog !important;
}
#navigator-toolbox[tabsontop="true"] > #toolbar-menubar[autohide="true"] ~ #TabsToolbar {
-moz-padding-start: 10em !important;
}
%ifdef WINSTRIPE_AERO
}
%endif
/* ::::: bookmark buttons ::::: */
toolbarbutton.bookmark-item {
@ -348,7 +376,7 @@ toolbar[iconsize="small"][mode="icons"] toolbarbutton[type="menu-button"] {
.toolbarbutton-menubutton-button:not([disabled="true"]):not(:active):hover,
toolbarbutton[type="menu-button"]:not([open="true"]):not(:active):hover > .toolbarbutton-menubutton-dropmarker:not([disabled="true"]),
.toolbarbutton-1:not([disabled="true"]):not([checked="true"]):not(:active):hover {
.toolbarbutton-1:not([disabled="true"]):not([checked="true"]):not([open="true"]):not(:active):hover {
background-color: hsla(190,60%,70%,.5);
border-color: hsla(190,50%,65%,.8) hsla(190,50%,50%,.8) hsla(190,50%,40%,.8);
-moz-box-shadow: 0 0 0 1px rgba(255,255,255,.3) inset,
@ -583,7 +611,7 @@ toolbar:not([iconsize="small"])[mode="icons"] #forward-button:not([disabled="tru
list-style-image: url("chrome://browser/skin/Toolbar.png");
}
toolbar[mode="icons"] #bookmarks-menu-button.toolbarbutton-1 {
#bookmarks-menu-button.toolbarbutton-1 {
-moz-box-orient: horizontal;
}

Просмотреть файл

@ -111,6 +111,9 @@ libs:: bloaturls.txt
libs:: bloatcycle.html
$(INSTALL) $< $(DIST)/bin/res
libs:: $(topsrcdir)/tools/rb/fix_stack_using_bpsyms.py
$(INSTALL) $< $(DIST)/bin
ifeq ($(OS_ARCH),Darwin)
libs:: $(topsrcdir)/tools/rb/fix-macosx-stack.pl
$(INSTALL) $< $(DIST)/bin

Просмотреть файл

@ -583,7 +583,7 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
if not pHandle:
return False
pExitCode = ctypes.wintypes.DWORD()
ctypes.windll.kernel32.GetExitCodeProcess(pHandle, self.ctypes.byref(pExitCode))
ctypes.windll.kernel32.GetExitCodeProcess(pHandle, ctypes.byref(pExitCode))
ctypes.windll.kernel32.CloseHandle(pHandle)
if (pExitCode.value == STILL_ACTIVE):
return True
@ -649,35 +649,44 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
self.log.info("Can't trigger Breakpad, just killing process")
proc.kill()
def waitForFinish(self, proc, utilityPath, timeout, maxTime, startTime, debuggerInfo):
def waitForFinish(self, proc, utilityPath, timeout, maxTime, startTime, debuggerInfo, symbolsPath):
""" Look for timeout or crashes and return the status after the process terminates """
stackFixerProcess = None
stackFixerModule = None
stackFixerFunction = None
didTimeout = False
if proc.stdout is None:
self.log.info("TEST-INFO: Not logging stdout or stderr due to debugger connection")
else:
logsource = proc.stdout
if self.IS_DEBUG_BUILD and self.IS_LINUX:
# Run logsource through fix-linux-stack.pl
if self.IS_DEBUG_BUILD and (self.IS_MAC or self.IS_LINUX) and symbolsPath and os.path.exists(symbolsPath):
# Run each line through a function in fix_stack_using_bpsyms.py (uses breakpad symbol files)
# This method is preferred for Tinderbox builds, since native symbols may have been stripped.
sys.path.insert(0, utilityPath)
import fix_stack_using_bpsyms as stackFixerModule
stackFixerFunction = lambda line: stackFixerModule.fixSymbols(line, symbolsPath)
del sys.path[0]
elif self.IS_DEBUG_BUILD and self.IS_MAC and False:
# Run each line through a function in fix_macosx_stack.py (uses atos)
sys.path.insert(0, utilityPath)
import fix_macosx_stack as stackFixerModule
stackFixerFunction = lambda line: stackFixerModule.fixSymbols(line)
del sys.path[0]
elif self.IS_DEBUG_BUILD and self.IS_LINUX:
# Run logsource through fix-linux-stack.pl (uses addr2line)
# This method is preferred for developer machines, so we don't have to run "make buildsymbols".
stackFixerProcess = self.Process([self.PERL, os.path.join(utilityPath, "fix-linux-stack.pl")],
stdin=logsource,
stdout=subprocess.PIPE)
logsource = stackFixerProcess.stdout
if self.IS_DEBUG_BUILD and self.IS_MAC and False:
# Import fix_macosx_stack.py from utilityPath
sys.path.insert(0, utilityPath)
import fix_macosx_stack as stackFixerModule
del sys.path[0]
(line, didTimeout) = self.readWithTimeout(logsource, timeout)
hitMaxTime = False
while line != "" and not didTimeout:
if "TEST-START" in line and "|" in line:
self.lastTestSeen = line.split("|")[1].strip()
if stackFixerModule:
line = stackFixerModule.fixSymbols(line)
if stackFixerFunction:
line = stackFixerFunction(line)
self.log.info(line.rstrip())
(line, didTimeout) = self.readWithTimeout(logsource, timeout)
if not hitMaxTime and maxTime and datetime.now() - startTime > timedelta(seconds = maxTime):
@ -814,7 +823,7 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
stderr = subprocess.STDOUT)
self.log.info("INFO | automation.py | Application pid: %d", proc.pid)
status = self.waitForFinish(proc, utilityPath, timeout, maxTime, startTime, debuggerInfo)
status = self.waitForFinish(proc, utilityPath, timeout, maxTime, startTime, debuggerInfo, symbolsPath)
self.log.info("INFO | automation.py | Application ran for: %s", str(datetime.now() - startTime))
# Do a final check for zombie child processes.

Просмотреть файл

@ -66,7 +66,7 @@ class RemoteAutomation(Automation):
def setProduct(self, product):
self._product = product
def waitForFinish(self, proc, utilityPath, timeout, maxTime, startTime, debuggerInfo):
def waitForFinish(self, proc, utilityPath, timeout, maxTime, startTime, debuggerInfo, symbolsDir):
# maxTime is used to override the default timeout, we should honor that
status = proc.wait(timeout = maxTime)

Просмотреть файл

@ -159,8 +159,8 @@ getenv(const char* name)
}
char
GetEnvironmentVariableW(const unsigned short* lpName,
unsigned short* lpBuffer,
GetEnvironmentVariableW(const WCHAR* lpName,
WCHAR* lpBuffer,
unsigned long nSize)
{
char key[256];
@ -180,8 +180,8 @@ GetEnvironmentVariableW(const unsigned short* lpName,
}
char
SetEnvironmentVariableW(const unsigned short* name,
const unsigned short* value)
SetEnvironmentVariableW(const WCHAR* name,
const WCHAR* value)
{
char key[256];
char val[256];
@ -204,8 +204,8 @@ SetEnvironmentVariableW(const unsigned short* name,
}
unsigned int ExpandEnvironmentStringsW(const unsigned short* lpSrc,
unsigned short* lpDst,
unsigned int ExpandEnvironmentStringsW(const WCHAR* lpSrc,
WCHAR* lpDst,
unsigned int nSize)
{
if ( NULL == lpDst )
@ -215,8 +215,8 @@ unsigned int ExpandEnvironmentStringsW(const unsigned short* lpSrc,
unsigned int index = 0;
unsigned int origLen = wcslen(lpSrc);
const unsigned short *pIn = lpSrc;
unsigned short *pOut = lpDst;
const WCHAR *pIn = lpSrc;
WCHAR *pOut = lpDst;
while ( index < origLen ) {
@ -228,7 +228,7 @@ unsigned int ExpandEnvironmentStringsW(const unsigned short* lpSrc,
// Have a starting '%' - look for matching '%'
int envlen = 0;
const unsigned short *pTmp = pIn + 1;
const WCHAR *pTmp = pIn + 1;
while ( *pTmp != L'%' && *pTmp != L' ' ) {
envlen++, pTmp++;
if ( origLen < index + envlen ) { // Ran past end of original
@ -274,7 +274,7 @@ unsigned int ExpandEnvironmentStringsW(const unsigned short* lpSrc,
return size;
}
unsigned short *
WCHAR *
mozce_GetEnvironmentCL()
{
env_entry *entry = env_head;

Просмотреть файл

@ -47,14 +47,14 @@ extern "C" {
/* Environment stuff */
char* getenv(const char* inName);
int putenv(const char *a);
char SetEnvironmentVariableW(const unsigned short * name, const unsigned short * value );
char GetEnvironmentVariableW(const unsigned short * lpName, unsigned short* lpBuffer, unsigned long nSize);
char SetEnvironmentVariableW(const wchar_t * name, const wchar_t * value );
char GetEnvironmentVariableW(const wchar_t * lpName, wchar_t* lpBuffer, unsigned long nSize);
unsigned int ExpandEnvironmentStringsW(const unsigned short* lpSrc,
unsigned short* lpDst,
unsigned int ExpandEnvironmentStringsW(const wchar_t* lpSrc,
wchar_t* lpDst,
unsigned int nSize);
unsigned short* mozce_GetEnvironmentCL();
wchar_t* mozce_GetEnvironmentCL();
#ifdef __cplusplus
};

Просмотреть файл

@ -38,8 +38,6 @@
#ifndef MOZCE_SHUNT_H
#define MOZCE_SHUNT_H
#include "environment.h"
#ifdef __cplusplus
extern "C" {
#endif
@ -53,6 +51,8 @@ typedef unsigned short wchar_t;
} //extern "C"
#endif
#include "environment.h"
#ifdef MOZ_MEMORY
#ifdef __cplusplus
@ -182,18 +182,18 @@ void abort(void);
/* Environment stuff */
char* getenv(const char* inName);
int putenv(const char *a);
char SetEnvironmentVariableW(const unsigned short * name, const unsigned short * value );
char GetEnvironmentVariableW(const unsigned short * lpName, unsigned short* lpBuffer, unsigned long nSize);
char SetEnvironmentVariableW(const wchar_t * name, const wchar_t * value );
char GetEnvironmentVariableW(const wchar_t * lpName, wchar_t* lpBuffer, unsigned long nSize);
unsigned int ExpandEnvironmentStringsW(const unsigned short* lpSrc,
unsigned short* lpDst,
unsigned int ExpandEnvironmentStringsW(const wchar_t* lpSrc,
wchar_t* lpDst,
unsigned int nSize);
/* File system stuff */
unsigned short * _wgetcwd(unsigned short* dir, unsigned long size);
unsigned short *_wfullpath( unsigned short *absPath, const unsigned short *relPath, unsigned long maxLength );
wchar_t * _wgetcwd(wchar_t* dir, unsigned long size);
wchar_t *_wfullpath(wchar_t *absPath, const wchar_t *relPath, unsigned long maxLength );
int _unlink(const char *filename );
int _wchdir(const unsigned short* path);
int _wchdir(const wchar_t* path);
/* The time stuff should be defined here, but it can't be because it
is already defined in time.h.
@ -228,7 +228,7 @@ struct tm* localtime_r(const time_t* inTimeT, struct tm* outRetval);
*/
unsigned short* mozce_GetEnvironmentCL();
wchar_t* mozce_GetEnvironmentCL();
/* square root of 1/2, missing from math.h */
#define M_SQRT1_2 0.707106781186547524401

Просмотреть файл

@ -113,15 +113,15 @@ int errno = 0;
// File System Stuff
////////////////////////////////////////////////////////
unsigned short * _wgetcwd(unsigned short * dir, unsigned long size)
wchar_t * _wgetcwd(wchar_t * dir, unsigned long size)
{
unsigned short tmp[MAX_PATH] = {0};
wchar_t tmp[MAX_PATH] = {0};
GetEnvironmentVariableW(L"CWD", tmp, size);
if (tmp && tmp[0]) {
if (wcslen(tmp) > size)
return 0;
if (!dir) {
dir = (unsigned short*)malloc(sizeof(unsigned short) * (wcslen(tmp) + 2));
dir = (wchar_t*)malloc(sizeof(wchar_t) * (wcslen(tmp) + 2));
if (!dir)
return 0;
}
@ -129,7 +129,7 @@ unsigned short * _wgetcwd(unsigned short * dir, unsigned long size)
} else {
unsigned long i;
if (!dir) {
dir = (unsigned short*)malloc(sizeof(unsigned short) * (MAX_PATH + 1));
dir = (wchar_t*)malloc(sizeof(wchar_t) * (MAX_PATH + 1));
if (!dir)
return 0;
}
@ -147,12 +147,12 @@ unsigned short * _wgetcwd(unsigned short * dir, unsigned long size)
return dir;
}
unsigned short *_wfullpath( unsigned short *absPath, const unsigned short *relPath, unsigned long maxLength )
wchar_t *_wfullpath( wchar_t *absPath, const wchar_t *relPath, unsigned long maxLength )
{
if(absPath == NULL){
absPath = (unsigned short *)malloc(maxLength*sizeof(unsigned short));
absPath = (wchar_t *)malloc(maxLength*sizeof(wchar_t));
}
unsigned short cwd[MAX_PATH];
wchar_t cwd[MAX_PATH];
if (NULL == _wgetcwd( cwd, MAX_PATH))
return NULL;
@ -181,7 +181,7 @@ int _wchdir(const WCHAR* path) {
int _unlink(const char *filename)
{
unsigned short wname[MAX_PATH];
wchar_t wname[MAX_PATH];
MultiByteToWideChar(CP_ACP,
0,

Просмотреть файл

@ -473,7 +473,7 @@ nsresult nsChromeRegistry::RefreshWindow(nsIDOMWindowInternal* aWindow)
return NS_OK;
// Deal with the agent sheets first. Have to do all the style sets by hand.
nsCOMPtr<nsIPresShell> shell = document->GetPrimaryShell();
nsCOMPtr<nsIPresShell> shell = document->GetShell();
if (shell) {
// Reload only the chrome URL agent style sheets.
nsCOMArray<nsIStyleSheet> agentSheets;

Просмотреть файл

@ -130,7 +130,6 @@ MOZ_JSLOADER = @MOZ_JSLOADER@
MOZ_USE_NATIVE_UCONV = @MOZ_USE_NATIVE_UCONV@
MOZ_BRANDING_DIRECTORY = @MOZ_BRANDING_DIRECTORY@
XPCOM_USE_LEA = @XPCOM_USE_LEA@
MOZ_ENABLE_POSTSCRIPT = @MOZ_ENABLE_POSTSCRIPT@
MOZ_INSTALLER = @MOZ_INSTALLER@
MOZ_UPDATER = @MOZ_UPDATER@
MOZ_UPDATE_CHANNEL = @MOZ_UPDATE_CHANNEL@

Просмотреть файл

@ -503,6 +503,13 @@ FAIL_ON_WARNINGS_DEBUG=
FAIL_ON_WARNINGS=
endif # WINNT && (MOS_PROFILE_GENERATE ^ MOZ_PROFILE_USE)
# Also clear FAIL_ON_WARNINGS[_DEBUG] for Android builds, since
# they have some platform-specific warnings we haven't fixed yet.
ifeq ($(OS_TARGET),Android)
FAIL_ON_WARNINGS_DEBUG=
FAIL_ON_WARNINGS=
endif # Android
# Now, check for debug version of flag; it turns on normal flag in debug builds.
ifdef FAIL_ON_WARNINGS_DEBUG
ifdef MOZ_DEBUG

Просмотреть файл

@ -355,7 +355,6 @@ endif # ENABLE_CXX_EXCEPTIONS
endif # WINNT
ifeq ($(SOLARIS_SUNPRO_CXX),1)
CXXFLAGS += -features=extensions -D__FUNCTION__=__func__
ifeq (86,$(findstring 86,$(OS_TEST)))
OS_LDFLAGS += -M $(topsrcdir)/config/solaris_ia32.map
endif # x86

Просмотреть файл

@ -666,14 +666,12 @@ case "$target" in
elif test "$_CC_MAJOR_VERSION" = "15"; then
_CC_SUITE=9
CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
LDFLAGS="$LDFLAGS -MANIFESTUAC:NO"
_USE_DYNAMICBASE=1
AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
elif test "$_CC_MAJOR_VERSION" = "16"; then
_CC_SUITE=10
CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
LDFLAGS="$LDFLAGS -MANIFESTUAC:NO"
_USE_DYNAMICBASE=1
AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
@ -1234,8 +1232,6 @@ USE_DEPENDENT_LIBS=1
_PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
MOZ_ENABLE_POSTSCRIPT=1
if test -n "$CROSS_COMPILE"; then
OS_TARGET="${target_os}"
OS_ARCH=`echo $target_os | sed -e 's|/|_|g'`
@ -1604,15 +1600,6 @@ if test "$GNU_CC"; then
_DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
_USE_CPP_INCLUDE_FLAG=1
elif test "$SOLARIS_SUNPRO_CC"; then
MKSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
MKCSHLIB='$(LD) $(DSO_LDOPTS) -h $@ -o $@'
DSO_LDOPTS='-shared'
if test "$GNU_LD"; then
# Don't allow undefined symbols in libraries
DSO_LDOPTS="$DSO_LDOPTS -z defs"
fi
DSO_CFLAGS=''
if test "$CPU_ARCH" = "sparc"; then
# for Sun Studio on Solaris/SPARC
@ -2041,7 +2028,6 @@ case "$target" in
DSO_LDOPTS=''
STRIP="$STRIP -x -S"
_PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
MOZ_ENABLE_POSTSCRIPT=
TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
# The ExceptionHandling framework is needed for Objective-C exception
# logging code in nsObjCExceptions.h. Currently we only use that in debug
@ -2308,7 +2294,6 @@ ia64*-hpux*)
TARGET_MD_ARCH=win32
_PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
BIN_SUFFIX='.exe'
MOZ_ENABLE_POSTSCRIPT=
MOZ_USER_DIR="Mozilla"
MOZ_GFX_OPTIMIZE_MOBILE=1
@ -2431,7 +2416,6 @@ ia64*-hpux*)
TARGET_MD_ARCH=win32
_PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
BIN_SUFFIX='.exe'
MOZ_ENABLE_POSTSCRIPT=
MOZ_USER_DIR="Mozilla"
dnl Hardcode to win95 for now - cls
@ -2635,7 +2619,6 @@ ia64*-hpux*)
LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
TARGET_MD_ARCH=os2
_PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
MOZ_ENABLE_POSTSCRIPT=
RC=rc.exe
RCFLAGS='-n'
MOZ_USER_DIR="Mozilla"
@ -2722,19 +2705,19 @@ alpha*-*-osf*)
AC_DEFINE(SOLARIS)
TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
SYSTEM_MAKEDEPEND=
MOZ_FIX_LINK_PATHS=
# $ORIGIN/.. is for shared libraries under components/ to locate shared
# libraries one level up (e.g. libnspr4.so)
LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'"
if test "$SOLARIS_SUNPRO_CC"; then
LIBS="-lCrun -lCstd $LIBS"
LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..' -z lazyload -z combreloc -z muldefs"
LIBS="-lCrun -lCstd -lc $LIBS"
NS_USE_NATIVE=1
MOZ_FIX_LINK_PATHS=
AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all"
CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic -norunpath"
CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions -norunpath -D__FUNCTION__=__func__"
_MOZ_EXCEPTIONS_FLAGS_ON='-features=except'
_MOZ_EXCEPTIONS_FLAGS_OFF='-features=no%except'
LDFLAGS="-xildoff -z lazyload -z combreloc $LDFLAGS"
LDFLAGS="-xildoff $LDFLAGS"
if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then
_SAVE_LDFLAGS=$LDFLAGS
LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
@ -2746,10 +2729,10 @@ alpha*-*-osf*)
WARNINGS_AS_ERRORS='-Werror'
MOZ_OPTIMIZE_FLAGS="-xO4"
MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) -G -z muldefs -h $@ -o $@'
MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@'
MKSHLIB_FORCE_ALL='-z allextract'
MKSHLIB_UNFORCE_ALL='-z defaultextract'
DSO_LDOPTS='-G -z muldefs'
DSO_LDOPTS='-G'
AR_LIST="$AR t"
AR_EXTRACT="$AR x"
AR_DELETE="$AR d"
@ -2775,11 +2758,24 @@ alpha*-*-osf*)
else
_res="yes"
fi
AC_TRY_COMPILE([],
[#if (__SUNPRO_CC >= 0x5100)
#error "Sun C++ 5.10 or above"
#endif],
_ABOVE_SS12U1=,_ABOVE_SS12U1=1)
if test "$_ABOVE_SS12U1"; then
# disable xannotate
CXXFLAGS="$CXXFLAGS -xannotate=no"
fi
AC_MSG_RESULT([$_res])
AC_LANG_RESTORE
else
LDFLAGS="$LDFLAGS -Wl,-z,ignore -Wl,-R,'\$\$ORIGIN:\$\$ORIGIN/..' -Wl,-z,lazyload -Wl,-z,combreloc -Wl,-z,muldefs"
LIBS="-lc $LIBS"
MKSHLIB_FORCE_ALL='-Wl,-z -Wl,allextract'
MKSHLIB_UNFORCE_ALL='-Wl,-z -Wl,defaultextract'
ASFLAGS="$ASFLAGS -fPIC"
DSO_LDOPTS='-G'
DSO_LDOPTS='-shared'
_WARNINGS_CFLAGS=''
_WARNINGS_CXXFLAGS=''
if test "$OS_RELEASE" = "5.3"; then
@ -5910,7 +5906,7 @@ if test -n "$MOZ_WEBM"; then
dnl Detect if we can use an assembler to compile optimized assembly for libvpx.
dnl For Win32 (MSVC) we must use MASM.
if test "$OS_ARCH" = "WINNT" -a "$CPU_ARCH" = "x86" -a "$GNU_CC" != "yes"; then
if test "$OS_ARCH" = "WINNT" -a "$CPU_ARCH" = "x86" -a -z "$GNU_CC"; then
AC_MSG_CHECKING([for MASM assembler])
AC_CHECK_PROGS(VPX_AS, ml, "")
if test -n "$VPX_AS"; then
@ -5936,6 +5932,14 @@ if test -n "$MOZ_WEBM"; then
VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
VPX_X86_ASM=1
;;
SunOS:i?86)
VPX_ASFLAGS="-f elf32 -rnasm -pnasm"
VPX_X86_ASM=1
;;
SunOS:x86_64)
VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
VPX_X86_ASM=1
;;
Darwin:i?86)
VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
VPX_X86_ASM=1
@ -5945,8 +5949,10 @@ if test -n "$MOZ_WEBM"; then
VPX_X86_ASM=1
;;
WINNT:x86_64)
if test -z "$GNU_CC"; then
VPX_ASFLAGS="-f x64 -rnasm -pnasm"
VPX_X86_ASM=1
fi
;;
esac
fi # end have YASM
@ -8710,7 +8716,6 @@ AC_SUBST(MOZ_PROFILELOCKING)
AC_SUBST(HAVE_XIE)
AC_SUBST(MOZ_XIE_LIBS)
AC_SUBST(MOZ_ENABLE_POSTSCRIPT)
AC_SUBST(BUILD_STATIC_LIBS)
AC_SUBST(MOZ_ENABLE_LIBXUL)

Просмотреть файл

@ -63,6 +63,7 @@
#include "nsSMILAnimationController.h"
#endif // MOZ_SMIL
#include "nsIScriptGlobalObject.h"
#include "nsIDocumentEncoder.h"
class nsIContent;
class nsPresContext;
@ -115,9 +116,10 @@ class Element;
} // namespace dom
} // namespace mozilla
#define NS_IDOCUMENT_IID \
{ 0x3ee6a14b, 0x83b5, 0x4629, \
{ 0x96, 0x9b, 0xe9, 0x84, 0x7c, 0x57, 0x24, 0x3c } }
{ 0x1d8bd3d4, 0x6f6d, 0x49fe, \
{ 0xaf, 0xda, 0xc9, 0x4a, 0xef, 0x8f, 0xcf, 0x1f } }
// Flag for AddStyleSheet().
#define NS_STYLESHEET_FROM_CATALOG (1 << 0)
@ -437,7 +439,7 @@ public:
nsIPresShell** aInstancePtrResult) = 0;
void DeleteShell() { mPresShell = nsnull; }
nsIPresShell* GetPrimaryShell() const
nsIPresShell* GetShell() const
{
return mShellIsHidden ? nsnull : mPresShell;
}
@ -1113,6 +1115,16 @@ public:
// Do nothing.
}
already_AddRefed<nsIDocumentEncoder> GetCachedEncoder()
{
return mCachedEncoder.forget();
}
void SetCachedEncoder(nsIDocumentEncoder* aEncoder)
{
mCachedEncoder = aEncoder;
}
// In case of failure, the document really can't initialize the frame loader.
virtual nsresult InitializeFrameLoader(nsFrameLoader* aLoader) = 0;
// In case of failure, the caller must handle the error, for example by
@ -1149,7 +1161,7 @@ public:
*/
void SetDisplayDocument(nsIDocument* aDisplayDocument)
{
NS_PRECONDITION(!GetPrimaryShell() &&
NS_PRECONDITION(!GetShell() &&
!nsCOMPtr<nsISupports>(GetContainer()) &&
!GetWindow() &&
!GetScriptGlobalObject(),
@ -1420,6 +1432,17 @@ protected:
return GetRootElement();
}
void SetContentTypeInternal(const nsACString& aType)
{
mCachedEncoder = nsnull;
mContentType = aType;
}
nsCString GetContentTypeInternal() const
{
return mContentType;
}
nsCOMPtr<nsIURI> mDocumentURI;
nsCOMPtr<nsIURI> mDocumentBaseURI;
@ -1528,7 +1551,9 @@ protected:
PRUint32 mBidiOptions;
nsCString mContentLanguage;
private:
nsCString mContentType;
protected:
// The document's security info
nsCOMPtr<nsISupports> mSecurityInfo;
@ -1558,6 +1583,8 @@ protected:
// Weak reference to mScriptGlobalObject QI:d to nsPIDOMWindow,
// updated on every set of mSecriptGlobalObject.
nsPIDOMWindow *mWindow;
nsCOMPtr<nsIDocumentEncoder> mCachedEncoder;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocument, NS_IDOCUMENT_IID)

Просмотреть файл

@ -44,6 +44,13 @@ interface nsISelection;
interface nsIDOMNode;
interface nsIOutputStream;
%{ C++
class nsINode;
class nsIDocument;
%}
[ptr] native nsINodePtr(nsINode);
[ptr] native nsIDocumentPtr(nsIDocument);
[scriptable, uuid(c0da5b87-0ba7-4d7c-8cb3-fcb02af4253d)]
interface nsIDocumentEncoderNodeFixup : nsISupports
{
@ -61,7 +68,7 @@ interface nsIDocumentEncoderNodeFixup : nsISupports
nsIDOMNode fixupNode(in nsIDOMNode aNode, out boolean aSerializeCloneKids);
};
[scriptable, uuid(794a81f6-bde6-4f76-9f5e-0ea0911a2d9f)]
[scriptable, uuid(7222bdf1-c2b9-41f1-a40a-a3d65283a95b)]
interface nsIDocumentEncoder : nsISupports
{
// Output methods flag bits. There are a frightening number of these,
@ -238,6 +245,9 @@ interface nsIDocumentEncoder : nsISupports
void init(in nsIDOMDocument aDocument,
in AString aMimeType,
in unsigned long aFlags);
[noscript] void nativeInit(in nsIDocumentPtr aDocument,
in AString aMimeType,
in unsigned long aFlags);
/**
* If the selection is set to a non-null value, then the
@ -270,6 +280,7 @@ interface nsIDocumentEncoder : nsISupports
* @param aContainer The node which child nodes will be encoded.
*/
void setContainerNode(in nsIDOMNode aContainer);
[noscript] void setNativeContainerNode(in nsINodePtr aContainer);
/**
* Documents typically have an intrinsic character set,

Просмотреть файл

@ -533,7 +533,7 @@ nsContentSink::ProcessHeaderData(nsIAtom* aHeader, const nsAString& aValue,
// XXXbz don't we want to support this as an HTTP header too?
nsAutoString value(aValue);
if (value.LowerCaseEqualsLiteral("no")) {
nsIPresShell* shell = mDocument->GetPrimaryShell();
nsIPresShell* shell = mDocument->GetShell();
if (shell) {
shell->DisableThemeSupport();
}
@ -1267,7 +1267,7 @@ nsContentSink::StartLayout(PRBool aIgnorePendingSheets)
mLastNotificationTime = PR_Now();
mDocument->SetMayStartLayout(PR_TRUE);
nsCOMPtr<nsIPresShell> shell = mDocument->GetPrimaryShell();
nsCOMPtr<nsIPresShell> shell = mDocument->GetShell();
// Make sure we don't call InitialReflow() for a shell that has
// already called it. This can happen when the layout frame for
// an iframe is constructed *between* the Embed() call for the
@ -1463,7 +1463,7 @@ nsContentSink::DidProcessATokenImpl()
}
// Get the current user event time
nsIPresShell *shell = mDocument->GetPrimaryShell();
nsIPresShell *shell = mDocument->GetShell();
if (!shell) {
// If there's no pres shell in the document, return early since
// we're not laying anything out here.
@ -1631,7 +1631,7 @@ nsContentSink::WillParseImpl(void)
return NS_OK;
}
nsIPresShell *shell = mDocument->GetPrimaryShell();
nsIPresShell *shell = mDocument->GetShell();
if (!shell) {
return NS_OK;
}

Просмотреть файл

@ -474,6 +474,7 @@ nsContentUtils::InitializeEventTable() {
{ nsGkAtoms::ondblclick, NS_MOUSE_DOUBLECLICK, EventNameType_HTMLXUL, NS_MOUSE_EVENT },
{ nsGkAtoms::onmouseover, NS_MOUSE_ENTER_SYNTH, EventNameType_All, NS_MOUSE_EVENT },
{ nsGkAtoms::onmouseout, NS_MOUSE_EXIT_SYNTH, EventNameType_All, NS_MOUSE_EVENT },
{ nsGkAtoms::onMozMouseHittest, NS_MOUSE_MOZHITTEST, EventNameType_None, NS_MOUSE_EVENT },
{ nsGkAtoms::onmousemove, NS_MOUSE_MOVE, EventNameType_All, NS_MOUSE_EVENT },
{ nsGkAtoms::oncontextmenu, NS_CONTEXTMENU, EventNameType_HTMLXUL, NS_MOUSE_EVENT },
@ -495,6 +496,7 @@ nsContentUtils::InitializeEventTable() {
{ nsGkAtoms::onunload, NS_PAGE_UNLOAD,
(EventNameType_HTMLXUL | EventNameType_SVGSVG), NS_EVENT },
{ nsGkAtoms::onhashchange, NS_HASHCHANGE, EventNameType_HTMLXUL, NS_EVENT },
{ nsGkAtoms::onreadystatechange, NS_READYSTATECHANGE, EventNameType_HTMLXUL },
{ nsGkAtoms::onbeforeunload, NS_BEFORE_PAGE_UNLOAD, EventNameType_HTMLXUL, NS_EVENT },
{ nsGkAtoms::onabort, NS_IMAGE_ABORT,
(EventNameType_HTMLXUL | EventNameType_SVGSVG), NS_EVENT },
@ -2300,7 +2302,7 @@ nsContentUtils::GetContextForContent(nsIContent* aContent)
{
nsIDocument* doc = aContent->GetCurrentDoc();
if (doc) {
nsIPresShell *presShell = doc->GetPrimaryShell();
nsIPresShell *presShell = doc->GetShell();
if (presShell) {
return presShell->GetPresContext();
}
@ -6116,7 +6118,7 @@ nsContentUtils::LayerManagerForDocument(nsIDocument *aDoc)
doc = displayDoc;
}
nsIPresShell* shell = doc->GetPrimaryShell();
nsIPresShell* shell = doc->GetShell();
nsCOMPtr<nsISupports> container = doc->GetContainer();
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem = do_QueryInterface(container);
while (!shell && docShellTreeItem) {

Просмотреть файл

@ -598,7 +598,7 @@ nsCopySupport::GetSelectionForCopy(nsIDocument* aDocument, nsISelection** aSelec
{
*aSelection = nsnull;
nsIPresShell* presShell = aDocument->GetPrimaryShell();
nsIPresShell* presShell = aDocument->GetShell();
if (!presShell)
return nsnull;

Просмотреть файл

@ -70,6 +70,7 @@
#include "nsCOMArray.h"
#include "nsGUIEvent.h"
#include "nsPLDOMEvent.h"
#include "nsIDOMStyleSheet.h"
#include "nsDOMAttribute.h"
@ -1394,7 +1395,7 @@ nsDOMImplementation::Init(nsIURI* aDocumentURI, nsIURI* aBaseURI,
nsDocument::nsDocument(const char* aContentType)
: nsIDocument()
{
mContentType = aContentType;
SetContentTypeInternal(nsDependentCString(aContentType));
#ifdef PR_LOGGING
if (!gDocumentLeakPRLog)
@ -1689,6 +1690,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDocument)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mFirstBaseNodeWithHref)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mDOMImplementation)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOriginalDocument)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mCachedEncoder)
// Traverse all our nsCOMArrays.
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMARRAY(mStyleSheets)
@ -1732,6 +1734,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDocument)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mFirstBaseNodeWithHref)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mDOMImplementation)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOriginalDocument)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mCachedEncoder)
NS_IMPL_CYCLE_COLLECTION_UNLINK_USERDATA
@ -1948,7 +1951,7 @@ nsDocument::ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup,
mLastModified.Truncate();
// XXXbz I guess we're assuming that the caller will either pass in
// a channel with a useful type or call SetContentType?
mContentType.Truncate();
SetContentTypeInternal(EmptyCString());
mContentLanguage.Truncate();
mBaseTarget.Truncate();
mReferrer.Truncate();
@ -1999,7 +2002,7 @@ nsDocument::ResetStylesheetsToURI(nsIURI* aURI)
sheet->SetOwningDocument(nsnull);
if (sheet->IsApplicable()) {
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
nsCOMPtr<nsIPresShell> shell = GetShell();
if (shell) {
shell->StyleSet()->RemoveStyleSheet(nsStyleSet::eAgentSheet, sheet);
}
@ -2020,7 +2023,7 @@ nsDocument::ResetStylesheetsToURI(nsIURI* aURI)
nsStyleSet::sheetType attrSheetType = GetAttrSheetType();
if (mAttrStyleSheet) {
// Remove this sheet from all style sets
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
nsCOMPtr<nsIPresShell> shell = GetShell();
if (shell) {
shell->StyleSet()->RemoveStyleSheet(attrSheetType, mAttrStyleSheet);
}
@ -2036,7 +2039,7 @@ nsDocument::ResetStylesheetsToURI(nsIURI* aURI)
if (mStyleAttrStyleSheet) {
// Remove this sheet from all style sets
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
nsCOMPtr<nsIPresShell> shell = GetShell();
if (shell) {
shell->StyleSet()->
RemoveStyleSheet(nsStyleSet::eStyleAttrSheet, mStyleAttrStyleSheet);
@ -2054,7 +2057,7 @@ nsDocument::ResetStylesheetsToURI(nsIURI* aURI)
mStyleAttrStyleSheet->SetOwningDocument(this);
// Now set up our style sets
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
nsCOMPtr<nsIPresShell> shell = GetShell();
if (shell) {
FillStyleSet(shell->StyleSet());
}
@ -2156,7 +2159,7 @@ nsDocument::StartDocumentLoad(const char* aCommand, nsIChannel* aChannel,
contentType.EndReading(end);
semicolon = start;
FindCharInReadable(';', semicolon, end);
mContentType = Substring(start, semicolon);
SetContentTypeInternal(Substring(start, semicolon));
}
RetrieveRelevantHeaders(aChannel);
@ -2437,7 +2440,7 @@ nsDocument::SetApplicationCache(nsIApplicationCache *aApplicationCache)
NS_IMETHODIMP
nsDocument::GetContentType(nsAString& aContentType)
{
CopyUTF8toUTF16(mContentType, aContentType);
CopyUTF8toUTF16(GetContentTypeInternal(), aContentType);
return NS_OK;
}
@ -2445,11 +2448,11 @@ nsDocument::GetContentType(nsAString& aContentType)
void
nsDocument::SetContentType(const nsAString& aContentType)
{
NS_ASSERTION(mContentType.IsEmpty() ||
mContentType.Equals(NS_ConvertUTF16toUTF8(aContentType)),
NS_ASSERTION(GetContentTypeInternal().IsEmpty() ||
GetContentTypeInternal().Equals(NS_ConvertUTF16toUTF8(aContentType)),
"Do you really want to change the content-type?");
CopyUTF16toUTF8(aContentType, mContentType);
SetContentTypeInternal(NS_ConvertUTF16toUTF8(aContentType));
}
/* Return true if the document is in the focused top-level window, and is an
@ -2570,7 +2573,7 @@ nsDocument::ElementFromPointHelper(float aX, float aY,
if (aFlushLayout)
FlushPendingNotifications(Flush_Layout);
nsIPresShell *ps = GetPrimaryShell();
nsIPresShell *ps = GetShell();
NS_ENSURE_STATE(ps);
nsIFrame *rootFrame = ps->GetRootFrame();
@ -2640,7 +2643,7 @@ nsDocument::NodesFromRectHelper(float aX, float aY,
FlushPendingNotifications(Flush_Layout);
}
nsIPresShell *ps = GetPrimaryShell();
nsIPresShell *ps = GetShell();
NS_ENSURE_STATE(ps);
nsIFrame *rootFrame = ps->GetRootFrame();
@ -3241,7 +3244,7 @@ nsDocument::GetIndexOfStyleSheet(nsIStyleSheet* aSheet) const
void
nsDocument::AddStyleSheetToStyleSets(nsIStyleSheet* aSheet)
{
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
nsCOMPtr<nsIPresShell> shell = GetShell();
if (shell) {
shell->StyleSet()->AddDocStyleSheet(aSheet, this);
}
@ -3264,7 +3267,7 @@ nsDocument::AddStyleSheet(nsIStyleSheet* aSheet)
void
nsDocument::RemoveStyleSheetFromStyleSets(nsIStyleSheet* aSheet)
{
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
nsCOMPtr<nsIPresShell> shell = GetShell();
if (shell) {
shell->StyleSet()->RemoveStyleSheet(nsStyleSet::eDocSheet, aSheet);
}
@ -3392,7 +3395,7 @@ nsDocument::AddCatalogStyleSheet(nsIStyleSheet* aSheet)
if (aSheet->IsApplicable()) {
// This is like |AddStyleSheetToStyleSets|, but for an agent sheet.
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
nsCOMPtr<nsIPresShell> shell = GetShell();
if (shell) {
shell->StyleSet()->AppendStyleSheet(nsStyleSet::eAgentSheet, aSheet);
}
@ -3861,7 +3864,7 @@ nsDocument::DispatchContentLoadedEvents()
if (innerEvent) {
nsEventStatus status = nsEventStatus_eIgnore;
nsIPresShell *shell = parent->GetPrimaryShell();
nsIPresShell *shell = parent->GetShell();
if (shell) {
nsRefPtr<nsPresContext> context = shell->GetPresContext();
@ -4949,7 +4952,7 @@ nsDocument::DoNotifyPossibleTitleChange()
nsAutoString title;
GetTitle(title);
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
nsCOMPtr<nsIPresShell> shell = GetShell();
if (shell) {
nsCOMPtr<nsISupports> container = shell->GetPresContext()->GetContainer();
if (container) {
@ -5223,7 +5226,7 @@ nsDocument::GetAnimationController()
// If there's a presContext then check the animation mode and pause if
// necessary.
nsIPresShell *shell = GetPrimaryShell();
nsIPresShell *shell = GetShell();
if (mAnimationController && shell) {
nsPresContext *context = shell->GetPresContext();
if (context &&
@ -5280,7 +5283,7 @@ nsDocument::SetDir(const nsAString& aDirection)
if (aDirection == NS_ConvertASCIItoUTF16(elt->mName)) {
if (GET_BIDI_OPTION_DIRECTION(options) != elt->mValue) {
SET_BIDI_OPTION_DIRECTION(options, elt->mValue);
nsIPresShell *shell = GetPrimaryShell();
nsIPresShell *shell = GetShell();
if (shell) {
nsPresContext *context = shell->GetPresContext();
NS_ENSURE_TRUE(context, NS_ERROR_UNEXPECTED);
@ -5961,7 +5964,7 @@ NS_IMETHODIMP
nsDocument::DispatchEvent(nsIDOMEvent* aEvent, PRBool *_retval)
{
// Obtain a presentation context
nsIPresShell *shell = GetPrimaryShell();
nsIPresShell *shell = GetShell();
nsRefPtr<nsPresContext> context;
if (shell) {
context = shell->GetPresContext();
@ -6046,7 +6049,7 @@ nsDocument::CreateEvent(const nsAString& aEventType, nsIDOMEvent** aReturn)
// Obtain a presentation shell
nsIPresShell *shell = GetPrimaryShell();
nsIPresShell *shell = GetShell();
nsPresContext *presContext = nsnull;
@ -6116,7 +6119,7 @@ nsDocument::FlushPendingNotifications(mozFlushType aType)
mParentDocument->FlushPendingNotifications(parentType);
}
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
nsCOMPtr<nsIPresShell> shell = GetShell();
if (shell) {
shell->FlushPendingNotifications(aType);
}
@ -6546,7 +6549,7 @@ nsDocument::CreateElem(nsIAtom *aName, nsIAtom *aPrefix, PRInt32 aNamespaceID,
PRBool
nsDocument::IsSafeToFlush() const
{
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
nsCOMPtr<nsIPresShell> shell = GetShell();
if (!shell)
return PR_TRUE;
@ -7306,7 +7309,7 @@ nsDocument::CloneDocHelper(nsDocument* clone) const
clone->mCompatMode = mCompatMode;
clone->mBidiOptions = mBidiOptions;
clone->mContentLanguage = mContentLanguage;
clone->mContentType = mContentType;
clone->SetContentTypeInternal(GetContentTypeInternal());
clone->mSecurityInfo = mSecurityInfo;
// State from nsDocument
@ -7320,7 +7323,12 @@ void
nsDocument::SetReadyStateInternal(ReadyState rs)
{
mReadyState = rs;
// TODO fire "readystatechange"
nsRefPtr<nsPLDOMEvent> plevent =
new nsPLDOMEvent(this, NS_LITERAL_STRING("readystatechange"), PR_FALSE, PR_FALSE);
if (plevent) {
plevent->RunDOMEventWhenSafe();
}
}
nsIDocument::ReadyState
@ -7373,7 +7381,7 @@ FireOrClearDelayedEvents(nsTArray<nsCOMPtr<nsIDocument> >& aDocuments,
for (PRUint32 i = 0; i < aDocuments.Length(); ++i) {
if (!aDocuments[i]->EventHandlingSuppressed()) {
fm->FireDelayedEvents(aDocuments[i]);
nsCOMPtr<nsIPresShell> shell = aDocuments[i]->GetPrimaryShell();
nsCOMPtr<nsIPresShell> shell = aDocuments[i]->GetShell();
if (shell) {
shell->FireOrClearDelayedEvents(aFireEvents);
}
@ -7423,7 +7431,7 @@ nsDocument::GetDocumentState()
mGotDocumentState |= NS_DOCUMENT_STATE_RTL_LOCALE;
}
if (!(mGotDocumentState & NS_DOCUMENT_STATE_WINDOW_INACTIVE)) {
nsIPresShell* shell = GetPrimaryShell();
nsIPresShell* shell = GetShell();
if (shell && shell->GetPresContext() &&
shell->GetPresContext()->IsTopLevelWindowInactive()) {
mDocumentState |= NS_DOCUMENT_STATE_WINDOW_INACTIVE;
@ -7588,7 +7596,7 @@ nsDocument::ScrollToRef()
// http://www.w3.org/TR/html4/appendix/notes.html#h-B.2.1
NS_ConvertUTF8toUTF16 ref(unescapedRef);
nsCOMPtr<nsIPresShell> shell = GetPrimaryShell();
nsCOMPtr<nsIPresShell> shell = GetShell();
if (shell) {
// Check an empty string which might be caused by the UTF-8 conversion
if (!ref.IsEmpty()) {

Просмотреть файл

@ -81,6 +81,7 @@
#include "nsReadableUtils.h"
#include "nsTArray.h"
#include "nsIFrame.h"
#include "nsStringBuffer.h"
nsresult NS_NewDomSelection(nsISelection **aDomSelection);
@ -95,12 +96,12 @@ public:
nsDocumentEncoder();
virtual ~nsDocumentEncoder();
NS_DECL_ISUPPORTS
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(nsDocumentEncoder)
NS_DECL_NSIDOCUMENTENCODER
protected:
void Initialize();
void Initialize(PRBool aClearCachedSerializer = PR_TRUE);
nsresult SerializeNodeStart(nsINode* aNode, PRInt32 aStartOffset,
PRInt32 aEndOffset, nsAString& aStr,
nsINode* aOriginalNode = nsnull);
@ -175,24 +176,43 @@ protected:
PRPackedBool mHaltRangeHint;
PRPackedBool mIsCopying; // Set to PR_TRUE only while copying
PRPackedBool mNodeIsContainer;
nsStringBuffer* mCachedBuffer;
};
NS_IMPL_ADDREF(nsDocumentEncoder)
NS_IMPL_RELEASE(nsDocumentEncoder)
NS_IMPL_CYCLE_COLLECTION_CLASS(nsDocumentEncoder)
NS_INTERFACE_MAP_BEGIN(nsDocumentEncoder)
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsDocumentEncoder)
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsDocumentEncoder)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDocumentEncoder)
NS_INTERFACE_MAP_ENTRY(nsIDocumentEncoder)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
nsDocumentEncoder::nsDocumentEncoder()
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDocumentEncoder)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mDocument)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mSelection)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mRange)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mNode)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mCommonParent)
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDocumentEncoder)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mDocument)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mSelection)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mRange)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mNode)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mCommonParent)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
nsDocumentEncoder::nsDocumentEncoder() : mCachedBuffer(nsnull)
{
Initialize();
mMimeType.AssignLiteral("text/plain");
}
void nsDocumentEncoder::Initialize()
void nsDocumentEncoder::Initialize(PRBool aClearCachedSerializer)
{
mFlags = 0;
mWrapColumn = 72;
@ -202,10 +222,16 @@ void nsDocumentEncoder::Initialize()
mEndRootIndex = 0;
mHaltRangeHint = PR_FALSE;
mNodeIsContainer = PR_FALSE;
if (aClearCachedSerializer) {
mSerializer = nsnull;
}
}
nsDocumentEncoder::~nsDocumentEncoder()
{
if (mCachedBuffer) {
mCachedBuffer->Release();
}
}
NS_IMETHODIMP
@ -216,10 +242,23 @@ nsDocumentEncoder::Init(nsIDOMDocument* aDocument,
if (!aDocument)
return NS_ERROR_INVALID_ARG;
Initialize();
nsCOMPtr<nsIDocument> doc = do_QueryInterface(aDocument);
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
mDocument = do_QueryInterface(aDocument);
NS_ENSURE_TRUE(mDocument, NS_ERROR_FAILURE);
return NativeInit(doc, aMimeType, aFlags);
}
NS_IMETHODIMP
nsDocumentEncoder::NativeInit(nsIDocument* aDocument,
const nsAString& aMimeType,
PRUint32 aFlags)
{
if (!aDocument)
return NS_ERROR_INVALID_ARG;
Initialize(!mMimeType.Equals(aMimeType));
mDocument = aDocument;
mMimeType = aMimeType;
@ -266,6 +305,14 @@ nsDocumentEncoder::SetContainerNode(nsIDOMNode *aContainer)
return NS_OK;
}
NS_IMETHODIMP
nsDocumentEncoder::SetNativeContainerNode(nsINode* aContainer)
{
mNodeIsContainer = PR_TRUE;
mNode = aContainer;
return NS_OK;
}
NS_IMETHODIMP
nsDocumentEncoder::SetCharset(const nsACString& aCharset)
{
@ -928,11 +975,26 @@ nsDocumentEncoder::EncodeToString(nsAString& aOutputString)
aOutputString.Truncate();
nsString output;
static const size_t bufferSize = 2048;
if (!mCachedBuffer) {
mCachedBuffer = nsStringBuffer::Alloc(bufferSize);
}
NS_ASSERTION(!mCachedBuffer->IsReadonly(),
"DocumentEncoder shouldn't keep reference to non-readonly buffer!");
static_cast<PRUnichar*>(mCachedBuffer->Data())[0] = PRUnichar(0);
mCachedBuffer->ToString(0, output, PR_TRUE);
// output owns the buffer now!
mCachedBuffer = nsnull;
if (!mSerializer) {
nsCAutoString progId(NS_CONTENTSERIALIZER_CONTRACTID_PREFIX);
AppendUTF16toUTF8(mMimeType, progId);
mSerializer = do_CreateInstance(progId.get());
NS_ENSURE_TRUE(mSerializer, NS_ERROR_NOT_IMPLEMENTED);
}
nsresult rv = NS_OK;
@ -966,47 +1028,59 @@ nsDocumentEncoder::EncodeToString(nsAString& aOutputString)
if (node != prevNode) {
if (prevNode) {
nsCOMPtr<nsINode> p = do_QueryInterface(prevNode);
rv = SerializeNodeEnd(p, aOutputString);
rv = SerializeNodeEnd(p, output);
NS_ENSURE_SUCCESS(rv, rv);
prevNode = nsnull;
}
nsCOMPtr<nsIContent> content = do_QueryInterface(node);
if (content && content->Tag() == nsGkAtoms::tr) {
nsCOMPtr<nsINode> n = do_QueryInterface(node);
rv = SerializeNodeStart(n, 0, -1, aOutputString);
rv = SerializeNodeStart(n, 0, -1, output);
NS_ENSURE_SUCCESS(rv, rv);
prevNode = node;
}
}
nsCOMPtr<nsIRange> r = do_QueryInterface(range);
rv = SerializeRangeToString(r, aOutputString);
rv = SerializeRangeToString(r, output);
NS_ENSURE_SUCCESS(rv, rv);
}
if (prevNode) {
nsCOMPtr<nsINode> p = do_QueryInterface(prevNode);
rv = SerializeNodeEnd(p, aOutputString);
rv = SerializeNodeEnd(p, output);
NS_ENSURE_SUCCESS(rv, rv);
}
mSelection = nsnull;
} else if (mRange) {
rv = SerializeRangeToString(mRange, aOutputString);
rv = SerializeRangeToString(mRange, output);
mRange = nsnull;
} else if (mNode) {
rv = SerializeToStringRecursive(mNode, aOutputString, mNodeIsContainer);
rv = SerializeToStringRecursive(mNode, output, mNodeIsContainer);
mNode = nsnull;
} else {
rv = mSerializer->AppendDocumentStart(mDocument, aOutputString);
rv = mSerializer->AppendDocumentStart(mDocument, output);
if (NS_SUCCEEDED(rv)) {
rv = SerializeToStringRecursive(mDocument, aOutputString, PR_FALSE);
rv = SerializeToStringRecursive(mDocument, output, PR_FALSE);
}
}
NS_ENSURE_SUCCESS(rv, rv);
rv = mSerializer->Flush(aOutputString);
rv = mSerializer->Flush(output);
if (NS_SUCCEEDED(rv)) {
aOutputString.Append(output.get(), output.Length());
}
mCachedBuffer = nsStringBuffer::FromString(output);
// Try to cache the buffer.
if (mCachedBuffer && mCachedBuffer->StorageSize() == bufferSize &&
!mCachedBuffer->IsReadonly()) {
mCachedBuffer->AddRef();
} else {
mCachedBuffer = nsnull;
}
return rv;
}

Просмотреть файл

@ -1012,8 +1012,8 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
NS_ASSERTION(ourDoc == ourParentDocument, "Unexpected parent document");
NS_ASSERTION(otherDoc == otherParentDocument, "Unexpected parent document");
nsIPresShell* ourShell = ourDoc->GetPrimaryShell();
nsIPresShell* otherShell = otherDoc->GetPrimaryShell();
nsIPresShell* ourShell = ourDoc->GetShell();
nsIPresShell* otherShell = otherDoc->GetShell();
if (!ourShell || !otherShell) {
return NS_ERROR_NOT_IMPLEMENTED;
}

Просмотреть файл

@ -847,7 +847,7 @@ nsIContent::GetDesiredIMEState()
if (!doc) {
return IME_STATUS_DISABLE;
}
nsIPresShell* ps = doc->GetPrimaryShell();
nsIPresShell* ps = doc->GetShell();
if (!ps) {
return IME_STATUS_DISABLE;
}
@ -3301,7 +3301,7 @@ nsGenericElement::SetSMILOverrideStyleRule(nsICSSStyleRule* aStyleRule,
// be in a document, if we're clearing animation effects on a target node
// that's been detached since the previous animation sample.)
if (doc) {
nsCOMPtr<nsIPresShell> shell = doc->GetPrimaryShell();
nsCOMPtr<nsIPresShell> shell = doc->GetShell();
if (shell) {
shell->RestyleForAnimation(this);
}
@ -3621,7 +3621,7 @@ nsINode::doRemoveChildAt(PRUint32 aIndex, PRBool aNotify,
// A11y needs to be notified of content removals first, so accessibility
// events can be fired before any changes occur
if (aNotify && doc) {
nsIPresShell *presShell = doc->GetPrimaryShell();
nsIPresShell *presShell = doc->GetShell();
if (presShell && presShell->IsAccessibilityActive()) {
nsCOMPtr<nsIAccessibilityService> accService =
do_GetService("@mozilla.org/accessibilityService;1");
@ -5378,7 +5378,7 @@ ParseSelectorList(nsINode* aNode,
// It's not strictly necessary to have a prescontext here, but it's
// a bit of an optimization for various stuff.
*aPresContext = nsnull;
nsIPresShell* shell = doc->GetPrimaryShell();
nsIPresShell* shell = doc->GetShell();
if (shell) {
*aPresContext = shell->GetPresContext();
}

Просмотреть файл

@ -663,6 +663,7 @@ GK_ATOM(onmousedown, "onmousedown")
GK_ATOM(onmousemove, "onmousemove")
GK_ATOM(onmouseout, "onmouseout")
GK_ATOM(onmouseover, "onmouseover")
GK_ATOM(onMozMouseHittest, "onMozMouseHittest")
GK_ATOM(onmouseup, "onmouseup")
GK_ATOM(onMozAfterPaint, "onMozAfterPaint")
GK_ATOM(onMozMousePixelScroll, "onMozMousePixelScroll")
@ -679,6 +680,7 @@ GK_ATOM(onpopuphidden, "onpopuphidden")
GK_ATOM(onpopuphiding, "onpopuphiding")
GK_ATOM(onpopupshowing, "onpopupshowing")
GK_ATOM(onpopupshown, "onpopupshown")
GK_ATOM(onreadystatechange, "onreadystatechange")
GK_ATOM(onRequest, "onRequest")
GK_ATOM(onreset, "onreset")
GK_ATOM(onresize, "onresize")

Просмотреть файл

@ -291,7 +291,7 @@ nsImageLoadingContent::OnStopDecode(imgIRequest* aRequest,
// We can only do this if we have a presshell
nsIDocument* doc = GetOurDocument();
nsIPresShell* shell = doc ? doc->GetPrimaryShell() : nsnull;
nsIPresShell* shell = doc ? doc->GetShell() : nsnull;
if (shell) {
// We need to figure out whether to kick off decoding

Просмотреть файл

@ -876,7 +876,7 @@ nsObjectLoadingContent::EnsureInstantiation(nsIPluginInstance** aInstance)
return NS_OK;
}
nsCOMPtr<nsIPresShell> shell = doc->GetPrimaryShell();
nsCOMPtr<nsIPresShell> shell = doc->GetShell();
if (shell) {
shell->RecreateFramesFor(thisContent);
}
@ -1656,7 +1656,7 @@ nsObjectLoadingContent::NotifyStateChanged(ObjectType aOldType,
} else if (aOldType != mType) {
// If our state changed, then we already recreated frames
// Otherwise, need to do that here
nsCOMPtr<nsIPresShell> shell = doc->GetPrimaryShell();
nsCOMPtr<nsIPresShell> shell = doc->GetShell();
if (shell) {
shell->RecreateFramesFor(thisContent);
}

Просмотреть файл

@ -102,7 +102,7 @@ static nsIThread *gWebSocketThread = nsnull;
#define TIMEOUT_TRY_CONNECT_AGAIN 1000
#define TIMEOUT_WAIT_FOR_SERVER_RESPONSE 20000
#define TIMEOUT_WAIT_FOR_CLOSING 5000
#define TIMEOUT_WAIT_FOR_CLOSING 20000
#define ENSURE_TRUE_AND_FAIL_IF_FAILED(x, ret) \
PR_BEGIN_MACRO \
@ -240,7 +240,10 @@ public:
nsresult Init(nsWebSocket *aOwner);
nsresult Disconnect();
// these are called always on the main thread (they dispatch themselves)
// These are called always on the main thread (they dispatch themselves).
// ATTENTION, this method when called can release both the WebSocket object
// (i.e. mOwner) and its connection (i.e. *this*) if there are no strong event
// listeners.
DECL_RUNNABLE_ON_MAIN_THREAD_METHOD(Close)
DECL_RUNNABLE_ON_MAIN_THREAD_METHOD(FailConnection)
@ -253,6 +256,17 @@ public:
static nsTArray<nsRefPtr<nsWebSocketEstablishedConnection> >* sWSsConnecting;
private:
enum WSFrameType {
eConnectFrame,
eUTF8MessageFrame,
eCloseFrame
};
struct nsWSFrame {
WSFrameType mType;
nsAutoPtr<nsCString> mData;
};
// We can only establish one connection at a time per IP address.
// TryConnect ensures this by checking sWSsConnecting.
// If there is a IP address entry there it tries again after
@ -291,7 +305,8 @@ private:
nsresult Reset();
void RemoveFromLoadGroup();
nsresult ProcessHeaders();
nsresult PostData(nsCString *aBuffer, PRBool aIsMessage);
nsresult PostData(nsCString *aBuffer,
WSFrameType aWSFrameType);
nsresult PrintErrorOnConsole(const char *aBundleURI,
const PRUnichar *aError,
const PRUnichar **aFormatStrings,
@ -324,7 +339,7 @@ private:
nsCOMPtr<nsIAsyncInputStream> mSocketInput;
nsCOMPtr<nsIAsyncOutputStream> mSocketOutput;
nsCOMPtr<nsIProxyInfo> mProxyInfo;
nsDeque mOutgoingMessages; // has nsCString* which need to be sent
nsDeque mOutgoingMessages; // has nsWSFrame* which need to be sent
PRUint32 mBytesAlreadySentOfFirstOutString;
PRUint32 mOutgoingBufferedAmount; // not really necessary, but it is
// here for fast access.
@ -652,14 +667,17 @@ nsWebSocketEstablishedConnection::nsWebSocketEstablishedConnection() :
nsWebSocketEstablishedConnection::~nsWebSocketEstablishedConnection()
{
NS_ASSERTION(!mOwner, "Disconnect wasn't called!");
}
nsresult
nsWebSocketEstablishedConnection::PostData(nsCString *aBuffer,
PRBool aIsMessage)
WSFrameType aWSFrameType)
{
NS_ASSERTION(NS_IsMainThread(), "Not running on main thread");
nsAutoPtr<nsCString> data(aBuffer);
if (mStatus == CONN_CLOSED) {
NS_ASSERTION(mOwner, "Posting data after disconnecting the websocket!");
// the tcp connection has been closed, but the main thread hasn't received
@ -669,14 +687,21 @@ nsWebSocketEstablishedConnection::PostData(nsCString *aBuffer,
MutexAutoLock lockOut(mLockOutgoingMessages);
nsAutoPtr<nsWSFrame> frame(new nsWSFrame());
NS_ENSURE_TRUE(frame.get(), NS_ERROR_OUT_OF_MEMORY);
frame->mType = aWSFrameType;
frame->mData = data.forget();
nsresult rv;
PRInt32 sizeBefore = mOutgoingMessages.GetSize();
mOutgoingMessages.Push(aBuffer);
mOutgoingMessages.Push(frame.forget());
NS_ENSURE_TRUE(mOutgoingMessages.GetSize() == sizeBefore + 1,
NS_ERROR_OUT_OF_MEMORY);
if (aIsMessage) {
if (aWSFrameType == eUTF8MessageFrame) {
// without the START_BYTE_OF_MESSAGE and END_BYTE_OF_MESSAGE bytes
mOutgoingBufferedAmount += aBuffer->Length() - 2;
} else if (aWSFrameType == eCloseFrame) {
mPostedCloseFrame = PR_TRUE;
}
if (sizeBefore == 0) {
@ -752,7 +777,7 @@ nsWebSocketEstablishedConnection::PostMessage(const nsString& aMessage)
ENSURE_TRUE_AND_FAIL_IF_FAILED(buf->Length() == static_cast<PRUint32>(outLen),
NS_ERROR_UNEXPECTED);
rv = PostData(buf.forget(), PR_TRUE);
rv = PostData(buf.forget(), eUTF8MessageFrame);
ENSURE_SUCCESS_AND_FAIL_IF_FAILED(rv, rv);
return NS_OK;
@ -873,7 +898,7 @@ IMPL_RUNNABLE_ON_MAIN_THREAD_METHOD_BEGIN(DoInitialRequest)
mStatus = CONN_SENDING_INITIAL_REQUEST;
rv = PostData(buf.forget(), PR_FALSE);
rv = PostData(buf.forget(), eConnectFrame);
CHECK_SUCCESS_AND_FAIL_IF_FAILED(rv);
}
IMPL_RUNNABLE_ON_MAIN_THREAD_METHOD_END
@ -1455,11 +1480,11 @@ nsWebSocketEstablishedConnection::Reset()
mSocketOutput = nsnull;
while (mOutgoingMessages.GetSize() != 0) {
delete static_cast<nsCString*>(mOutgoingMessages.PopFront());
delete static_cast<nsWSFrame*>(mOutgoingMessages.PopFront());
}
while (mReceivedMessages.GetSize() != 0) {
delete static_cast<nsString*>(mReceivedMessages.PopFront());
delete static_cast<nsCString*>(mReceivedMessages.PopFront());
}
mBytesAlreadySentOfFirstOutString = 0;
@ -1685,7 +1710,7 @@ nsWebSocketEstablishedConnection::DoConnect()
mStatus = CONN_CONNECTING_TO_HTTP_PROXY;
rv = PostData(buf.forget(), PR_FALSE);
rv = PostData(buf.forget(), eConnectFrame);
ENSURE_SUCCESS_AND_FAIL_IF_FAILED(rv, rv);
return NS_OK;
@ -1945,6 +1970,10 @@ IMPL_RUNNABLE_ON_MAIN_THREAD_METHOD_BEGIN(Close)
{
nsresult rv;
// Disconnect() can release this object, so we keep a
// reference until the end of the method
nsRefPtr<nsWebSocketEstablishedConnection> kungfuDeathGrip = this;
if (mOwner->mReadyState == nsIWebSocket::CONNECTING) {
// we must not convey any failure information to scripts, so we just
// disconnect and maintain the owner WebSocket object in the CONNECTING
@ -1987,13 +2016,11 @@ IMPL_RUNNABLE_ON_MAIN_THREAD_METHOD_BEGIN(Close)
closeFrame->SetCharAt(START_BYTE_OF_CLOSE_FRAME, 0);
closeFrame->SetCharAt(END_BYTE_OF_CLOSE_FRAME, 1);
rv = PostData(closeFrame.forget(), PR_FALSE);
rv = PostData(closeFrame.forget(), eCloseFrame);
if (NS_FAILED(rv)) {
NS_WARNING("Failed to post the close frame");
return;
}
mPostedCloseFrame = PR_TRUE;
} else {
// Probably failed to send the close frame. Just disconnect.
Disconnect();
@ -2004,6 +2031,10 @@ IMPL_RUNNABLE_ON_MAIN_THREAD_METHOD_END
void
nsWebSocketEstablishedConnection::ForceClose()
{
// Disconnect() can release this object, so we keep a
// reference until the end of the method
nsRefPtr<nsWebSocketEstablishedConnection> kungfuDeathGrip = this;
if (mOwner->mReadyState == nsIWebSocket::CONNECTING) {
// we must not convey any failure information to scripts, so we just
// disconnect and maintain the owner WebSocket object in the CONNECTING
@ -2061,6 +2092,12 @@ nsWebSocketEstablishedConnection::Disconnect()
return NS_OK;
}
// If mOwner is deleted when calling mOwner->DontKeepAliveAnyMore()
// then this method can be called again, and we will get a deadlock.
nsRefPtr<nsWebSocket> kungfuDeathGrip = mOwner;
mOwner->DontKeepAliveAnyMore();
RemoveWSConnecting();
mStatus = CONN_CLOSED;
@ -2111,11 +2148,11 @@ nsWebSocketEstablishedConnection::Disconnect()
mProxyInfo = nsnull;
while (mOutgoingMessages.GetSize() != 0) {
delete static_cast<nsCString*>(mOutgoingMessages.PopFront());
delete static_cast<nsWSFrame*>(mOutgoingMessages.PopFront());
}
while (mReceivedMessages.GetSize() != 0) {
delete static_cast<nsString*>(mReceivedMessages.PopFront());
delete static_cast<nsCString*>(mReceivedMessages.PopFront());
}
// Remove ourselves from the document's load group. nsIRequest expects
@ -2606,13 +2643,13 @@ nsWebSocketEstablishedConnection::OnInputStreamReady(nsIAsyncInputStream *aStrea
// closed. In this case we have to reset the WebSocket, not Close it.
if (mStatus != CONN_RETRYING_TO_AUTHENTICATE) {
mStatus = CONN_CLOSED;
mFailureStatus = NS_BASE_STREAM_CLOSED;
if (mStatus < CONN_CONNECTED_AND_READY) {
FailConnection();
} else {
Close();
}
}
mFailureStatus = NS_BASE_STREAM_CLOSED;
return NS_BASE_STREAM_CLOSED;
}
@ -2659,13 +2696,14 @@ nsWebSocketEstablishedConnection::OnOutputStreamReady(nsIAsyncOutputStream *aStr
// send what we can of the 1st string
nsCString *strToSend =
static_cast<nsCString*>(mOutgoingMessages.PeekFront());
nsWSFrame *frameToSend =
static_cast<nsWSFrame*>(mOutgoingMessages.PeekFront());
nsCString *strToSend = frameToSend->mData;
PRUint32 sizeToSend =
strToSend->Length() - mBytesAlreadySentOfFirstOutString;
PRBool currentStrHasStartFrameByte =
(mBytesAlreadySentOfFirstOutString == 0);
PRBool strIsMessage = (mStatus >= CONN_CONNECTED_AND_READY);
PRBool strIsMessage = (frameToSend->mType == eUTF8MessageFrame);
if (sizeToSend != 0) {
PRUint32 written;
@ -2691,12 +2729,12 @@ nsWebSocketEstablishedConnection::OnOutputStreamReady(nsIAsyncOutputStream *aStr
if (written == 0) {
mStatus = CONN_CLOSED;
mFailureStatus = NS_BASE_STREAM_CLOSED;
if (mStatus < CONN_CONNECTED_AND_READY) {
FailConnection();
} else {
Close();
}
mFailureStatus = NS_BASE_STREAM_CLOSED;
return NS_BASE_STREAM_CLOSED;
}
@ -2731,7 +2769,7 @@ nsWebSocketEstablishedConnection::OnOutputStreamReady(nsIAsyncOutputStream *aStr
// ok, send the next string
mOutgoingMessages.PopFront();
delete strToSend;
delete frameToSend;
mBytesAlreadySentOfFirstOutString = 0;
}
@ -2803,13 +2841,19 @@ nsWebSocketEstablishedConnection::GetInterface(const nsIID &aIID,
// nsWebSocket
////////////////////////////////////////////////////////////////////////////////
nsWebSocket::nsWebSocket() : mReadyState(nsIWebSocket::CONNECTING),
nsWebSocket::nsWebSocket() : mHasStrongEventListeners(PR_FALSE),
mCheckThereAreStrongEventListeners(PR_TRUE),
mReadyState(nsIWebSocket::CONNECTING),
mOutgoingBufferedAmount(0)
{
}
nsWebSocket::~nsWebSocket()
{
if (mConnection) {
mConnection->Disconnect();
mConnection = nsnull;
}
if (mListenerManager) {
mListenerManager->Disconnect();
mListenerManager = nsnull;
@ -2832,16 +2876,16 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsWebSocket,
nsDOMEventTargetWrapperCache)
if (tmp->mConnection) {
tmp->mConnection->Disconnect();
tmp->mConnection = nsnull;
}
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnOpenListener)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnMessageListener)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnCloseListener)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOnErrorListener)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mPrincipal)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mURI)
if (tmp->mConnection) {
tmp->mConnection->Disconnect();
tmp->mConnection = nsnull;
}
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
DOMCI_DATA(WebSocket, nsWebSocket)
@ -2955,7 +2999,9 @@ public:
NS_IMETHOD Run()
{
return mWebSocket->CreateAndDispatchCloseEvent(mWasClean);
nsresult rv = mWebSocket->CreateAndDispatchCloseEvent(mWasClean);
mWebSocket->UpdateMustKeepAlive();
return rv;
}
private:
@ -3073,6 +3119,7 @@ nsWebSocket::SetReadyState(PRUint16 aNewReadyState)
if (NS_FAILED(rv)) {
NS_WARNING("Failed to dispatch the open event");
}
UpdateMustKeepAlive();
return;
}
@ -3099,6 +3146,7 @@ nsWebSocket::SetReadyState(PRUint16 aNewReadyState)
rv = NS_DispatchToMainThread(event, NS_DISPATCH_NORMAL);
if (NS_FAILED(rv)) {
NS_WARNING("Failed to dispatch the close event");
UpdateMustKeepAlive();
}
}
}
@ -3210,6 +3258,94 @@ nsWebSocket::SetProtocol(const nsString& aProtocol)
return NS_OK;
}
//-----------------------------------------------------------------------------
// Methods that keep alive the WebSocket object when there are
// onopen/onmessage event listeners.
//-----------------------------------------------------------------------------
void
nsWebSocket::UpdateMustKeepAlive()
{
if (!mCheckThereAreStrongEventListeners) {
return;
}
if (mHasStrongEventListeners) {
if (!mListenerManager ||
((mReadyState != nsIWebSocket::CONNECTING ||
!mListenerManager->HasListenersFor(NS_LITERAL_STRING("open"))) &&
(mReadyState == nsIWebSocket::CLOSED ||
!mListenerManager->HasListenersFor(NS_LITERAL_STRING("message"))))) {
mHasStrongEventListeners = PR_FALSE;
static_cast<nsPIDOMEventTarget*>(this)->Release();
}
} else {
if ((mReadyState == nsIWebSocket::CONNECTING && mListenerManager &&
mListenerManager->HasListenersFor(NS_LITERAL_STRING("open"))) ||
(mReadyState != nsIWebSocket::CLOSED && mListenerManager &&
mListenerManager->HasListenersFor(NS_LITERAL_STRING("message")))) {
mHasStrongEventListeners = PR_TRUE;
static_cast<nsPIDOMEventTarget*>(this)->AddRef();
}
}
}
void
nsWebSocket::DontKeepAliveAnyMore()
{
if (mHasStrongEventListeners) {
mCheckThereAreStrongEventListeners = PR_FALSE;
mHasStrongEventListeners = PR_FALSE;
static_cast<nsPIDOMEventTarget*>(this)->Release();
}
}
NS_IMETHODIMP
nsWebSocket::AddEventListener(const nsAString& aType,
nsIDOMEventListener* aListener,
PRBool aUseCapture)
{
nsresult rv = nsDOMEventTargetHelper::AddEventListener(aType,
aListener,
aUseCapture);
if (NS_SUCCEEDED(rv)) {
UpdateMustKeepAlive();
}
return rv;
}
NS_IMETHODIMP
nsWebSocket::RemoveEventListener(const nsAString& aType,
nsIDOMEventListener* aListener,
PRBool aUseCapture)
{
nsresult rv = nsDOMEventTargetHelper::RemoveEventListener(aType,
aListener,
aUseCapture);
if (NS_SUCCEEDED(rv)) {
UpdateMustKeepAlive();
}
return rv;
}
NS_IMETHODIMP
nsWebSocket::AddEventListener(const nsAString& aType,
nsIDOMEventListener *aListener,
PRBool aUseCapture,
PRBool aWantsUntrusted,
PRUint8 optional_argc)
{
nsresult rv = nsDOMEventTargetHelper::AddEventListener(aType,
aListener,
aUseCapture,
aWantsUntrusted,
optional_argc);
if (NS_SUCCEEDED(rv)) {
UpdateMustKeepAlive();
}
return rv;
}
//-----------------------------------------------------------------------------
// nsWebSocket::nsIWebSocket methods:
//-----------------------------------------------------------------------------
@ -3303,6 +3439,10 @@ nsWebSocket::Close()
}
if (mReadyState == nsIWebSocket::CONNECTING) {
// FailConnection() can release the object if there are no strong event
// listeners, so we keep a reference before calling it
nsRefPtr<nsWebSocket> kungfuDeathGrip = this;
mConnection->FailConnection();
// We need to set the readyState here because mConnection would set it

Просмотреть файл

@ -86,6 +86,21 @@ public:
NS_IMETHOD Initialize(nsISupports* aOwner, JSContext* aContext,
JSObject* aObject, PRUint32 aArgc, jsval* aArgv);
// nsIDOMEventTarget
NS_IMETHOD AddEventListener(const nsAString& aType,
nsIDOMEventListener* aListener,
PRBool aUseCapture);
NS_IMETHOD RemoveEventListener(const nsAString& aType,
nsIDOMEventListener* aListener,
PRBool aUseCapture);
// nsIDOMNSEventTarget
NS_IMETHOD AddEventListener(const nsAString& aType,
nsIDOMEventListener *aListener,
PRBool aUseCapture,
PRBool aWantsUntrusted,
PRUint8 optional_argc);
static void ReleaseGlobals();
protected:
@ -100,6 +115,14 @@ protected:
// called from mConnection accordingly to the situation
void SetReadyState(PRUint16 aNewReadyState);
// if there are onopen or onmessage event listeners ("strong event listeners")
// then this method keeps the object alive when js doesn't have strong
// references to it.
void UpdateMustKeepAlive();
// Releases, if necessary, the strong event listeners. ATTENTION, when calling
// this method the object can be released (and possibly collected).
void DontKeepAliveAnyMore();
nsRefPtr<nsDOMEventListenerWrapper> mOnOpenListener;
nsRefPtr<nsDOMEventListenerWrapper> mOnErrorListener;
nsRefPtr<nsDOMEventListenerWrapper> mOnMessageListener;
@ -109,6 +132,10 @@ protected:
nsString mOriginalURL;
PRPackedBool mSecure; // if true it is using SSL and the wss scheme,
// otherwise it is using the ws scheme with no SSL
PRPackedBool mHasStrongEventListeners;
PRPackedBool mCheckThereAreStrongEventListeners;
nsCString mAsciiHost; // hostname
PRUint32 mPort;
nsCString mResource; // [filepath[?query]]

Просмотреть файл

@ -101,6 +101,8 @@ nsXHTMLContentSerializer::Init(PRUint32 aFlags, PRUint32 aWrapColumn,
const char* aCharSet, PRBool aIsCopying,
PRBool aRewriteEncodingDeclaration)
{
mInBody = 0;
// The previous version of the HTML serializer did implicit wrapping
// when there is no flags, so we keep wrapping in order to keep
// compatibility with the existing calling code

Просмотреть файл

@ -111,6 +111,15 @@ nsXMLContentSerializer::Init(PRUint32 aFlags, PRUint32 aWrapColumn,
const char* aCharSet, PRBool aIsCopying,
PRBool aRewriteEncodingDeclaration)
{
mPrefixIndex = 0;
mColPos = 0;
mIndentOverflow = 0;
mIsIndentationAddedOnCurrentLine = PR_FALSE;
mInAttribute = PR_FALSE;
mAddNewlineForRootNode = PR_FALSE;
mAddSpace = PR_FALSE;
mMayIgnoreLineBreakSequence = PR_FALSE;
mCharset = aCharSet;
mFlags = aFlags;

Просмотреть файл

@ -394,6 +394,7 @@ _TEST_FILES2 = \
test_html_colors_quirks.html \
test_html_colors_standards.html \
test_bug571390.xul \
test_bug300992.html \
test_websocket_hello.html \
file_websocket_hello_wsh.py \
test_ws_basic_tests.html \

Просмотреть файл

@ -6,25 +6,56 @@ import sys
# see the list of tests in test_websocket.html
def web_socket_do_extra_handshake(request):
if request.ws_protocol == "test 6":
sys.exit(0)
elif request.ws_protocol == "test 19":
time.sleep(180)
pass
elif request.ws_protocol == "test 8":
if request.ws_protocol == "test 2.1":
time.sleep(5)
pass
elif request.ws_protocol == "test 9":
time.sleep(5)
pass
elif request.ws_protocol == "test 10.1":
elif request.ws_protocol == "test 10":
time.sleep(5)
pass
elif request.ws_protocol == "test 19":
raise ValueError('Aborting (test 19)')
elif request.ws_protocol == "test 20" or request.ws_protocol == "test 17":
time.sleep(10)
pass
elif request.ws_protocol == "test 22":
time.sleep(60)
pass
else:
pass
def web_socket_transfer_data(request):
if request.ws_protocol == "test 9":
if request.ws_protocol == "test 2.1" or request.ws_protocol == "test 2.2":
msgutil.close_connection(request)
elif request.ws_protocol == "test 6":
resp = "wrong message"
if msgutil.receive_message(request) == "1":
resp = "2"
msgutil.send_message(request, resp.decode('utf-8'))
resp = "wrong message"
if msgutil.receive_message(request) == "3":
resp = "4"
msgutil.send_message(request, resp.decode('utf-8'))
resp = "wrong message"
if msgutil.receive_message(request) == "5":
resp = "あいうえお"
msgutil.send_message(request, resp.decode('utf-8'))
elif request.ws_protocol == "test 7":
try:
while not request.client_terminated:
msgutil.receive_message(request)
except msgutil.ConnectionTerminatedException, e:
pass
msgutil.send_message(request, "server data")
msgutil.send_message(request, "server data")
msgutil.send_message(request, "server data")
msgutil.send_message(request, "server data")
msgutil.send_message(request, "server data")
time.sleep(30)
msgutil.close_connection(request, True)
elif request.ws_protocol == "test 10":
msgutil.close_connection(request)
elif request.ws_protocol == "test 11":
resp = "wrong message"
@ -41,27 +72,19 @@ def web_socket_transfer_data(request):
request.connection.write('\xff\x00')
msgutil.send_message(request, "server data")
elif request.ws_protocol == "test 15":
sys.exit (0)
elif request.ws_protocol == "test 17":
while not request.client_terminated:
msgutil.close_connection(request, True)
return
elif request.ws_protocol == "test 17" or request.ws_protocol == "test 21":
time.sleep(5)
resp = "wrong message"
if msgutil.receive_message(request) == "client data":
resp = "server data"
msgutil.send_message(request, resp.decode('utf-8'))
time.sleep(5)
msgutil.close_connection(request)
time.sleep(5)
elif request.ws_protocol == "test 20":
msgutil.send_message(request, "server data")
time.sleep(1)
msgutil.send_message(request, "server data")
sys.exit(0)
elif request.ws_protocol == "test 18":
resp = "wrong message"
if msgutil.receive_message(request) == "1":
resp = "2"
msgutil.send_message(request, resp.decode('utf-8'))
resp = "wrong message"
if msgutil.receive_message(request) == "3":
resp = "4"
msgutil.send_message(request, resp.decode('utf-8'))
resp = "wrong message"
if msgutil.receive_message(request) == "5":
resp = "あいうえお"
msgutil.send_message(request, resp.decode('utf-8'))
elif request.ws_protocol == "test 10.1" or request.ws_protocol == "test 10.2":
msgutil.close_connection(request)
while not request.client_terminated:
msgutil.receive_message(request)

Просмотреть файл

@ -0,0 +1,46 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=300992
-->
<head>
<title>Test for Bug 300992</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=300992">Mozilla Bug 300992</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 300992 **/
SimpleTest.waitForExplicitFinish();
var i = 0;
var states = ['loading',
'interactive1', 'interactive2',
'complete1', 'complete2'];
is(document.readyState, states[i++], 'initial readyState');
document.onreadystatechange = function (event) {
is(document.readyState + '1', states[i++], 'readystatechange event "on" handler');
};
document.addEventListener('readystatechange', function(event) {
is(document.readyState + '2', states[i++], 'readystatechange event document listener');
}, false);
window.addEventListener('readystatechange', function(event) {
ok(false, 'window listener', 'readystatechange event should not bubble to window');
}, false);
setTimeout(function() {
is(i, states.length, 'readystatechange event count');
SimpleTest.finish();
}, 1000);
</script>
</pre>
</body>
</html>

Просмотреть файл

@ -18,16 +18,17 @@
/*
* tests:
* 1. client tries to connect to a http scheme location;
* 2. client tries to connect to an http resource;
* 2. assure serialization of the connections;
* 3. client tries to connect to an non-existent ws server;
* 4. client tries to connect using a relative url;
* 5. client uses an invalid protocol value;
* 6. server closes the tcp connection before establishing the ws connection;
* 7. client calls close() and the server sends the close frame in
* 6. counter and encoding check;
* 7. client calls close() and the server keeps sending messages and it doesn't
* send the close frame;
* 8. client calls close() and the server sends the close frame in
* acknowledgement;
* 8. client closes the connection before the ws connection is established;
* 9. client sends a message before the ws connection is established;
* 10. assure serialization of the connections;
* 9. client closes the connection before the ws connection is established;
* 10. client sends a message before the ws connection is established;
* 11. a simple hello echo;
* 12. client sends a message with bad bytes;
* 13. server sends an invalid message;
@ -35,54 +36,46 @@
* it keeps sending normal ws messages;
* 15. server closes the tcp connection, but it doesn't send the close frame;
* 16. client calls close() and tries to send a message;
* 17. client calls close() and the server keeps sending messages and it doesn't
* send the close frame;
* 18. counter and encoding check;
* 19. server takes too long to establish the ws connection;
* 17. see bug 572975 - all event listeners set
* 18. client tries to connect to an http resource;
* 19. server closes the tcp connection before establishing the ws connection;
* 20. see bug 572975 - only on error and onclose event listeners set
* 21. see bug 572975 - same as test 17, but delete strong event listeners when
* receiving the message event;
* 22. server takes too long to establish the ws connection;
*/
var first_test = 1;
var last_test = 19;
var last_test = 22;
var current_test = 1;
var current_test = first_test;
var timeoutToAbortTest = 60000;
var timeoutToOpenWS = 25000;
var all_ws = [];
function shouldNotOpen(e)
{
var ws = e.target;
ok(false, "onopen shouldn't be called on test " + ws._testNumber + "!");
if (ws._timeoutToSucceed != undefined) {
clearTimeout(ws._timeoutToSucceed);
}
}
function shouldNotReceiveCloseEvent(e)
{
var ws = e.target;
ok(false, "onclose shouldn't be called on test " + ws._testNumber + "!");
if (ws._timeoutToSucceed != undefined) {
clearTimeout(ws._timeoutToSucceed);
}
}
function shouldCloseCleanly(e)
{
var ws = e.target;
//ok(e.wasClean, "the ws connection in test " + ws._testNumber + " should be closed cleanly");
if (ws._timeoutToSucceed != undefined) {
clearTimeout(ws._timeoutToSucceed);
}
ok(e.wasClean, "the ws connection in test " + ws._testNumber + " should be closed cleanly");
}
function shouldCloseNotCleanly(e)
{
var ws = e.target;
//ok(!e.wasClean, "the ws connection in test " + ws._testNumber + " shouldn't be closed cleanly");
if (ws._timeoutToSucceed != undefined) {
clearTimeout(ws._timeoutToSucceed);
}
ok(!e.wasClean, "the ws connection in test " + ws._testNumber + " shouldn't be closed cleanly");
}
function CreateTestWS(ws_location, ws_protocol)
@ -119,6 +112,20 @@ function CreateTestWS(ws_location, ws_protocol)
return ws;
}
function forcegc()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
Components.utils.forceGC();
var wu = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils);
wu.garbageCollect();
setTimeout(function()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
wu.garbageCollect();
}, 1);
}
function doTest(number)
{
if (doTest.timeoutId !== null) {
@ -163,12 +170,28 @@ function test1()
doTest(2);
}
// this test expects that the serialization list to connect to the proxy
// is empty
function test2()
{
var ws = CreateTestWS("ws://mochi.test:8888/tests/content/base/test/file_websocket_http_resource.txt");
ws.onopen = shouldNotOpen;
ws.onclose = shouldNotReceiveCloseEvent;
var ws1 = CreateTestWS("ws://mochi.test:8888/tests/content/base/test/file_websocket", "test 2.1");
current_test--; // CreateTestWS incremented this
var ws2 = CreateTestWS("ws://mochi.test:8888/tests/content/base/test/file_websocket", "test 2.2");
var ws2CanConnect = false;
// the server will delay ws1 for 5 seconds
ws1.onopen = function()
{
ws2CanConnect = true;
}
ws2.onopen = function()
{
ok(ws2CanConnect, "shouldn't connect yet in test 2!");
doTest(3);
}
}
function test3()
@ -183,10 +206,10 @@ function test4()
{
try {
var ws = CreateTestWS("file_websocket");
ok(false, "test4 failed");
ok(false, "test 4 failed");
}
catch (e) {
ok(true, "test4 failed");
ok(true, "test 4 failed");
}
doTest(5);
}
@ -214,9 +237,25 @@ function test5()
function test6()
{
var ws = CreateTestWS("ws://mochi.test:8888/tests/content/base/test/file_websocket", "test 6");
ws.onopen = shouldNotOpen;
ws.onclose = shouldNotReceiveCloseEvent;
var counter = 1;
ws.onopen = function()
{
ws.send(counter);
}
ws.onmessage = function(e)
{
if (counter == 5) {
ok(e.data == "あいうえお");
ws.close();
doTest(7);
} else {
ok(e.data == counter+1, "bad counter");
counter += 2;
ws.send(counter);
}
}
ws.onclose = shouldCloseCleanly;
ws._receivedCloseEvent = false;
}
function test7()
@ -228,7 +267,7 @@ function test7()
}
ws.onclose = function(e)
{
shouldCloseCleanly(e);
shouldCloseNotCleanly(e);
doTest(8);
};
ws._receivedCloseEvent = false;
@ -237,20 +276,35 @@ function test7()
function test8()
{
var ws = CreateTestWS("ws://mochi.test:8888/tests/content/base/test/file_websocket", "test 8");
ws.onopen = function()
{
ws.close();
}
ws.onclose = function(e)
{
shouldCloseCleanly(e);
doTest(9);
};
ws._receivedCloseEvent = false;
}
function test9()
{
var ws = CreateTestWS("ws://mochi.test:8888/tests/content/base/test/file_websocket", "test 9");
ws.onopen = shouldNotOpen;
ws.onclose = function(e)
{
shouldCloseNotCleanly(e);
doTest(9);
doTest(10);
};
ws._receivedCloseEvent = false;
ws.close();
}
function test9()
function test10()
{
var ws = CreateTestWS("ws://mochi.test:8888/tests/content/base/test/file_websocket", "test 9");
var ws = CreateTestWS("ws://mochi.test:8888/tests/content/base/test/file_websocket", "test 10");
ws.onclose = shouldCloseCleanly;
ws._receivedCloseEvent = false;
@ -261,27 +315,8 @@ function test9()
catch (e) {
ok(true, "Couldn't send data before connecting!");
}
doTest(10);
}
function test10()
{
var ws1 = CreateTestWS("ws://mochi.test:8888/tests/content/base/test/file_websocket", "test 10.1");
current_test--; // CreateTestWS incremented this
var ws2 = CreateTestWS("ws://mochi.test:8888/tests/content/base/test/file_websocket", "test 10.2");
var ws2CanConnect = false;
// the server will delay ws1 for 5 seconds
ws1.onopen = function()
ws.onopen = function()
{
ws2CanConnect = true;
}
ws2.onopen = function()
{
ok(ws2CanConnect, "shouldn't connect yet in test 10!");
doTest(11);
}
}
@ -336,8 +371,8 @@ function test13()
{
ws._timesCalledOnError++;
if (ws._timesCalledOnError == 2) {
ok(true, "test 13 succeeded");
doTest(14);
ok(true, "test13 succeeded");
}
}
ws.onclose = shouldCloseCleanly;
@ -387,43 +422,63 @@ function test16()
ws._receivedCloseEvent = false;
}
var status_test17 = "not started";
window._test17 = function()
{
var local_ws = new WebSocket("ws://mochi.test:8888/tests/content/base/test/file_websocket", "test 17");
status_test17 = "started";
local_ws.onopen = function(e)
{
status_test17 = "opened";
e.target.send("client data");
forcegc();
};
local_ws.onerror = function()
{
ok(false, "onerror called on test " + e.target._testNumber + "!");
};
local_ws.onmessage = function(e)
{
ok(e.data == "server data", "Bad message in test 17");
status_test17 = "got message";
forcegc();
};
local_ws.onclose = function(e)
{
ok(status_test17 == "got message", "Didn't got message in test 17!");
shouldCloseCleanly(e);
status_test17 = "closed";
forcegc();
doTest(18);
forcegc();
};
local_ws = null;
window._test17 = null;
forcegc();
}
function test17()
{
var ws = CreateTestWS("ws://mochi.test:8888/tests/content/base/test/file_websocket", "test 17");
ws.onopen = function()
{
ws.close();
}
ws.onclose = function(e)
{
shouldCloseNotCleanly(e);
doTest(18);
};
ws._receivedCloseEvent = false;
window._test17();
}
// The tests that expects that their websockets neither open nor close MUST
// be in the end of the tests, i.e. HERE, in order to prevent blocking the other
// tests.
function test18()
{
var ws = CreateTestWS("ws://mochi.test:8888/tests/content/base/test/file_websocket", "test 18");
var counter = 1;
ws.onopen = function()
{
ws.send(counter);
}
ws.onmessage = function(e)
{
if (counter == 5) {
ok(e.data == "あいうえお");
ws.close();
var ws = CreateTestWS("ws://mochi.test:8888/tests/content/base/test/file_websocket_http_resource.txt");
ws.onopen = shouldNotOpen;
ws.onclose = shouldNotReceiveCloseEvent;
doTest(19);
} else {
ok(e.data == counter+1, "bad counter");
counter += 2;
ws.send(counter);
}
}
ws.onclose = shouldCloseCleanly;
ws._receivedCloseEvent = false;
}
function test19()
@ -434,6 +489,81 @@ function test19()
doTest(20);
}
window._test20 = function()
{
var local_ws = new WebSocket("ws://mochi.test:8888/tests/content/base/test/file_websocket", "test 20");
local_ws.onerror = function()
{
ok(false, "onerror called on test " + e.target._testNumber + "!");
};
local_ws.onclose = shouldNotReceiveCloseEvent;
local_ws = null;
window._test20 = null;
forcegc();
}
function test20()
{
window._test20();
doTest(21);
}
var timeoutTest21;
window._test21 = function()
{
var local_ws = new WebSocket("ws://mochi.test:8888/tests/content/base/test/file_websocket", "test 21");
local_ws.onopen = function(e)
{
e.target.send("client data");
timeoutTest21 = setTimeout(function()
{
ok(false, "Didn't received message on test 21!");
}, 15000);
forcegc();
e.target.onopen = null;
forcegc();
};
local_ws.onerror = function()
{
ok(false, "onerror called on test " + e.target._testNumber + "!");
};
local_ws.onmessage = function(e)
{
clearTimeout(timeoutTest21);
ok(e.data == "server data", "Bad message in test 21");
forcegc();
e.target.onmessage = null;
forcegc();
};
local_ws.onclose = shouldNotReceiveCloseEvent;
local_ws = null;
window._test21 = null;
forcegc();
}
function test21()
{
window._test21();
doTest(22);
}
function test22()
{
var ws = CreateTestWS("ws://mochi.test:8888/tests/content/base/test/file_websocket", "test 22");
ws.onopen = shouldNotOpen;
ws.onclose = shouldNotReceiveCloseEvent;
doTest(23);
}
function finishWSTest()
{
for (i = 0; i < all_ws.length; ++i) {

Просмотреть файл

@ -623,7 +623,7 @@ protected:
do_QueryInterface(static_cast<nsIDOMHTMLCanvasElement*>(mCanvasElement));
if (content) {
nsIDocument* ownerDoc = content->GetOwnerDoc();
return ownerDoc ? ownerDoc->GetPrimaryShell() : nsnull;
return ownerDoc ? ownerDoc->GetShell() : nsnull;
}
if (mDocShell) {
nsCOMPtr<nsIPresShell> shell;
@ -859,7 +859,10 @@ nsCanvasRenderingContext2D::Destroy()
Shmem &mem = static_cast<gfxSharedImageSurface*>(mSurface.get())->GetShmem();
allocator->DeallocShmem(mem);
}
if (mValid)
// only do this for non-docshell created contexts,
// since those are the ones that we created a surface for
if (mValid && !mDocShell)
gCanvasMemoryUsed -= mWidth * mHeight * 4;
mSurface = nsnull;

Просмотреть файл

@ -62,9 +62,10 @@
static const char* const sEventNames[] = {
"mousedown", "mouseup", "click", "dblclick", "mouseover",
"mouseout", "mousemove", "contextmenu", "keydown", "keyup", "keypress",
"focus", "blur", "load", "popstate", "beforeunload", "unload", "hashchange",
"abort", "error", "submit", "reset", "change", "select", "input", "text",
"mouseout", "MozMouseHittest", "mousemove", "contextmenu", "keydown", "keyup", "keypress",
"focus", "blur", "load", "popstate", "beforeunload", "unload",
"hashchange", "readystatechange", "abort", "error",
"submit", "reset", "change", "select", "input", "text",
"compositionstart", "compositionend", "popupshowing", "popupshown",
"popuphiding", "popuphidden", "close", "command", "broadcast", "commandupdate",
"dragenter", "dragover", "dragexit", "dragdrop", "draggesture",
@ -1076,6 +1077,8 @@ const char* nsDOMEvent::GetEventName(PRUint32 aEventType)
return sEventNames[eDOMEvents_mouseover];
case NS_MOUSE_EXIT_SYNTH:
return sEventNames[eDOMEvents_mouseout];
case NS_MOUSE_MOZHITTEST:
return sEventNames[eDOMEvents_MozMouseHittest];
case NS_MOUSE_MOVE:
return sEventNames[eDOMEvents_mousemove];
case NS_KEY_UP:
@ -1104,6 +1107,8 @@ const char* nsDOMEvent::GetEventName(PRUint32 aEventType)
return sEventNames[eDOMEvents_unload];
case NS_HASHCHANGE:
return sEventNames[eDOMEvents_hashchange];
case NS_READYSTATECHANGE:
return sEventNames[eDOMEvents_readystatechange];
case NS_IMAGE_ABORT:
return sEventNames[eDOMEvents_abort];
case NS_LOAD_ERROR:

Просмотреть файл

@ -67,6 +67,7 @@ public:
eDOMEvents_dblclick,
eDOMEvents_mouseover,
eDOMEvents_mouseout,
eDOMEvents_MozMouseHittest,
eDOMEvents_mousemove,
eDOMEvents_contextmenu,
eDOMEvents_keydown,
@ -79,6 +80,7 @@ public:
eDOMEvents_beforeunload,
eDOMEvents_unload,
eDOMEvents_hashchange,
eDOMEvents_readystatechange,
eDOMEvents_abort,
eDOMEvents_error,
eDOMEvents_submit,

Просмотреть файл

@ -1296,7 +1296,7 @@ nsEventListenerManager::DispatchEvent(nsIDOMEvent* aEvent, PRBool *_retval)
}
// Obtain a presentation shell
nsIPresShell *shell = document->GetPrimaryShell();
nsIPresShell *shell = document->GetShell();
nsRefPtr<nsPresContext> context;
if (shell) {
context = shell->GetPresContext();

Просмотреть файл

@ -1879,14 +1879,6 @@ nsEventStateManager::FillInEventFromGestureDown(nsMouseEvent* aEvent)
// If we're in the TRACKING state of the d&d gesture tracker, check the current position
// of the mouse in relation to the old one. If we've moved a sufficient amount from
// the mouse down, then fire off a drag gesture event.
//
// Note that when the mouse enters a new child window with its own view, the event's
// coordinates will be in relation to the origin of the inner child window, which could
// either be very different from that of the mouse coords of the mouse down and trigger
// a drag too early, or very similar which might not trigger a drag.
//
// Do we need to do anything about this? Let's wait and see.
//
void
nsEventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
nsMouseEvent *aEvent)
@ -2203,7 +2195,7 @@ nsEventStateManager::DoDefaultDragStart(nsPresContext* aPresContext,
if (aIsSelection && !dragImage) {
nsIDocument* doc = aDragTarget->GetCurrentDoc();
if (doc) {
nsIPresShell* presShell = doc->GetPrimaryShell();
nsIPresShell* presShell = doc->GetShell();
if (presShell) {
selection = presShell->GetCurrentSelection(
nsISelectionController::SELECTION_NORMAL);
@ -2283,7 +2275,7 @@ nsEventStateManager::GetMarkupDocumentViewer(nsIMarkupDocumentViewer** aMv)
nsIDocument *doc = GetDocumentFromWindow(contentWindow);
if(!doc) return NS_ERROR_FAILURE;
nsIPresShell *presShell = doc->GetPrimaryShell();
nsIPresShell *presShell = doc->GetShell();
if(!presShell) return NS_ERROR_FAILURE;
nsPresContext *presContext = presShell->GetPresContext();
if(!presContext) return NS_ERROR_FAILURE;
@ -3107,6 +3099,10 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
nsMouseEvent* mouseEvent = static_cast<nsMouseEvent*>(aEvent);
event.refPoint = mouseEvent->refPoint;
if (mouseEvent->widget) {
event.refPoint += mouseEvent->widget->WidgetToScreenOffset();
}
event.refPoint -= widget->WidgetToScreenOffset();
event.isShift = mouseEvent->isShift;
event.isControl = mouseEvent->isControl;
event.isAlt = mouseEvent->isAlt;
@ -3570,7 +3566,7 @@ nsEventStateManager::NotifyMouseOver(nsGUIEvent* aEvent, nsIContent* aContent)
if (parentDoc) {
nsIContent *docContent = parentDoc->FindContentForSubDocument(mDocument);
if (docContent) {
nsIPresShell *parentShell = parentDoc->GetPrimaryShell();
nsIPresShell *parentShell = parentDoc->GetShell();
if (parentShell) {
nsEventStateManager* parentESM =
static_cast<nsEventStateManager*>

Просмотреть файл

@ -655,13 +655,11 @@ nsGenericHTMLElement::GetInnerHTML(nsAString& aInnerHTML)
{
aInnerHTML.Truncate();
nsCOMPtr<nsIDocument> doc = GetOwnerDoc();
nsIDocument* doc = GetOwnerDoc();
if (!doc) {
return NS_OK; // We rely on the document for doing HTML conversion
}
nsCOMPtr<nsIDOMNode> thisNode(do_QueryInterface(static_cast<nsIContent *>
(this)));
nsresult rv = NS_OK;
nsAutoString contentType;
@ -671,12 +669,14 @@ nsGenericHTMLElement::GetInnerHTML(nsAString& aInnerHTML)
doc->GetContentType(contentType);
}
nsCOMPtr<nsIDocumentEncoder> docEncoder;
nsCOMPtr<nsIDocumentEncoder> docEncoder = doc->GetCachedEncoder();
if (!docEncoder) {
docEncoder =
do_CreateInstance(PromiseFlatCString(
nsDependentCString(NS_DOC_ENCODER_CONTRACTID_BASE) +
NS_ConvertUTF16toUTF8(contentType)
).get());
}
if (!(docEncoder || doc->IsHTML())) {
// This could be some type for which we create a synthetic document. Try
// again as XML
@ -686,17 +686,19 @@ nsGenericHTMLElement::GetInnerHTML(nsAString& aInnerHTML)
NS_ENSURE_TRUE(docEncoder, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(doc);
rv = docEncoder->Init(domDoc, contentType,
rv = docEncoder->NativeInit(doc, contentType,
nsIDocumentEncoder::OutputEncodeBasicEntities |
// Output DOM-standard newlines
nsIDocumentEncoder::OutputLFLineBreak |
// Don't do linebreaking that's not present in the source
// Don't do linebreaking that's not present in
// the source
nsIDocumentEncoder::OutputRaw);
NS_ENSURE_SUCCESS(rv, rv);
docEncoder->SetContainerNode(thisNode);
return docEncoder->EncodeToString(aInnerHTML);
docEncoder->SetNativeContainerNode(this);
rv = docEncoder->EncodeToString(aInnerHTML);
doc->SetCachedEncoder(docEncoder);
return rv;
}
nsresult
@ -784,7 +786,7 @@ nsGenericHTMLElement::ScrollIntoView(PRBool aTop, PRUint8 optional_argc)
}
// Get the presentation shell
nsCOMPtr<nsIPresShell> presShell = document->GetPrimaryShell();
nsCOMPtr<nsIPresShell> presShell = document->GetShell();
if (!presShell) {
return NS_OK;
}
@ -1444,7 +1446,7 @@ nsGenericHTMLElement::GetPresContext()
nsIDocument* doc = GetDocument();
if (doc) {
// Get presentation shell 0
nsIPresShell *presShell = doc->GetPrimaryShell();
nsIPresShell *presShell = doc->GetShell();
if (presShell) {
return presShell->GetPresContext();
}

Просмотреть файл

@ -1316,7 +1316,16 @@ NS_NewHTML##_elementName##Element(nsINodeInfo *aNodeInfo, \
return NS_NewHTMLSharedElement(aNodeInfo, aFromParser); \
}
// Disable MSVC warning that spams when we pass empty string as only macro arg.
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable:4003)
#endif
NS_DECLARE_NS_NEW_HTML_ELEMENT() // HTMLElement
#ifdef _MSC_VER
#pragma warning(pop)
#endif
NS_DECLARE_NS_NEW_HTML_ELEMENT(Shared)
NS_DECLARE_NS_NEW_HTML_ELEMENT(SharedList)
NS_DECLARE_NS_NEW_HTML_ELEMENT(SharedObject)

Просмотреть файл

@ -255,7 +255,7 @@ nsHTMLAnchorElement::IsHTMLFocusable(PRBool aWithMouse,
// cannot focus links if there is no link handler
nsIDocument* doc = GetCurrentDoc();
if (doc) {
nsIPresShell* presShell = doc->GetPrimaryShell();
nsIPresShell* presShell = doc->GetShell();
if (presShell) {
nsPresContext* presContext = presShell->GetPresContext();
if (presContext && !presContext->GetLinkHandler()) {

Просмотреть файл

@ -241,7 +241,7 @@ nsHTMLButtonElement::Click()
nsCOMPtr<nsIDocument> doc = GetCurrentDoc();
if (doc) {
nsIPresShell *shell = doc->GetPrimaryShell();
nsIPresShell *shell = doc->GetShell();
if (shell) {
nsRefPtr<nsPresContext> context = shell->GetPresContext();
if (context) {

Просмотреть файл

@ -61,7 +61,15 @@ public:
nsresult Clone(nsINodeInfo* aNodeInfo, nsINode** aResult) const;
};
// Disable MSVC warning that spams when we pass empty string as only macro arg.
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable:4003)
#endif
NS_IMPL_NS_NEW_HTML_ELEMENT() // HTMLElement
#ifdef _MSC_VER
#pragma warning(pop)
#endif
nsHTMLElement::nsHTMLElement(nsINodeInfo* aNodeInfo)
: nsGenericHTMLElement(aNodeInfo)

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше