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

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

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

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

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

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

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

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

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

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

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

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

@ -176,12 +176,6 @@ public:
*/ */
already_AddRefed<nsIPresShell> GetPresShell(); 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: protected:
nsPresContext* GetPresContext(); nsPresContext* GetPresContext();

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

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

@ -58,65 +58,56 @@ public:
NS_DECL_NSIOBSERVER NS_DECL_NSIOBSERVER
// nsIAccessibilityService // nsIAccessibilityService
virtual nsAccessible* GetAccessibleInShell(nsIDOMNode *aNode, virtual nsAccessible* GetAccessibleInShell(nsINode* aNode,
nsIPresShell *aPresShell); nsIPresShell* aPresShell);
virtual nsresult CreateOuterDocAccessible(nsIDOMNode *aNode, virtual already_AddRefed<nsAccessible>
nsIAccessible **aAccessible); CreateHTMLBRAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
virtual nsresult CreateHTML4ButtonAccessible(nsIFrame *aFrame, virtual already_AddRefed<nsAccessible>
nsIAccessible **aAccessible); CreateHTML4ButtonAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
virtual nsresult CreateHyperTextAccessible(nsIFrame *aFrame, virtual already_AddRefed<nsAccessible>
nsIAccessible **aAccessible); CreateHTMLButtonAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
virtual nsresult CreateHTMLBRAccessible(nsIFrame *aFrame, virtual already_AddRefed<nsAccessible>
nsIAccessible **aAccessible); CreateHTMLCaptionAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
virtual nsresult CreateHTMLButtonAccessible(nsIFrame *aFrame, virtual already_AddRefed<nsAccessible>
nsIAccessible **aAccessible); CreateHTMLCheckboxAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
virtual nsresult CreateHTMLLIAccessible(nsIFrame *aFrame, virtual already_AddRefed<nsAccessible>
nsIFrame *aBulletFrame, CreateHTMLComboboxAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
const nsAString& aBulletText, virtual already_AddRefed<nsAccessible>
nsIAccessible **aAccessible); CreateHTMLGroupboxAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
virtual nsresult CreateHTMLCheckboxAccessible(nsIFrame *aFrame, virtual already_AddRefed<nsAccessible>
nsIAccessible **aAccessible); CreateHTMLHRAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
virtual nsresult CreateHTMLComboboxAccessible(nsIDOMNode *aNode, virtual already_AddRefed<nsAccessible>
nsIWeakReference *aPresShell, CreateHTMLImageAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
nsIAccessible **aAccessible); virtual already_AddRefed<nsAccessible>
virtual nsresult CreateHTMLGenericAccessible(nsIFrame *aFrame, CreateHTMLLabelAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
nsIAccessible **aAccessible); virtual already_AddRefed<nsAccessible>
virtual nsresult CreateHTMLGroupboxAccessible(nsIFrame *aFrame, CreateHTMLLIAccessible(nsIContent* aContent, nsIPresShell* aPresShell,
nsIAccessible **aAccessible); const nsAString& aBulletText);
virtual nsresult CreateHTMLHRAccessible(nsIFrame *aFrame, virtual already_AddRefed<nsAccessible>
nsIAccessible **aAccessible); CreateHTMLListboxAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
virtual nsresult CreateHTMLImageAccessible(nsIFrame *aFrame, virtual already_AddRefed<nsAccessible>
nsIAccessible **aAccessible); CreateHTMLMediaAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
virtual nsresult CreateHTMLLabelAccessible(nsIFrame *aFrame, virtual already_AddRefed<nsAccessible>
nsIAccessible **aAccessible); CreateHTMLObjectFrameAccessible(nsObjectFrame* aFrame, nsIContent* aContent,
virtual nsresult CreateHTMLListboxAccessible(nsIDOMNode *aNode, nsIPresShell* aPresShell);
nsIWeakReference *aPresShell, virtual already_AddRefed<nsAccessible>
nsIAccessible **aAccessible); CreateHTMLRadioButtonAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
virtual nsresult CreateHTMLMediaAccessible(nsIFrame *aFrame, virtual already_AddRefed<nsAccessible>
nsIAccessible **aAccessible); CreateHTMLTableAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
virtual nsresult CreateHTMLObjectFrameAccessible(nsObjectFrame *aFrame, virtual already_AddRefed<nsAccessible>
nsIAccessible **aAccessible); CreateHTMLTableCellAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
virtual nsresult CreateHTMLRadioButtonAccessible(nsIFrame *aFrame, virtual already_AddRefed<nsAccessible>
nsIAccessible **aAccessible); CreateHTMLTextAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
virtual nsresult CreateHTMLSelectOptionAccessible(nsIDOMNode *aNode, virtual already_AddRefed<nsAccessible>
nsIAccessible *aAccParent, CreateHTMLTextFieldAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
nsIWeakReference *aPresShell, virtual already_AddRefed<nsAccessible>
nsIAccessible **aAccessible); CreateHyperTextAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
virtual nsresult CreateHTMLTableAccessible(nsIFrame *aFrame, virtual already_AddRefed<nsAccessible>
nsIAccessible **aAccessible); CreateOuterDocAccessible(nsIContent* aContent, nsIPresShell* aPresShell);
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 nsresult AddNativeRootAccessible(void *aAtkAccessible, virtual nsAccessible* AddNativeRootAccessible(void* aAtkAccessible);
nsIAccessible **aAccessible); virtual void RemoveNativeRootAccessible(nsAccessible* aRootAccessible);
virtual nsresult RemoveNativeRootAccessible(nsIAccessible *aRootAccessible);
virtual nsresult InvalidateSubtreeFor(nsIPresShell *aPresShell, virtual nsresult InvalidateSubtreeFor(nsIPresShell *aPresShell,
nsIContent *aContent, nsIContent *aContent,
@ -240,52 +231,39 @@ private:
*/ */
void Shutdown(); 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. * Return accessible for HTML area element associated with an image map.
*/ */
already_AddRefed<nsAccessible> nsAccessible* GetAreaAccessible(nsIFrame* aImageFrame, nsINode* aAreaNode,
GetAreaAccessible(nsIFrame *aImageFrame, nsINode *aAreaNode, nsIWeakReference* aWeakShell);
nsIWeakReference *aWeakShell);
/** /**
* Create accessible for the element implementing nsIAccessibleProvider * Create accessible for the element implementing nsIAccessibleProvider
* interface. * interface.
*/ */
already_AddRefed<nsAccessible> already_AddRefed<nsAccessible>
CreateAccessibleByType(nsIContent *aContent, nsIWeakReference *aWeakShell); CreateAccessibleByType(nsIContent* aContent, nsIWeakReference* aWeakShell);
/** /**
* Create accessible for HTML node by tag name. * Create accessible for HTML node by tag name.
*/ */
already_AddRefed<nsAccessible> already_AddRefed<nsAccessible>
CreateHTMLAccessibleByMarkup(nsIFrame *aFrame, nsIWeakReference *aWeakShell, CreateHTMLAccessibleByMarkup(nsIFrame* aFrame, nsIContent* aContent,
nsINode *aNode); nsIWeakReference* aWeakShell);
/** /**
* Create accessible if parent is a deck frame. * Create accessible if parent is a deck frame.
*/ */
already_AddRefed<nsAccessible> already_AddRefed<nsAccessible>
CreateAccessibleForDeckChild(nsIFrame *aFrame, nsIContent *aContent, CreateAccessibleForDeckChild(nsIFrame* aFrame, nsIContent* aContent,
nsIWeakReference *aWeakShell); nsIWeakReference* aWeakShell);
#ifdef MOZ_XUL #ifdef MOZ_XUL
/** /**
* Create accessible for XUL tree element. * Create accessible for XUL tree element.
*/ */
already_AddRefed<nsAccessible> already_AddRefed<nsAccessible>
CreateAccessibleForXULTree(nsIContent *aContent, CreateAccessibleForXULTree(nsIContent* aContent, nsIWeakReference* aWeakShell);
nsIWeakReference *aWeakShell);
#endif #endif
/** /**
@ -329,7 +307,7 @@ static const char kRoleNames[][20] = {
"nothing", //ROLE_NOTHING "nothing", //ROLE_NOTHING
"titlebar", //ROLE_TITLEBAR "titlebar", //ROLE_TITLEBAR
"menubar", //ROLE_MENUBAR "menubar", //ROLE_MENUBAR
"scrollbar", //ROLE_SCROLLBAR "scrollbar", //ROLE_SCROLLBAR
"grip", //ROLE_GRIP "grip", //ROLE_GRIP
"sound", //ROLE_SOUND "sound", //ROLE_SOUND
"cursor", //ROLE_CURSOR "cursor", //ROLE_CURSOR
@ -446,7 +424,7 @@ static const char kRoleNames[][20] = {
"listbox option", //ROLE_OPTION "listbox option", //ROLE_OPTION
"listbox rich option", //ROLE_RICH_OPTION "listbox rich option", //ROLE_RICH_OPTION
"listbox", //ROLE_LISTBOX "listbox", //ROLE_LISTBOX
"flat equation", //ROLE_FLAT_EQUATION "flat equation", //ROLE_FLAT_EQUATION
"gridcell", //ROLE_GRID_CELL "gridcell", //ROLE_GRID_CELL
"embedded object" //ROLE_EMBEDDED_OBJECT "embedded object" //ROLE_EMBEDDED_OBJECT
}; };

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -1124,7 +1124,8 @@ nsXULTreeItemAccessibleBase::IsExpandable()
nsCOMPtr<nsITreeColumn> primaryColumn; nsCOMPtr<nsITreeColumn> primaryColumn;
if (columns) { if (columns) {
columns->GetPrimaryColumn(getter_AddRefs(primaryColumn)); columns->GetPrimaryColumn(getter_AddRefs(primaryColumn));
if (!nsCoreUtils::IsColumnHidden(primaryColumn)) if (primaryColumn &&
!nsCoreUtils::IsColumnHidden(primaryColumn))
return PR_TRUE; 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.testpilot.homepageURL", "https://testpilot.mozillalabs.com/");
pref("extensions.input.happyURL", "http://input.mozilla.com/happy"); pref("extensions.input.happyURL", "https://input.mozilla.com/happy");
pref("extensions.input.sadURL", "http://input.mozilla.com/sad"); pref("extensions.input.sadURL", "https://input.mozilla.com/sad");

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

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

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

@ -201,7 +201,8 @@ toolbarbutton.bookmark-item {
%ifdef MENUBAR_CAN_AUTOHIDE %ifdef MENUBAR_CAN_AUTOHIDE
#toolbar-menubar:not([autohide="true"]) ~ #nav-bar > #bookmarks-menu-button-container, #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; display: none;
} }
%endif %endif
@ -316,3 +317,13 @@ window[chromehidden~="toolbar"] toolbar:not(.toolbar-primary):not(.chromeclass-m
-moz-appearance: none; -moz-appearance: none;
-moz-window-shadow: 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 titleText = null;
var XLinkTitleText = null; var XLinkTitleText = null;
var SVGTitleText = null; var SVGTitleText = null;
#ifdef MOZ_SVG
var lookingForSVGTitle = true; var lookingForSVGTitle = true;
#else
var lookingForSVGTitle = false;
#endif // MOZ_SVG
var direction = tipElement.ownerDocument.dir; var direction = tipElement.ownerDocument.dir;
while (!titleText && !XLinkTitleText && !SVGTitleText && tipElement) { while (!titleText && !XLinkTitleText && !SVGTitleText && tipElement) {
@ -4104,7 +4108,11 @@ var XULBrowserWindow = {
let nBox = gBrowser.getNotificationBox(selectedBrowser); let nBox = gBrowser.getNotificationBox(selectedBrowser);
nBox.removeTransientNotifications(); nBox.removeTransientNotifications();
PopupNotifications.locationChange(); // 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); gNavToolbox.setAttribute("tabsontop", !!val);
this.syncCommand(); 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; return val;
} }
} }
#ifdef MENUBAR_CAN_AUTOHIDE #ifdef MENUBAR_CAN_AUTOHIDE
function updateAppButtonDisplay() { function updateAppButtonDisplay() {
document.getElementById("appmenu-button-container").hidden = var menubarHidden =
document.getElementById("toolbar-menubar").getAttribute("autohide") != "true"; 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 #endif

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

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

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

@ -37,5 +37,5 @@ function test()
finish(); finish();
}, true); }, 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) { onShown: function (popup) {
// This also checks that only one element is shown. // This also checks that only one element is shown.
checkPopup(popup, this.notifyObj2); checkPopup(popup, this.notifyObj2);
is(document.getElementById("geo-notification-icon").boxObject.width, 0,
"geo anchor shouldn't be visible");
dismissNotification(popup); dismissNotification(popup);
}, },
onHidden: function (popup) { onHidden: function (popup) {
@ -325,6 +327,23 @@ var tests = [
this.notification.remove(); 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) { 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://global/content/console.xul chrome://browser/content/jsConsoleOverlay.xul
% overlay chrome://mozapps/content/update/updates.xul chrome://browser/content/softwareUpdateOverlay.xul % overlay chrome://mozapps/content/update/updates.xul chrome://browser/content/softwareUpdateOverlay.xul
#endif #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/viewSource.xul chrome://browser/content/viewSourceOverlay.xul
% overlay chrome://global/content/viewPartialSource.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 % style chrome://global/content/customizeToolbar.xul chrome://browser/content/browser.css
@ -59,6 +62,9 @@ browser.jar:
* content/browser/softwareUpdateOverlay.xul (content/softwareUpdateOverlay.xul) * content/browser/softwareUpdateOverlay.xul (content/softwareUpdateOverlay.xul)
#endif #endif
* content/browser/viewSourceOverlay.xul (content/viewSourceOverlay.xul) * 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 # the following files are browser-specific overrides
* content/browser/license.html (/toolkit/content/license.html) * content/browser/license.html (/toolkit/content/license.html)
% override chrome://global/content/license.html chrome://browser/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); searchBar.addEventListener("popupshowing", stopPopup, true);
// drop on the search button so that we don't need to worry about the // drop on the search button so that we don't need to worry about the
// default handlers for textboxes. // 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) { doOnloadOnce(function(event) {
is(searchBar.value, "Some Text", "drop text/plain on searchbar"); is(searchBar.value, "Some Text", "drop text/plain on searchbar");
testDropInternalText(); testDropInternalText();
@ -146,7 +146,7 @@ function test() {
function testDropInternalText() { function testDropInternalText() {
init(); 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) { doOnloadOnce(function(event) {
is(searchBar.value, "More Text", "drop text/x-moz-text-internal on searchbar"); is(searchBar.value, "More Text", "drop text/x-moz-text-internal on searchbar");
testDropLink(); testDropLink();
@ -155,7 +155,7 @@ function test() {
function testDropLink() { function testDropLink() {
init(); 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"); is(searchBar.value, "More Text", "drop text/uri-list on searchbar");
SimpleTest.executeSoon(testRightClick); SimpleTest.executeSoon(testRightClick);
} }

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

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

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

@ -13,7 +13,9 @@ droponhomemsg=Do you want this document to be your new home page?
# context menu strings # 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 contextMenuSearchText.accesskey=S
blockImages=Block Images from %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"); 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; -moz-box-orient: horizontal;
} }

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

@ -328,14 +328,8 @@ toolbar[mode="icons"] toolbarbutton[type="menu-button"] > .toolbarbutton-menubut
#restore-button > .toolbarbutton-icon, #restore-button > .toolbarbutton-icon,
toolbarbutton[type="menu-button"] > .toolbarbutton-menubutton-button > .toolbarbutton-icon { toolbarbutton[type="menu-button"] > .toolbarbutton-menubutton-button > .toolbarbutton-icon {
padding: 0; padding: 0;
max-height: 20px; height: 20px;
} width: 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;
} }
.toolbarbutton-1[disabled="true"] > .toolbarbutton-icon, .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"); 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; -moz-box-orient: horizontal;
} }

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

@ -24,6 +24,11 @@
background: transparent; 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"] { #main-window:not(:-moz-lwtheme)[inFullscreen="true"] {
-moz-appearance: none; -moz-appearance: none;
background-color: #556; background-color: #556;

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

@ -124,12 +124,15 @@ statusbarpanel#statusbar-display {
rgba(255,255,255,0) 50%); rgba(255,255,255,0) 50%);
background-clip: padding-box; background-clip: padding-box;
border: 1px solid rgba(0,0,0,.5); 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; -moz-box-shadow: 0 0 5px rgba(255,255,255,.5) inset;
color: white; color: white;
text-shadow: 0 0 2px #333; text-shadow: 0 0 2px #333;
font-weight: bold; font-weight: bold;
padding: .2em 2em; padding: .1em 1.5em;
margin: 0;
} }
#appmenu-button:hover:not(:active):not([open]) { #appmenu-button:hover:not(:active):not([open]) {
@ -160,6 +163,31 @@ statusbarpanel#statusbar-display {
-moz-padding-end: 16px; -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 ::::: */ /* ::::: bookmark buttons ::::: */
toolbarbutton.bookmark-item { 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-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[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); background-color: hsla(190,60%,70%,.5);
border-color: hsla(190,50%,65%,.8) hsla(190,50%,50%,.8) hsla(190,50%,40%,.8); 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, -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"); 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; -moz-box-orient: horizontal;
} }

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

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

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

@ -583,7 +583,7 @@ user_pref("camino.use_system_proxy_settings", false); // Camino-only, harmless t
if not pHandle: if not pHandle:
return False return False
pExitCode = ctypes.wintypes.DWORD() 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) ctypes.windll.kernel32.CloseHandle(pHandle)
if (pExitCode.value == STILL_ACTIVE): if (pExitCode.value == STILL_ACTIVE):
return True 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") self.log.info("Can't trigger Breakpad, just killing process")
proc.kill() 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 """ """ Look for timeout or crashes and return the status after the process terminates """
stackFixerProcess = None stackFixerProcess = None
stackFixerModule = None stackFixerFunction = None
didTimeout = False didTimeout = False
if proc.stdout is None: if proc.stdout is None:
self.log.info("TEST-INFO: Not logging stdout or stderr due to debugger connection") self.log.info("TEST-INFO: Not logging stdout or stderr due to debugger connection")
else: else:
logsource = proc.stdout 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")], stackFixerProcess = self.Process([self.PERL, os.path.join(utilityPath, "fix-linux-stack.pl")],
stdin=logsource, stdin=logsource,
stdout=subprocess.PIPE) stdout=subprocess.PIPE)
logsource = stackFixerProcess.stdout 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) (line, didTimeout) = self.readWithTimeout(logsource, timeout)
hitMaxTime = False hitMaxTime = False
while line != "" and not didTimeout: while line != "" and not didTimeout:
if "TEST-START" in line and "|" in line: if "TEST-START" in line and "|" in line:
self.lastTestSeen = line.split("|")[1].strip() self.lastTestSeen = line.split("|")[1].strip()
if stackFixerModule: if stackFixerFunction:
line = stackFixerModule.fixSymbols(line) line = stackFixerFunction(line)
self.log.info(line.rstrip()) self.log.info(line.rstrip())
(line, didTimeout) = self.readWithTimeout(logsource, timeout) (line, didTimeout) = self.readWithTimeout(logsource, timeout)
if not hitMaxTime and maxTime and datetime.now() - startTime > timedelta(seconds = maxTime): 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) stderr = subprocess.STDOUT)
self.log.info("INFO | automation.py | Application pid: %d", proc.pid) 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)) self.log.info("INFO | automation.py | Application ran for: %s", str(datetime.now() - startTime))
# Do a final check for zombie child processes. # Do a final check for zombie child processes.

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

@ -66,7 +66,7 @@ class RemoteAutomation(Automation):
def setProduct(self, product): def setProduct(self, product):
self._product = 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 # maxTime is used to override the default timeout, we should honor that
status = proc.wait(timeout = maxTime) status = proc.wait(timeout = maxTime)

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -503,6 +503,13 @@ FAIL_ON_WARNINGS_DEBUG=
FAIL_ON_WARNINGS= FAIL_ON_WARNINGS=
endif # WINNT && (MOS_PROFILE_GENERATE ^ MOZ_PROFILE_USE) 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. # Now, check for debug version of flag; it turns on normal flag in debug builds.
ifdef FAIL_ON_WARNINGS_DEBUG ifdef FAIL_ON_WARNINGS_DEBUG
ifdef MOZ_DEBUG ifdef MOZ_DEBUG

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

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

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

@ -666,14 +666,12 @@ case "$target" in
elif test "$_CC_MAJOR_VERSION" = "15"; then elif test "$_CC_MAJOR_VERSION" = "15"; then
_CC_SUITE=9 _CC_SUITE=9
CXXFLAGS="$CXXFLAGS -Zc:wchar_t-" CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
LDFLAGS="$LDFLAGS -MANIFESTUAC:NO"
_USE_DYNAMICBASE=1 _USE_DYNAMICBASE=1
AC_DEFINE(_CRT_SECURE_NO_WARNINGS) AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS) AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
elif test "$_CC_MAJOR_VERSION" = "16"; then elif test "$_CC_MAJOR_VERSION" = "16"; then
_CC_SUITE=10 _CC_SUITE=10
CXXFLAGS="$CXXFLAGS -Zc:wchar_t-" CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
LDFLAGS="$LDFLAGS -MANIFESTUAC:NO"
_USE_DYNAMICBASE=1 _USE_DYNAMICBASE=1
AC_DEFINE(_CRT_SECURE_NO_WARNINGS) AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS) AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
@ -1234,8 +1232,6 @@ USE_DEPENDENT_LIBS=1
_PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2 _PLATFORM_DEFAULT_TOOLKIT=cairo-gtk2
MOZ_ENABLE_POSTSCRIPT=1
if test -n "$CROSS_COMPILE"; then if test -n "$CROSS_COMPILE"; then
OS_TARGET="${target_os}" OS_TARGET="${target_os}"
OS_ARCH=`echo $target_os | sed -e 's|/|_|g'` 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' _DEFINES_CFLAGS='-include $(DEPTH)/mozilla-config.h -DMOZILLA_CLIENT'
_USE_CPP_INCLUDE_FLAG=1 _USE_CPP_INCLUDE_FLAG=1
elif test "$SOLARIS_SUNPRO_CC"; then 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='' DSO_CFLAGS=''
if test "$CPU_ARCH" = "sparc"; then if test "$CPU_ARCH" = "sparc"; then
# for Sun Studio on Solaris/SPARC # for Sun Studio on Solaris/SPARC
@ -2041,7 +2028,6 @@ case "$target" in
DSO_LDOPTS='' DSO_LDOPTS=''
STRIP="$STRIP -x -S" STRIP="$STRIP -x -S"
_PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa' _PLATFORM_DEFAULT_TOOLKIT='cairo-cocoa'
MOZ_ENABLE_POSTSCRIPT=
TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"' TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
# The ExceptionHandling framework is needed for Objective-C exception # The ExceptionHandling framework is needed for Objective-C exception
# logging code in nsObjCExceptions.h. Currently we only use that in debug # logging code in nsObjCExceptions.h. Currently we only use that in debug
@ -2308,7 +2294,6 @@ ia64*-hpux*)
TARGET_MD_ARCH=win32 TARGET_MD_ARCH=win32
_PLATFORM_DEFAULT_TOOLKIT='cairo-windows' _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
BIN_SUFFIX='.exe' BIN_SUFFIX='.exe'
MOZ_ENABLE_POSTSCRIPT=
MOZ_USER_DIR="Mozilla" MOZ_USER_DIR="Mozilla"
MOZ_GFX_OPTIMIZE_MOBILE=1 MOZ_GFX_OPTIMIZE_MOBILE=1
@ -2431,7 +2416,6 @@ ia64*-hpux*)
TARGET_MD_ARCH=win32 TARGET_MD_ARCH=win32
_PLATFORM_DEFAULT_TOOLKIT='cairo-windows' _PLATFORM_DEFAULT_TOOLKIT='cairo-windows'
BIN_SUFFIX='.exe' BIN_SUFFIX='.exe'
MOZ_ENABLE_POSTSCRIPT=
MOZ_USER_DIR="Mozilla" MOZ_USER_DIR="Mozilla"
dnl Hardcode to win95 for now - cls 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' 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 TARGET_MD_ARCH=os2
_PLATFORM_DEFAULT_TOOLKIT="cairo-os2" _PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
MOZ_ENABLE_POSTSCRIPT=
RC=rc.exe RC=rc.exe
RCFLAGS='-n' RCFLAGS='-n'
MOZ_USER_DIR="Mozilla" MOZ_USER_DIR="Mozilla"
@ -2722,19 +2705,19 @@ alpha*-*-osf*)
AC_DEFINE(SOLARIS) AC_DEFINE(SOLARIS)
TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"' TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
SYSTEM_MAKEDEPEND= SYSTEM_MAKEDEPEND=
MOZ_FIX_LINK_PATHS=
# $ORIGIN/.. is for shared libraries under components/ to locate shared # $ORIGIN/.. is for shared libraries under components/ to locate shared
# libraries one level up (e.g. libnspr4.so) # libraries one level up (e.g. libnspr4.so)
LDFLAGS="$LDFLAGS -z ignore -R '\$\$ORIGIN:\$\$ORIGIN/..'"
if test "$SOLARIS_SUNPRO_CC"; then 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 NS_USE_NATIVE=1
MOZ_FIX_LINK_PATHS=
AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES) AC_DEFINE(NSCAP_DISABLE_DEBUG_PTR_TYPES)
CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all" CFLAGS="$CFLAGS -xlibmieee -xstrconst -xbuiltin=%all -D__FUNCTION__=__func__"
CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic -norunpath" CXXFLAGS="$CXXFLAGS -xlibmieee -xbuiltin=%all -features=tmplife,tmplrefstatic,extensions -norunpath -D__FUNCTION__=__func__"
_MOZ_EXCEPTIONS_FLAGS_ON='-features=except' _MOZ_EXCEPTIONS_FLAGS_ON='-features=except'
_MOZ_EXCEPTIONS_FLAGS_OFF='-features=no%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 if test -z "$CROSS_COMPILE" && test -f /usr/lib/ld/map.noexstk; then
_SAVE_LDFLAGS=$LDFLAGS _SAVE_LDFLAGS=$LDFLAGS
LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS" LDFLAGS="-M /usr/lib/ld/map.noexstk $LDFLAGS"
@ -2746,10 +2729,10 @@ alpha*-*-osf*)
WARNINGS_AS_ERRORS='-Werror' WARNINGS_AS_ERRORS='-Werror'
MOZ_OPTIMIZE_FLAGS="-xO4" MOZ_OPTIMIZE_FLAGS="-xO4"
MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_FLAGS) $(DSO_LDOPTS) -h $@ -o $@' 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_FORCE_ALL='-z allextract'
MKSHLIB_UNFORCE_ALL='-z defaultextract' MKSHLIB_UNFORCE_ALL='-z defaultextract'
DSO_LDOPTS='-G -z muldefs' DSO_LDOPTS='-G'
AR_LIST="$AR t" AR_LIST="$AR t"
AR_EXTRACT="$AR x" AR_EXTRACT="$AR x"
AR_DELETE="$AR d" AR_DELETE="$AR d"
@ -2769,25 +2752,38 @@ alpha*-*-osf*)
#error "Denied" #error "Denied"
#endif], #endif],
_BAD_COMPILER=,_BAD_COMPILER=1) _BAD_COMPILER=,_BAD_COMPILER=1)
if test -n "$_BAD_COMPILER"; then if test -n "$_BAD_COMPILER"; then
_res="no" _res="no"
AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .]) AC_MSG_ERROR([Sun C++ 5.9 (Sun Studio 12) or higher is required to build. Your compiler version is $CXX_VERSION .])
else else
_res="yes" _res="yes"
fi fi
AC_MSG_RESULT([$_res]) AC_TRY_COMPILE([],
AC_LANG_RESTORE [#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 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" ASFLAGS="$ASFLAGS -fPIC"
DSO_LDOPTS='-G' DSO_LDOPTS='-shared'
_WARNINGS_CFLAGS='' _WARNINGS_CFLAGS=''
_WARNINGS_CXXFLAGS='' _WARNINGS_CXXFLAGS=''
if test "$OS_RELEASE" = "5.3"; then if test "$OS_RELEASE" = "5.3"; then
AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES) AC_DEFINE(MUST_UNDEF_HAVE_BOOLEAN_AFTER_INCLUDES)
fi fi
fi fi
if test "$OS_RELEASE" = "5.5.1"; then if test "$OS_RELEASE" = "5.5.1"; then
AC_DEFINE(NEED_USLEEP_PROTOTYPE) AC_DEFINE(NEED_USLEEP_PROTOTYPE)
fi fi
;; ;;
@ -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 Detect if we can use an assembler to compile optimized assembly for libvpx.
dnl For Win32 (MSVC) we must use MASM. 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_MSG_CHECKING([for MASM assembler])
AC_CHECK_PROGS(VPX_AS, ml, "") AC_CHECK_PROGS(VPX_AS, ml, "")
if test -n "$VPX_AS"; then if test -n "$VPX_AS"; then
@ -5936,6 +5932,14 @@ if test -n "$MOZ_WEBM"; then
VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC" VPX_ASFLAGS="-f elf64 -rnasm -pnasm -DPIC"
VPX_X86_ASM=1 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) Darwin:i?86)
VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC" VPX_ASFLAGS="-f macho32 -rnasm -pnasm -DPIC"
VPX_X86_ASM=1 VPX_X86_ASM=1
@ -5945,8 +5949,10 @@ if test -n "$MOZ_WEBM"; then
VPX_X86_ASM=1 VPX_X86_ASM=1
;; ;;
WINNT:x86_64) WINNT:x86_64)
VPX_ASFLAGS="-f x64 -rnasm -pnasm" if test -z "$GNU_CC"; then
VPX_X86_ASM=1 VPX_ASFLAGS="-f x64 -rnasm -pnasm"
VPX_X86_ASM=1
fi
;; ;;
esac esac
fi # end have YASM fi # end have YASM
@ -8710,7 +8716,6 @@ AC_SUBST(MOZ_PROFILELOCKING)
AC_SUBST(HAVE_XIE) AC_SUBST(HAVE_XIE)
AC_SUBST(MOZ_XIE_LIBS) AC_SUBST(MOZ_XIE_LIBS)
AC_SUBST(MOZ_ENABLE_POSTSCRIPT)
AC_SUBST(BUILD_STATIC_LIBS) AC_SUBST(BUILD_STATIC_LIBS)
AC_SUBST(MOZ_ENABLE_LIBXUL) AC_SUBST(MOZ_ENABLE_LIBXUL)

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

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

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

@ -44,6 +44,13 @@ interface nsISelection;
interface nsIDOMNode; interface nsIDOMNode;
interface nsIOutputStream; interface nsIOutputStream;
%{ C++
class nsINode;
class nsIDocument;
%}
[ptr] native nsINodePtr(nsINode);
[ptr] native nsIDocumentPtr(nsIDocument);
[scriptable, uuid(c0da5b87-0ba7-4d7c-8cb3-fcb02af4253d)] [scriptable, uuid(c0da5b87-0ba7-4d7c-8cb3-fcb02af4253d)]
interface nsIDocumentEncoderNodeFixup : nsISupports interface nsIDocumentEncoderNodeFixup : nsISupports
{ {
@ -61,7 +68,7 @@ interface nsIDocumentEncoderNodeFixup : nsISupports
nsIDOMNode fixupNode(in nsIDOMNode aNode, out boolean aSerializeCloneKids); 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 interface nsIDocumentEncoder : nsISupports
{ {
// Output methods flag bits. There are a frightening number of these, // Output methods flag bits. There are a frightening number of these,
@ -238,6 +245,9 @@ interface nsIDocumentEncoder : nsISupports
void init(in nsIDOMDocument aDocument, void init(in nsIDOMDocument aDocument,
in AString aMimeType, in AString aMimeType,
in unsigned long aFlags); 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 * 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. * @param aContainer The node which child nodes will be encoded.
*/ */
void setContainerNode(in nsIDOMNode aContainer); void setContainerNode(in nsIDOMNode aContainer);
[noscript] void setNativeContainerNode(in nsINodePtr aContainer);
/** /**
* Documents typically have an intrinsic character set, * 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? // XXXbz don't we want to support this as an HTTP header too?
nsAutoString value(aValue); nsAutoString value(aValue);
if (value.LowerCaseEqualsLiteral("no")) { if (value.LowerCaseEqualsLiteral("no")) {
nsIPresShell* shell = mDocument->GetPrimaryShell(); nsIPresShell* shell = mDocument->GetShell();
if (shell) { if (shell) {
shell->DisableThemeSupport(); shell->DisableThemeSupport();
} }
@ -1267,7 +1267,7 @@ nsContentSink::StartLayout(PRBool aIgnorePendingSheets)
mLastNotificationTime = PR_Now(); mLastNotificationTime = PR_Now();
mDocument->SetMayStartLayout(PR_TRUE); 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 // Make sure we don't call InitialReflow() for a shell that has
// already called it. This can happen when the layout frame for // already called it. This can happen when the layout frame for
// an iframe is constructed *between* the Embed() call for the // an iframe is constructed *between* the Embed() call for the
@ -1463,7 +1463,7 @@ nsContentSink::DidProcessATokenImpl()
} }
// Get the current user event time // Get the current user event time
nsIPresShell *shell = mDocument->GetPrimaryShell(); nsIPresShell *shell = mDocument->GetShell();
if (!shell) { if (!shell) {
// If there's no pres shell in the document, return early since // If there's no pres shell in the document, return early since
// we're not laying anything out here. // we're not laying anything out here.
@ -1631,7 +1631,7 @@ nsContentSink::WillParseImpl(void)
return NS_OK; return NS_OK;
} }
nsIPresShell *shell = mDocument->GetPrimaryShell(); nsIPresShell *shell = mDocument->GetShell();
if (!shell) { if (!shell) {
return NS_OK; return NS_OK;
} }

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

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

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

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

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

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

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

@ -81,6 +81,7 @@
#include "nsReadableUtils.h" #include "nsReadableUtils.h"
#include "nsTArray.h" #include "nsTArray.h"
#include "nsIFrame.h" #include "nsIFrame.h"
#include "nsStringBuffer.h"
nsresult NS_NewDomSelection(nsISelection **aDomSelection); nsresult NS_NewDomSelection(nsISelection **aDomSelection);
@ -95,12 +96,12 @@ public:
nsDocumentEncoder(); nsDocumentEncoder();
virtual ~nsDocumentEncoder(); virtual ~nsDocumentEncoder();
NS_DECL_ISUPPORTS NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(nsDocumentEncoder)
NS_DECL_NSIDOCUMENTENCODER NS_DECL_NSIDOCUMENTENCODER
protected: protected:
void Initialize(); void Initialize(PRBool aClearCachedSerializer = PR_TRUE);
nsresult SerializeNodeStart(nsINode* aNode, PRInt32 aStartOffset, nsresult SerializeNodeStart(nsINode* aNode, PRInt32 aStartOffset,
PRInt32 aEndOffset, nsAString& aStr, PRInt32 aEndOffset, nsAString& aStr,
nsINode* aOriginalNode = nsnull); nsINode* aOriginalNode = nsnull);
@ -175,24 +176,43 @@ protected:
PRPackedBool mHaltRangeHint; PRPackedBool mHaltRangeHint;
PRPackedBool mIsCopying; // Set to PR_TRUE only while copying PRPackedBool mIsCopying; // Set to PR_TRUE only while copying
PRPackedBool mNodeIsContainer; PRPackedBool mNodeIsContainer;
nsStringBuffer* mCachedBuffer;
}; };
NS_IMPL_ADDREF(nsDocumentEncoder) NS_IMPL_CYCLE_COLLECTION_CLASS(nsDocumentEncoder)
NS_IMPL_RELEASE(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(nsIDocumentEncoder)
NS_INTERFACE_MAP_ENTRY(nsISupports) NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END 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(); Initialize();
mMimeType.AssignLiteral("text/plain"); mMimeType.AssignLiteral("text/plain");
} }
void nsDocumentEncoder::Initialize() void nsDocumentEncoder::Initialize(PRBool aClearCachedSerializer)
{ {
mFlags = 0; mFlags = 0;
mWrapColumn = 72; mWrapColumn = 72;
@ -202,10 +222,16 @@ void nsDocumentEncoder::Initialize()
mEndRootIndex = 0; mEndRootIndex = 0;
mHaltRangeHint = PR_FALSE; mHaltRangeHint = PR_FALSE;
mNodeIsContainer = PR_FALSE; mNodeIsContainer = PR_FALSE;
if (aClearCachedSerializer) {
mSerializer = nsnull;
}
} }
nsDocumentEncoder::~nsDocumentEncoder() nsDocumentEncoder::~nsDocumentEncoder()
{ {
if (mCachedBuffer) {
mCachedBuffer->Release();
}
} }
NS_IMETHODIMP NS_IMETHODIMP
@ -216,10 +242,23 @@ nsDocumentEncoder::Init(nsIDOMDocument* aDocument,
if (!aDocument) if (!aDocument)
return NS_ERROR_INVALID_ARG; return NS_ERROR_INVALID_ARG;
Initialize(); nsCOMPtr<nsIDocument> doc = do_QueryInterface(aDocument);
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
mDocument = do_QueryInterface(aDocument); return NativeInit(doc, aMimeType, aFlags);
NS_ENSURE_TRUE(mDocument, NS_ERROR_FAILURE); }
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; mMimeType = aMimeType;
@ -266,6 +305,14 @@ nsDocumentEncoder::SetContainerNode(nsIDOMNode *aContainer)
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP
nsDocumentEncoder::SetNativeContainerNode(nsINode* aContainer)
{
mNodeIsContainer = PR_TRUE;
mNode = aContainer;
return NS_OK;
}
NS_IMETHODIMP NS_IMETHODIMP
nsDocumentEncoder::SetCharset(const nsACString& aCharset) nsDocumentEncoder::SetCharset(const nsACString& aCharset)
{ {
@ -928,11 +975,26 @@ nsDocumentEncoder::EncodeToString(nsAString& aOutputString)
aOutputString.Truncate(); aOutputString.Truncate();
nsCAutoString progId(NS_CONTENTSERIALIZER_CONTRACTID_PREFIX); nsString output;
AppendUTF16toUTF8(mMimeType, progId); 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;
mSerializer = do_CreateInstance(progId.get()); if (!mSerializer) {
NS_ENSURE_TRUE(mSerializer, NS_ERROR_NOT_IMPLEMENTED); 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; nsresult rv = NS_OK;
@ -966,47 +1028,59 @@ nsDocumentEncoder::EncodeToString(nsAString& aOutputString)
if (node != prevNode) { if (node != prevNode) {
if (prevNode) { if (prevNode) {
nsCOMPtr<nsINode> p = do_QueryInterface(prevNode); nsCOMPtr<nsINode> p = do_QueryInterface(prevNode);
rv = SerializeNodeEnd(p, aOutputString); rv = SerializeNodeEnd(p, output);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
prevNode = nsnull; prevNode = nsnull;
} }
nsCOMPtr<nsIContent> content = do_QueryInterface(node); nsCOMPtr<nsIContent> content = do_QueryInterface(node);
if (content && content->Tag() == nsGkAtoms::tr) { if (content && content->Tag() == nsGkAtoms::tr) {
nsCOMPtr<nsINode> n = do_QueryInterface(node); nsCOMPtr<nsINode> n = do_QueryInterface(node);
rv = SerializeNodeStart(n, 0, -1, aOutputString); rv = SerializeNodeStart(n, 0, -1, output);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
prevNode = node; prevNode = node;
} }
} }
nsCOMPtr<nsIRange> r = do_QueryInterface(range); nsCOMPtr<nsIRange> r = do_QueryInterface(range);
rv = SerializeRangeToString(r, aOutputString); rv = SerializeRangeToString(r, output);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
} }
if (prevNode) { if (prevNode) {
nsCOMPtr<nsINode> p = do_QueryInterface(prevNode); nsCOMPtr<nsINode> p = do_QueryInterface(prevNode);
rv = SerializeNodeEnd(p, aOutputString); rv = SerializeNodeEnd(p, output);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
} }
mSelection = nsnull; mSelection = nsnull;
} else if (mRange) { } else if (mRange) {
rv = SerializeRangeToString(mRange, aOutputString); rv = SerializeRangeToString(mRange, output);
mRange = nsnull; mRange = nsnull;
} else if (mNode) { } else if (mNode) {
rv = SerializeToStringRecursive(mNode, aOutputString, mNodeIsContainer); rv = SerializeToStringRecursive(mNode, output, mNodeIsContainer);
mNode = nsnull; mNode = nsnull;
} else { } else {
rv = mSerializer->AppendDocumentStart(mDocument, aOutputString); rv = mSerializer->AppendDocumentStart(mDocument, output);
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
rv = SerializeToStringRecursive(mDocument, aOutputString, PR_FALSE); rv = SerializeToStringRecursive(mDocument, output, PR_FALSE);
} }
} }
NS_ENSURE_SUCCESS(rv, rv); 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; return rv;
} }

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -86,6 +86,21 @@ public:
NS_IMETHOD Initialize(nsISupports* aOwner, JSContext* aContext, NS_IMETHOD Initialize(nsISupports* aOwner, JSContext* aContext,
JSObject* aObject, PRUint32 aArgc, jsval* aArgv); 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(); static void ReleaseGlobals();
protected: protected:
@ -100,6 +115,14 @@ protected:
// called from mConnection accordingly to the situation // called from mConnection accordingly to the situation
void SetReadyState(PRUint16 aNewReadyState); 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> mOnOpenListener;
nsRefPtr<nsDOMEventListenerWrapper> mOnErrorListener; nsRefPtr<nsDOMEventListenerWrapper> mOnErrorListener;
nsRefPtr<nsDOMEventListenerWrapper> mOnMessageListener; nsRefPtr<nsDOMEventListenerWrapper> mOnMessageListener;
@ -109,6 +132,10 @@ protected:
nsString mOriginalURL; nsString mOriginalURL;
PRPackedBool mSecure; // if true it is using SSL and the wss scheme, PRPackedBool mSecure; // if true it is using SSL and the wss scheme,
// otherwise it is using the ws scheme with no SSL // otherwise it is using the ws scheme with no SSL
PRPackedBool mHasStrongEventListeners;
PRPackedBool mCheckThereAreStrongEventListeners;
nsCString mAsciiHost; // hostname nsCString mAsciiHost; // hostname
PRUint32 mPort; PRUint32 mPort;
nsCString mResource; // [filepath[?query]] nsCString mResource; // [filepath[?query]]

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

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

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

@ -111,6 +111,15 @@ nsXMLContentSerializer::Init(PRUint32 aFlags, PRUint32 aWrapColumn,
const char* aCharSet, PRBool aIsCopying, const char* aCharSet, PRBool aIsCopying,
PRBool aRewriteEncodingDeclaration) 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; mCharset = aCharSet;
mFlags = aFlags; mFlags = aFlags;

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

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

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

@ -6,25 +6,56 @@ import sys
# see the list of tests in test_websocket.html # see the list of tests in test_websocket.html
def web_socket_do_extra_handshake(request): def web_socket_do_extra_handshake(request):
if request.ws_protocol == "test 6": if request.ws_protocol == "test 2.1":
sys.exit(0)
elif request.ws_protocol == "test 19":
time.sleep(180)
pass
elif request.ws_protocol == "test 8":
time.sleep(5) time.sleep(5)
pass pass
elif request.ws_protocol == "test 9": elif request.ws_protocol == "test 9":
time.sleep(5) time.sleep(5)
pass pass
elif request.ws_protocol == "test 10.1": elif request.ws_protocol == "test 10":
time.sleep(5) time.sleep(5)
pass 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: else:
pass pass
def web_socket_transfer_data(request): 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) msgutil.close_connection(request)
elif request.ws_protocol == "test 11": elif request.ws_protocol == "test 11":
resp = "wrong message" resp = "wrong message"
@ -41,27 +72,19 @@ def web_socket_transfer_data(request):
request.connection.write('\xff\x00') request.connection.write('\xff\x00')
msgutil.send_message(request, "server data") msgutil.send_message(request, "server data")
elif request.ws_protocol == "test 15": elif request.ws_protocol == "test 15":
sys.exit (0) msgutil.close_connection(request, True)
elif request.ws_protocol == "test 17": return
while not request.client_terminated: elif request.ws_protocol == "test 17" or request.ws_protocol == "test 21":
msgutil.send_message(request, "server data") time.sleep(5)
time.sleep(1) 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") 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) msgutil.close_connection(request)
while not request.client_terminated: while not request.client_terminated:
msgutil.receive_message(request) 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: * tests:
* 1. client tries to connect to a http scheme location; * 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; * 3. client tries to connect to an non-existent ws server;
* 4. client tries to connect using a relative url; * 4. client tries to connect using a relative url;
* 5. client uses an invalid protocol value; * 5. client uses an invalid protocol value;
* 6. server closes the tcp connection before establishing the ws connection; * 6. counter and encoding check;
* 7. client calls close() and the server sends the close frame in * 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; * acknowledgement;
* 8. client closes the connection before the ws connection is established; * 9. client closes the connection before the ws connection is established;
* 9. client sends a message before the ws connection is established; * 10. client sends a message before the ws connection is established;
* 10. assure serialization of the connections;
* 11. a simple hello echo; * 11. a simple hello echo;
* 12. client sends a message with bad bytes; * 12. client sends a message with bad bytes;
* 13. server sends an invalid message; * 13. server sends an invalid message;
@ -35,54 +36,46 @@
* it keeps sending normal ws messages; * it keeps sending normal ws messages;
* 15. server closes the tcp connection, but it doesn't send the close frame; * 15. server closes the tcp connection, but it doesn't send the close frame;
* 16. client calls close() and tries to send a message; * 16. client calls close() and tries to send a message;
* 17. client calls close() and the server keeps sending messages and it doesn't * 17. see bug 572975 - all event listeners set
* send the close frame; * 18. client tries to connect to an http resource;
* 18. counter and encoding check; * 19. server closes the tcp connection before establishing the ws connection;
* 19. server takes too long to establish 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 first_test = 1;
var last_test = 19; var last_test = 22;
var current_test = 1; var current_test = first_test;
var timeoutToAbortTest = 60000; var timeoutToAbortTest = 60000;
var timeoutToOpenWS = 25000;
var all_ws = []; var all_ws = [];
function shouldNotOpen(e) function shouldNotOpen(e)
{ {
var ws = e.target; var ws = e.target;
ok(false, "onopen shouldn't be called on test " + ws._testNumber + "!"); ok(false, "onopen shouldn't be called on test " + ws._testNumber + "!");
if (ws._timeoutToSucceed != undefined) {
clearTimeout(ws._timeoutToSucceed);
}
} }
function shouldNotReceiveCloseEvent(e) function shouldNotReceiveCloseEvent(e)
{ {
var ws = e.target; var ws = e.target;
ok(false, "onclose shouldn't be called on test " + ws._testNumber + "!"); ok(false, "onclose shouldn't be called on test " + ws._testNumber + "!");
if (ws._timeoutToSucceed != undefined) {
clearTimeout(ws._timeoutToSucceed);
}
} }
function shouldCloseCleanly(e) function shouldCloseCleanly(e)
{ {
var ws = e.target; var ws = e.target;
//ok(e.wasClean, "the ws connection in test " + ws._testNumber + " should be closed cleanly"); ok(e.wasClean, "the ws connection in test " + ws._testNumber + " should be closed cleanly");
if (ws._timeoutToSucceed != undefined) {
clearTimeout(ws._timeoutToSucceed);
}
} }
function shouldCloseNotCleanly(e) function shouldCloseNotCleanly(e)
{ {
var ws = e.target; var ws = e.target;
//ok(!e.wasClean, "the ws connection in test " + ws._testNumber + " shouldn't be closed cleanly"); ok(!e.wasClean, "the ws connection in test " + ws._testNumber + " shouldn't be closed cleanly");
if (ws._timeoutToSucceed != undefined) {
clearTimeout(ws._timeoutToSucceed);
}
} }
function CreateTestWS(ws_location, ws_protocol) function CreateTestWS(ws_location, ws_protocol)
@ -119,6 +112,20 @@ function CreateTestWS(ws_location, ws_protocol)
return ws; 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) function doTest(number)
{ {
if (doTest.timeoutId !== null) { if (doTest.timeoutId !== null) {
@ -163,12 +170,28 @@ function test1()
doTest(2); doTest(2);
} }
// this test expects that the serialization list to connect to the proxy
// is empty
function test2() function test2()
{ {
var ws = CreateTestWS("ws://mochi.test:8888/tests/content/base/test/file_websocket_http_resource.txt"); var ws1 = CreateTestWS("ws://mochi.test:8888/tests/content/base/test/file_websocket", "test 2.1");
ws.onopen = shouldNotOpen; current_test--; // CreateTestWS incremented this
ws.onclose = shouldNotReceiveCloseEvent; var ws2 = CreateTestWS("ws://mochi.test:8888/tests/content/base/test/file_websocket", "test 2.2");
doTest(3);
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() function test3()
@ -183,10 +206,10 @@ function test4()
{ {
try { try {
var ws = CreateTestWS("file_websocket"); var ws = CreateTestWS("file_websocket");
ok(false, "test4 failed"); ok(false, "test 4 failed");
} }
catch (e) { catch (e) {
ok(true, "test4 failed"); ok(true, "test 4 failed");
} }
doTest(5); doTest(5);
} }
@ -214,9 +237,25 @@ function test5()
function test6() function test6()
{ {
var ws = CreateTestWS("ws://mochi.test:8888/tests/content/base/test/file_websocket", "test 6"); var ws = CreateTestWS("ws://mochi.test:8888/tests/content/base/test/file_websocket", "test 6");
ws.onopen = shouldNotOpen; var counter = 1;
ws.onclose = shouldNotReceiveCloseEvent; ws.onopen = function()
doTest(7); {
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() function test7()
@ -228,7 +267,7 @@ function test7()
} }
ws.onclose = function(e) ws.onclose = function(e)
{ {
shouldCloseCleanly(e); shouldCloseNotCleanly(e);
doTest(8); doTest(8);
}; };
ws._receivedCloseEvent = false; ws._receivedCloseEvent = false;
@ -237,20 +276,35 @@ function test7()
function test8() function test8()
{ {
var ws = CreateTestWS("ws://mochi.test:8888/tests/content/base/test/file_websocket", "test 8"); 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.onopen = shouldNotOpen;
ws.onclose = function(e) ws.onclose = function(e)
{ {
shouldCloseNotCleanly(e); shouldCloseNotCleanly(e);
doTest(9); doTest(10);
}; };
ws._receivedCloseEvent = false; ws._receivedCloseEvent = false;
ws.close(); 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.onclose = shouldCloseCleanly;
ws._receivedCloseEvent = false; ws._receivedCloseEvent = false;
@ -261,27 +315,8 @@ function test9()
catch (e) { catch (e) {
ok(true, "Couldn't send data before connecting!"); ok(true, "Couldn't send data before connecting!");
} }
doTest(10); ws.onopen = function()
}
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()
{ {
ws2CanConnect = true;
}
ws2.onopen = function()
{
ok(ws2CanConnect, "shouldn't connect yet in test 10!");
doTest(11); doTest(11);
} }
} }
@ -336,8 +371,8 @@ function test13()
{ {
ws._timesCalledOnError++; ws._timesCalledOnError++;
if (ws._timesCalledOnError == 2) { if (ws._timesCalledOnError == 2) {
ok(true, "test 13 succeeded");
doTest(14); doTest(14);
ok(true, "test13 succeeded");
} }
} }
ws.onclose = shouldCloseCleanly; ws.onclose = shouldCloseCleanly;
@ -387,43 +422,63 @@ function test16()
ws._receivedCloseEvent = false; 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() function test17()
{ {
var ws = CreateTestWS("ws://mochi.test:8888/tests/content/base/test/file_websocket", "test 17"); window._test17();
ws.onopen = function()
{
ws.close();
}
ws.onclose = function(e)
{
shouldCloseNotCleanly(e);
doTest(18);
};
ws._receivedCloseEvent = false;
} }
// 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() function test18()
{ {
var ws = CreateTestWS("ws://mochi.test:8888/tests/content/base/test/file_websocket", "test 18"); var ws = CreateTestWS("ws://mochi.test:8888/tests/content/base/test/file_websocket_http_resource.txt");
var counter = 1; ws.onopen = shouldNotOpen;
ws.onopen = function() ws.onclose = shouldNotReceiveCloseEvent;
{ doTest(19);
ws.send(counter);
}
ws.onmessage = function(e)
{
if (counter == 5) {
ok(e.data == "あいうえお");
ws.close();
doTest(19);
} else {
ok(e.data == counter+1, "bad counter");
counter += 2;
ws.send(counter);
}
}
ws.onclose = shouldCloseCleanly;
ws._receivedCloseEvent = false;
} }
function test19() function test19()
@ -434,6 +489,81 @@ function test19()
doTest(20); 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() function finishWSTest()
{ {
for (i = 0; i < all_ws.length; ++i) { for (i = 0; i < all_ws.length; ++i) {

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

@ -623,7 +623,7 @@ protected:
do_QueryInterface(static_cast<nsIDOMHTMLCanvasElement*>(mCanvasElement)); do_QueryInterface(static_cast<nsIDOMHTMLCanvasElement*>(mCanvasElement));
if (content) { if (content) {
nsIDocument* ownerDoc = content->GetOwnerDoc(); nsIDocument* ownerDoc = content->GetOwnerDoc();
return ownerDoc ? ownerDoc->GetPrimaryShell() : nsnull; return ownerDoc ? ownerDoc->GetShell() : nsnull;
} }
if (mDocShell) { if (mDocShell) {
nsCOMPtr<nsIPresShell> shell; nsCOMPtr<nsIPresShell> shell;
@ -859,7 +859,10 @@ nsCanvasRenderingContext2D::Destroy()
Shmem &mem = static_cast<gfxSharedImageSurface*>(mSurface.get())->GetShmem(); Shmem &mem = static_cast<gfxSharedImageSurface*>(mSurface.get())->GetShmem();
allocator->DeallocShmem(mem); 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; gCanvasMemoryUsed -= mWidth * mHeight * 4;
mSurface = nsnull; mSurface = nsnull;

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

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

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

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

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

@ -1296,7 +1296,7 @@ nsEventListenerManager::DispatchEvent(nsIDOMEvent* aEvent, PRBool *_retval)
} }
// Obtain a presentation shell // Obtain a presentation shell
nsIPresShell *shell = document->GetPrimaryShell(); nsIPresShell *shell = document->GetShell();
nsRefPtr<nsPresContext> context; nsRefPtr<nsPresContext> context;
if (shell) { if (shell) {
context = shell->GetPresContext(); 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 // 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 // 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. // 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 void
nsEventStateManager::GenerateDragGesture(nsPresContext* aPresContext, nsEventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
nsMouseEvent *aEvent) nsMouseEvent *aEvent)
@ -2203,7 +2195,7 @@ nsEventStateManager::DoDefaultDragStart(nsPresContext* aPresContext,
if (aIsSelection && !dragImage) { if (aIsSelection && !dragImage) {
nsIDocument* doc = aDragTarget->GetCurrentDoc(); nsIDocument* doc = aDragTarget->GetCurrentDoc();
if (doc) { if (doc) {
nsIPresShell* presShell = doc->GetPrimaryShell(); nsIPresShell* presShell = doc->GetShell();
if (presShell) { if (presShell) {
selection = presShell->GetCurrentSelection( selection = presShell->GetCurrentSelection(
nsISelectionController::SELECTION_NORMAL); nsISelectionController::SELECTION_NORMAL);
@ -2283,7 +2275,7 @@ nsEventStateManager::GetMarkupDocumentViewer(nsIMarkupDocumentViewer** aMv)
nsIDocument *doc = GetDocumentFromWindow(contentWindow); nsIDocument *doc = GetDocumentFromWindow(contentWindow);
if(!doc) return NS_ERROR_FAILURE; if(!doc) return NS_ERROR_FAILURE;
nsIPresShell *presShell = doc->GetPrimaryShell(); nsIPresShell *presShell = doc->GetShell();
if(!presShell) return NS_ERROR_FAILURE; if(!presShell) return NS_ERROR_FAILURE;
nsPresContext *presContext = presShell->GetPresContext(); nsPresContext *presContext = presShell->GetPresContext();
if(!presContext) return NS_ERROR_FAILURE; if(!presContext) return NS_ERROR_FAILURE;
@ -3107,6 +3099,10 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
nsMouseEvent* mouseEvent = static_cast<nsMouseEvent*>(aEvent); nsMouseEvent* mouseEvent = static_cast<nsMouseEvent*>(aEvent);
event.refPoint = mouseEvent->refPoint; event.refPoint = mouseEvent->refPoint;
if (mouseEvent->widget) {
event.refPoint += mouseEvent->widget->WidgetToScreenOffset();
}
event.refPoint -= widget->WidgetToScreenOffset();
event.isShift = mouseEvent->isShift; event.isShift = mouseEvent->isShift;
event.isControl = mouseEvent->isControl; event.isControl = mouseEvent->isControl;
event.isAlt = mouseEvent->isAlt; event.isAlt = mouseEvent->isAlt;
@ -3570,7 +3566,7 @@ nsEventStateManager::NotifyMouseOver(nsGUIEvent* aEvent, nsIContent* aContent)
if (parentDoc) { if (parentDoc) {
nsIContent *docContent = parentDoc->FindContentForSubDocument(mDocument); nsIContent *docContent = parentDoc->FindContentForSubDocument(mDocument);
if (docContent) { if (docContent) {
nsIPresShell *parentShell = parentDoc->GetPrimaryShell(); nsIPresShell *parentShell = parentDoc->GetShell();
if (parentShell) { if (parentShell) {
nsEventStateManager* parentESM = nsEventStateManager* parentESM =
static_cast<nsEventStateManager*> static_cast<nsEventStateManager*>

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

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

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

@ -1316,7 +1316,16 @@ NS_NewHTML##_elementName##Element(nsINodeInfo *aNodeInfo, \
return NS_NewHTMLSharedElement(aNodeInfo, aFromParser); \ 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 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(Shared)
NS_DECLARE_NS_NEW_HTML_ELEMENT(SharedList) NS_DECLARE_NS_NEW_HTML_ELEMENT(SharedList)
NS_DECLARE_NS_NEW_HTML_ELEMENT(SharedObject) NS_DECLARE_NS_NEW_HTML_ELEMENT(SharedObject)

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

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

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

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

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

@ -61,7 +61,15 @@ public:
nsresult Clone(nsINodeInfo* aNodeInfo, nsINode** aResult) const; 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 NS_IMPL_NS_NEW_HTML_ELEMENT() // HTMLElement
#ifdef _MSC_VER
#pragma warning(pop)
#endif
nsHTMLElement::nsHTMLElement(nsINodeInfo* aNodeInfo) nsHTMLElement::nsHTMLElement(nsINodeInfo* aNodeInfo)
: nsGenericHTMLElement(aNodeInfo) : nsGenericHTMLElement(aNodeInfo)

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