Merge mozilla-central to the bug 568691 branch.

--HG--
rename : gfx/public/nsITheme.h => gfx/src/nsITheme.h
This commit is contained in:
Benjamin Smedberg 2010-06-30 14:23:23 -04:00
Родитель 791c8358da 08cda43662
Коммит 94ef4d2ac3
592 изменённых файлов: 8409 добавлений и 6090 удалений

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

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

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

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

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

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

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

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

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

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

@ -453,9 +453,8 @@ nsApplicationAccessible::CacheChildren()
nsCOMPtr<nsIDOMDocument> DOMDocument;
DOMWindow->GetDocument(getter_AddRefs(DOMDocument));
if (DOMDocument) {
nsCOMPtr<nsIAccessible> accessible;
GetAccService()->GetAccessibleFor(DOMDocument,
getter_AddRefs(accessible));
nsCOMPtr<nsIDocument> docNode(do_QueryInterface(DOMDocument));
GetAccService()->GetDocAccessible(docNode); // ensure creation
}
}
windowEnumerator->HasMoreElements(&hasMore);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -150,6 +150,8 @@ var TestPilotMenuUtils;
* after startup is complete. It's hacky, but the benefit is that
* TestPilotSetup.onWindowLoad can treat all windows the same no matter
* whether they opened with Firefox on startup or were opened later. */
TestPilotWindowHandlers.setUpToolbarFeedbackButton();
if (TestPilotSetup.startupComplete) {
TestPilotSetup.onWindowLoad(window);
} else {
@ -165,6 +167,31 @@ var TestPilotMenuUtils;
}
},
setUpToolbarFeedbackButton: function() {
/* If this is first run, and it's ffx4 beta version, and the feedback
* button is not in the expected place, put it there!
* (copied from MozReporterButtons extension) */
if (!window.document.getElementById("feedback-menu-happy-button")) {
return;
}
let firefoxnav = window.document.getElementById("nav-bar");
let curSet = firefoxnav.currentSet;
if (-1 == curSet.indexOf("feedback-menu-button")) {
// place the buttons after the search box.
let newSet = curSet + ",feedback-menu-button";
firefoxnav.setAttribute("currentset", newSet);
firefoxnav.currentSet = newSet;
window.document.persist("nav-bar", "currentset");
// if you don't do the following call, funny things happen.
try {
BrowserToolboxCustomizeDone(true);
} catch (e) {
}
}
},
onWindowUnload: function() {
TestPilotSetup.onWindowUnload(window);
}

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

@ -213,35 +213,6 @@ let TestPilotSetup = {
}
},
_setUpToolbarFeedbackButton: function TPS_toolbarFeedbackButton() {
/* If this is first run, and it's ffx4 beta version, and the feedback
* button is not in the expected place, put it there!
* (copied from MozReporterButtons extension) */
let logger = this._logger;
try {
let win = this._getFrontBrowserWindow();
let firefoxnav = win.document.getElementById("nav-bar");
let curSet = firefoxnav.currentSet;
if (-1 == curSet.indexOf("feedback-menu-button")) {
logger.info("Feedback toolbar button not present: Adding it.");
// place the buttons after the search box.
let newSet = curSet + ",feedback-menu-button";
firefoxnav.setAttribute("currentset", newSet);
firefoxnav.currentSet = newSet;
win.document.persist("nav-bar", "currentset");
// if you don't do the following call, funny things happen.
try {
BrowserToolboxCustomizeDone(true);
} catch (e) {
}
}
} catch (e) {
logger.warn("Error in setUpToolbarFeedbackButton: " + e);
}
},
globalStartup: function TPS__doGlobalSetup() {
// Only ever run this stuff ONCE, on the first window restore.
// Should get called by the Test Pilot component.
@ -296,11 +267,8 @@ let TestPilotSetup = {
let url = self._prefs.getValue(FIRST_RUN_PREF, "");
let tab = browser.addTab(url);
browser.selectedTab = tab;
} else {
// Don't show first run page in ffx4 beta version... but do
// set up the Feedback button in the toolbar.
self._setUpToolbarFeedbackButton();
}
// Don't show first run page in ffx4 beta version.
}
// Install tasks. (This requires knowing the version, so it is

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

@ -209,6 +209,9 @@ var TestPilotTask = {
},
changeStatus: function TPS_changeStatus(newStatus, suppressNotification) {
// TODO we always suppress notifications except when new status is
// "finished"; maybe remove that argument and only fire notification
// when status is "finished".
let logger = Log4Moz.repository.getLogger("TestPilot.Task");
logger.info("Changing task " + this._id + " status to " + newStatus);
this._status = newStatus;
@ -584,7 +587,7 @@ TestPilotExperiment.prototype = {
this._reschedule();
} else {
// Normal case is reset to new.
this.changeStatus(TaskConstants.STATUS_NEW);
this.changeStatus(TaskConstants.STATUS_NEW, true);
// increment count of how many times this recurring test has run
let numTimesRun = this._numTimesRun;
@ -610,7 +613,7 @@ TestPilotExperiment.prototype = {
}
// clear the data before starting.
this._dataStore.wipeAllData();
this.changeStatus(TaskConstants.STATUS_STARTING);
this.changeStatus(TaskConstants.STATUS_STARTING, true);
Application.prefs.setValue(GUID_PREF_PREFIX + this._id, uuid);
this.onExperimentStartup();
}

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

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

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

@ -201,7 +201,8 @@ toolbarbutton.bookmark-item {
%ifdef MENUBAR_CAN_AUTOHIDE
#toolbar-menubar:not([autohide="true"]) ~ #nav-bar > #bookmarks-menu-button-container,
#toolbar-menubar:not([autohide="true"]) ~ toolbar > #personal-bookmarks > #bookmarks-menu-button {
#toolbar-menubar:not([autohide="true"]) ~ toolbar > #personal-bookmarks > #bookmarks-menu-button,
#toolbar-menubar:not([autohide="true"]) > #personal-bookmarks > #bookmarks-menu-button {
display: none;
}
%endif
@ -253,8 +254,11 @@ window[chromehidden~="toolbar"] toolbar:not(.toolbar-primary):not(.chromeclass-m
/* Full Screen UI */
#fullscr-toggler {
display: none;
min-height: 5px;
height: 5px;
min-height: 1px;
height: 1px;
background: black;
border-style: none;
-moz-appearance: none;
}
#navigator-toolbox[inFullscreen="true"] > #fullscr-toggler,

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

@ -4108,7 +4108,11 @@ var XULBrowserWindow = {
let nBox = gBrowser.getNotificationBox(selectedBrowser);
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();
}
}
@ -4634,10 +4638,6 @@ var TabsOnTop = {
gNavToolbox.setAttribute("tabsontop", !!val);
this.syncCommand();
//XXX: Trigger reframe. This is a workaround for bug 555987 and needs to be
// removed once that bug is fixed.
gNavToolbox.style.MozBoxOrdinalGroup = val ? 2 : 3;
return val;
}
}

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

@ -391,12 +391,10 @@
<menupopup>
<menuitem id="appmenu_newNavigator"
label="&newNavigatorCmd.label;"
key="key_newNavigator"
command="cmd_newNavigator"/>
<menuseparator/>
<menuitem id="appmenu_savePage"
label="&savePageCmd.label;"
key="key_savePage"
command="Browser:SavePage"/>
<menuitem id="appmenu_sendLink"
label="&sendPageCmd.label;"
@ -406,7 +404,6 @@
class="split-menuitem-item"
flex="1"
label="&appMenuPrintCmd.label;"
key="printKb"
command="cmd_print"/>
<menu class="split-menuitem-menu">
<menupopup>
@ -421,7 +418,6 @@
</hbox>
<menuitem id="appmenu_find"
label="&findOnCmd.label;"
key="key_find"
command="cmd_find"/>
<menuseparator/>
<menu id="appmenu_history"
@ -493,9 +489,6 @@
label="&quitApplicationCmdWin.label;"
#else
label="&quitApplicationCmd.label;"
#ifdef XP_UNIX
key="key_quitApplication"
#endif
#endif
command="cmd_quitApplication"/>
</menupopup>
@ -794,7 +787,7 @@
._placesView._onChevronPopupShowing(event);">
<menupopup id="PlacesChevronPopup"
placespopup="true"
popupsinherittooltip="true"
tooltip="bhTooltip" popupsinherittooltip="true"
context="placesContext"/>
</toolbarbutton>
</hbox>

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

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

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

@ -438,6 +438,11 @@ HandlerInfoWrapper.prototype = {
this._prefSvc.setCharPref(PREF_DISABLED_PLUGIN_TYPES,
disabledPluginTypes.join(","));
// Update the category manager so existing browser windows update.
this._categoryMgr.deleteCategoryEntry("Gecko-Content-Viewers",
this.type,
false);
},
enablePluginType: function() {
@ -448,6 +453,14 @@ HandlerInfoWrapper.prototype = {
this._prefSvc.setCharPref(PREF_DISABLED_PLUGIN_TYPES,
disabledPluginTypes.join(","));
// Update the category manager so existing browser windows update.
this._categoryMgr.
addCategoryEntry("Gecko-Content-Viewers",
this.type,
"@mozilla.org/content/plugin/document-loader-factory;1",
false,
true);
},

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

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

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

@ -1 +1 @@
3.7a6pre
4.0b2pre

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

@ -404,7 +404,122 @@
@BINPATH@/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/icon.png
@BINPATH@/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/preview.png
#if MOZ_UPDATE_CHANNEL == beta
@BINPATH@/extensions/testpilot@labs.mozilla.com/*
@BINPATH@/extensions/testpilot@labs.mozilla.com/chrome.manifest
@BINPATH@/extensions/testpilot@labs.mozilla.com/components/TestPilot.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/content/all-studies-window.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/content/all-studies-window.xul
@BINPATH@/extensions/testpilot@labs.mozilla.com/content/browser.css
@BINPATH@/extensions/testpilot@labs.mozilla.com/content/browser.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/content/debug.html
@BINPATH@/extensions/testpilot@labs.mozilla.com/content/experiment-page.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/content/feedback-browser.xul
@BINPATH@/extensions/testpilot@labs.mozilla.com/content/flot/jquery.colorhelpers.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/content/flot/jquery.colorhelpers.min.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/content/flot/jquery.flot.crosshair.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/content/flot/jquery.flot.crosshair.min.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/content/flot/jquery.flot.image.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/content/flot/jquery.flot.image.min.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/content/flot/jquery.flot.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/content/flot/jquery.flot.min.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/content/flot/jquery.flot.navigate.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/content/flot/jquery.flot.navigate.min.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/content/flot/jquery.flot.selection.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/content/flot/jquery.flot.selection.min.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/content/flot/jquery.flot.stack.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/content/flot/jquery.flot.stack.min.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/content/flot/jquery.flot.threshold.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/content/flot/jquery.flot.threshold.min.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/content/flot/jquery.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/content/flot/jquery.min.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/content/raw-data-dialog.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/content/raw-data-dialog.xul
@BINPATH@/extensions/testpilot@labs.mozilla.com/content/screen.css
@BINPATH@/extensions/testpilot@labs.mozilla.com/content/status-quit.html
@BINPATH@/extensions/testpilot@labs.mozilla.com/content/status.html
@BINPATH@/extensions/testpilot@labs.mozilla.com/content/survey-generator.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/content/take-survey.html
@BINPATH@/extensions/testpilot@labs.mozilla.com/content/tp-browser.xul
@BINPATH@/extensions/testpilot@labs.mozilla.com/content/welcome-page.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/content/welcome.html
@BINPATH@/extensions/testpilot@labs.mozilla.com/content/window-utils.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/defaults/preferences/preferences.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/install.rdf
@BINPATH@/extensions/testpilot@labs.mozilla.com/instrument/chrome.manifest
@BINPATH@/extensions/testpilot@labs.mozilla.com/instrument/install.rdf
@BINPATH@/extensions/testpilot@labs.mozilla.com/instrument/instrument.jsm
@BINPATH@/extensions/testpilot@labs.mozilla.com/instrument/instrument.xul
@BINPATH@/extensions/testpilot@labs.mozilla.com/modules/dbutils.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/modules/experiment_data_store.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/modules/extension-update.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/modules/feedback.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/modules/jar-code-store.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/modules/lib/cuddlefish.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/modules/lib/memory.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/modules/lib/observer-service.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/modules/lib/plain-text-console.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/modules/lib/preferences-service.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/modules/lib/securable-module.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/modules/lib/timer.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/modules/lib/traceback.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/modules/lib/unit-test.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/modules/lib/unload.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/modules/lib/url.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/modules/log4moz.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/modules/metadata.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/modules/Observers.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/modules/remote-experiment-loader.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/modules/setup.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/modules/string_sanitizer.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/modules/tasks.js
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/all/badge-default.png
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/all/bg.jpg
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/all/css/screen-standalone.css
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/all/dino_32x32.png
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/all/images/bg-status.jpg
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/all/images/callout.png
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/all/images/callout_continue.png
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/all/images/data1.jpg
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/all/images/data2.jpg
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/all/images/home_comments.png
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/all/images/home_computer.png
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/all/images/home_continue.png
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/all/images/home_quit.png
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/all/images/home_results.png
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/all/images/home_twitter.png
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/all/images/home_upcoming.png
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/all/logo.png
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/all/mozilla-logo.png
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/all/status-completed.png
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/all/status-ejected.png
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/all/status-missed.png
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/all/testpilot_16x16.png
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/all/testPilot_200x200.png
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/all/testpilot_32x32.png
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/all/tp-completedstudies-32x32.png
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/all/tp-currentstudies-32x32.png
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/all/tp-generic-32x32.png
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/all/tp-learned-32x32.png
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/all/tp-results-48x48.png
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/all/tp-settings-32x32.png
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/all/tp-study-48x48.png
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/all/tp-submit-48x48.png
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/linux/close_button.png
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/linux/feedback-frown-16x16.png
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/linux/feedback-smile-16x16.png
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/linux/feedback.css
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/mac/close_button.png
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/mac/feedback-frown-16x16.png
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/mac/feedback-smile-16x16.png
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/mac/feedback.css
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/mac/notification-tail-down.png
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/mac/notification-tail-up.png
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/win/close_button.png
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/win/feedback-frown-16x16.png
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/win/feedback-smile-16x16.png
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/win/feedback.css
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/win/notification-tail-down.png
@BINPATH@/extensions/testpilot@labs.mozilla.com/skin/win/notification-tail-up.png
@BINPATH@/extensions/testpilot@labs.mozilla.com/tests/test_data_store.js
#endif
@BINPATH@/chrome/toolkit.jar
@BINPATH@/chrome/toolkit.manifest

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

@ -48,6 +48,7 @@ components/history.xpt
components/microsummaries.xpt
components/myspell/en-US.aff
components/myspell/en-US.dic
components/nsAddonRepository.js
components/nsBackgroundUpdateService.js
components/nsBookmarkTransactionManager.js
components/nsCloseAllWindows.js

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

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

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

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

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

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

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

@ -163,6 +163,12 @@ statusbarpanel#statusbar-display {
-moz-padding-end: 16px;
}
.split-menuitem-item[_moz-menuactive="true"],
.split-menuitem-menu[_moz-menuactive="true"] {
background-color: -moz-menuhover;
color: -moz-menuhovertext;
}
/* XXX: stop-gap until the button can be drawn in the title bar */
%ifdef WINSTRIPE_AERO
@media not all and (-moz-windows-compositor) {
@ -370,7 +376,7 @@ toolbar[iconsize="small"][mode="icons"] toolbarbutton[type="menu-button"] {
.toolbarbutton-menubutton-button:not([disabled="true"]):not(:active):hover,
toolbarbutton[type="menu-button"]:not([open="true"]):not(:active):hover > .toolbarbutton-menubutton-dropmarker:not([disabled="true"]),
.toolbarbutton-1:not([disabled="true"]):not([checked="true"]):not(:active):hover {
.toolbarbutton-1:not([disabled="true"]):not([checked="true"]):not([open="true"]):not(:active):hover {
background-color: hsla(190,60%,70%,.5);
border-color: hsla(190,50%,65%,.8) hsla(190,50%,50%,.8) hsla(190,50%,40%,.8);
-moz-box-shadow: 0 0 0 1px rgba(255,255,255,.3) inset,
@ -605,7 +611,7 @@ toolbar:not([iconsize="small"])[mode="icons"] #forward-button:not([disabled="tru
list-style-image: url("chrome://browser/skin/Toolbar.png");
}
toolbar[mode="icons"] #bookmarks-menu-button.toolbarbutton-1 {
#bookmarks-menu-button.toolbarbutton-1 {
-moz-box-orient: horizontal;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -1778,30 +1778,10 @@ nsScriptSecurityManager::CanExecuteScripts(JSContext* cx,
docshell = window->GetDocShell();
}
nsCOMPtr<nsIDocShellTreeItem> globalObjTreeItem =
do_QueryInterface(docshell);
if (globalObjTreeItem)
{
nsCOMPtr<nsIDocShellTreeItem> treeItem(globalObjTreeItem);
nsCOMPtr<nsIDocShellTreeItem> parentItem;
// Walk up the docshell tree to see if any containing docshell disallows scripts
do
{
rv = docshell->GetAllowJavascript(result);
if (NS_FAILED(rv)) return rv;
if (!*result)
return NS_OK; // Do not run scripts
treeItem->GetParent(getter_AddRefs(parentItem));
treeItem.swap(parentItem);
docshell = do_QueryInterface(treeItem);
#ifdef DEBUG
if (treeItem && !docshell) {
NS_ERROR("cannot get a docshell from a treeItem!");
}
#endif // DEBUG
} while (treeItem && docshell);
if (docshell) {
rv = docshell->GetCanExecuteScripts(result);
if (NS_FAILED(rv)) return rv;
if (!*result) return NS_OK;
}
// OK, the docshell doesn't have script execution explicitly disabled.

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

@ -84,9 +84,11 @@ endif
ifndef TOPSRCDIR
ifeq (,$(wildcard client.mk))
$(error Must run from the client.mk directory, or specify TOPSRCDIR)
TOPSRCDIR := $(patsubst %/,%,$(dir $(MAKEFILE_LIST)))
MOZ_OBJDIR = .
else
TOPSRCDIR := $(CWD)
endif
TOPSRCDIR = $(CWD)
endif
# try to find autoconf 2.13 - discard errors from 'which'

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

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

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

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

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

@ -10,4 +10,4 @@
# hardcoded milestones in the tree from these two files.
#--------------------------------------------------------
1.9.3a6pre
2.0b2pre

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

@ -355,7 +355,6 @@ endif # ENABLE_CXX_EXCEPTIONS
endif # WINNT
ifeq ($(SOLARIS_SUNPRO_CXX),1)
CXXFLAGS += -features=extensions -D__FUNCTION__=__func__
ifeq (86,$(findstring 86,$(OS_TEST)))
OS_LDFLAGS += -M $(topsrcdir)/config/solaris_ia32.map
endif # x86
@ -1357,7 +1356,7 @@ _MDDEPFILE = $(MDDEPDIR)/$(@F).pp
define MAKE_DEPS_AUTO
if test -d $(@D); then \
echo "Building deps for $<"; \
$(MKDEPEND) -o'.$(OBJ_SUFFIX)' -f- $(DEFINES) $(ACDEFINES) $(INCLUDES) $< 2>/dev/null | sed -e "s|^[^ ]*/||" > $(_MDDEPFILE) ; \
$(MKDEPEND) -o'.$(OBJ_SUFFIX)' -f- $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $(INCLUDES) $< 2>/dev/null | sed -e "s|^[^ ]*/||" > $(_MDDEPFILE) ; \
fi
endef

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

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

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

@ -63,6 +63,7 @@
#include "nsSMILAnimationController.h"
#endif // MOZ_SMIL
#include "nsIScriptGlobalObject.h"
#include "nsIDocumentEncoder.h"
class nsIContent;
class nsPresContext;
@ -116,10 +117,9 @@ class Element;
} // namespace mozilla
// fbcd570b-dbfa-479b-9bd0-02312129c044
#define NS_IDOCUMENT_IID \
{ 0xfbcd570b, 0xdbfa, 0x479b, \
{ 0x9b, 0xd0, 0x02, 0x31, 0x21, 0x29, 0xc0, 0x44 } }
{ 0x1d8bd3d4, 0x6f6d, 0x49fe, \
{ 0xaf, 0xda, 0xc9, 0x4a, 0xef, 0x8f, 0xcf, 0x1f } }
// Flag for AddStyleSheet().
#define NS_STYLESHEET_FROM_CATALOG (1 << 0)
@ -1115,6 +1115,16 @@ public:
// Do nothing.
}
already_AddRefed<nsIDocumentEncoder> GetCachedEncoder()
{
return mCachedEncoder.forget();
}
void SetCachedEncoder(nsIDocumentEncoder* aEncoder)
{
mCachedEncoder = aEncoder;
}
// In case of failure, the document really can't initialize the frame loader.
virtual nsresult InitializeFrameLoader(nsFrameLoader* aLoader) = 0;
// In case of failure, the caller must handle the error, for example by
@ -1422,6 +1432,17 @@ protected:
return GetRootElement();
}
void SetContentTypeInternal(const nsACString& aType)
{
mCachedEncoder = nsnull;
mContentType = aType;
}
nsCString GetContentTypeInternal() const
{
return mContentType;
}
nsCOMPtr<nsIURI> mDocumentURI;
nsCOMPtr<nsIURI> mDocumentBaseURI;
@ -1530,7 +1551,9 @@ protected:
PRUint32 mBidiOptions;
nsCString mContentLanguage;
private:
nsCString mContentType;
protected:
// The document's security info
nsCOMPtr<nsISupports> mSecurityInfo;
@ -1560,6 +1583,8 @@ protected:
// Weak reference to mScriptGlobalObject QI:d to nsPIDOMWindow,
// updated on every set of mSecriptGlobalObject.
nsPIDOMWindow *mWindow;
nsCOMPtr<nsIDocumentEncoder> mCachedEncoder;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocument, NS_IDOCUMENT_IID)

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

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

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

@ -475,6 +475,7 @@ nsContentUtils::InitializeEventTable() {
{ nsGkAtoms::ondblclick, NS_MOUSE_DOUBLECLICK, EventNameType_HTMLXUL, NS_MOUSE_EVENT },
{ nsGkAtoms::onmouseover, NS_MOUSE_ENTER_SYNTH, EventNameType_All, NS_MOUSE_EVENT },
{ nsGkAtoms::onmouseout, NS_MOUSE_EXIT_SYNTH, EventNameType_All, NS_MOUSE_EVENT },
{ nsGkAtoms::onMozMouseHittest, NS_MOUSE_MOZHITTEST, EventNameType_None, NS_MOUSE_EVENT },
{ nsGkAtoms::onmousemove, NS_MOUSE_MOVE, EventNameType_All, NS_MOUSE_EVENT },
{ nsGkAtoms::oncontextmenu, NS_CONTEXTMENU, EventNameType_HTMLXUL, NS_MOUSE_EVENT },
@ -496,6 +497,7 @@ nsContentUtils::InitializeEventTable() {
{ nsGkAtoms::onunload, NS_PAGE_UNLOAD,
(EventNameType_HTMLXUL | EventNameType_SVGSVG), NS_EVENT },
{ nsGkAtoms::onhashchange, NS_HASHCHANGE, EventNameType_HTMLXUL, NS_EVENT },
{ nsGkAtoms::onreadystatechange, NS_READYSTATECHANGE, EventNameType_HTMLXUL },
{ nsGkAtoms::onbeforeunload, NS_BEFORE_PAGE_UNLOAD, EventNameType_HTMLXUL, NS_EVENT },
{ nsGkAtoms::onabort, NS_IMAGE_ABORT,
(EventNameType_HTMLXUL | EventNameType_SVGSVG), NS_EVENT },
@ -6182,30 +6184,19 @@ nsIContentUtils::FindInternalContentViewer(const char* aType,
if (!catMan)
return NULL;
FullPagePluginEnabledType pluginEnabled = NOT_ENABLED;
nsCOMPtr<nsIPluginHost> pluginHost =
do_GetService(MOZ_PLUGIN_HOST_CONTRACTID);
if (pluginHost) {
pluginHost->IsFullPagePluginEnabledForType(aType, &pluginEnabled);
}
nsCOMPtr<nsIDocumentLoaderFactory> docFactory;
if (OVERRIDE_BUILTIN == pluginEnabled) {
docFactory = do_GetService(PLUGIN_DLF_CONTRACTID);
if (docFactory && aLoaderType) {
*aLoaderType = TYPE_PLUGIN;
}
return docFactory.forget();
}
nsXPIDLCString contractID;
nsresult rv = catMan->GetCategoryEntry("Gecko-Content-Viewers", aType, getter_Copies(contractID));
if (NS_SUCCEEDED(rv)) {
docFactory = do_GetService(contractID);
if (docFactory && aLoaderType) {
*aLoaderType = contractID.EqualsLiteral(CONTENT_DLF_CONTRACTID) ? TYPE_CONTENT : TYPE_UNKNOWN;
if (contractID.EqualsLiteral(CONTENT_DLF_CONTRACTID))
*aLoaderType = TYPE_CONTENT;
else if (contractID.EqualsLiteral(PLUGIN_DLF_CONTRACTID))
*aLoaderType = TYPE_PLUGIN;
else
*aLoaderType = TYPE_UNKNOWN;
}
return docFactory.forget();
}
@ -6242,13 +6233,5 @@ nsIContentUtils::FindInternalContentViewer(const char* aType,
#endif
#endif // MOZ_MEDIA
if (AVAILABLE == pluginEnabled) {
docFactory = do_GetService(PLUGIN_DLF_CONTRACTID);
if (docFactory && aLoaderType) {
*aLoaderType = TYPE_PLUGIN;
}
return docFactory.forget();
}
return NULL;
}

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

@ -70,6 +70,7 @@
#include "nsCOMArray.h"
#include "nsGUIEvent.h"
#include "nsPLDOMEvent.h"
#include "nsIDOMStyleSheet.h"
#include "nsDOMAttribute.h"
@ -1392,7 +1393,7 @@ nsDOMImplementation::Init(nsIURI* aDocumentURI, nsIURI* aBaseURI,
nsDocument::nsDocument(const char* aContentType)
: nsIDocument()
{
mContentType = aContentType;
SetContentTypeInternal(nsDependentCString(aContentType));
#ifdef PR_LOGGING
if (!gDocumentLeakPRLog)
@ -1687,6 +1688,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDocument)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mFirstBaseNodeWithHref)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mDOMImplementation)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mOriginalDocument)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mCachedEncoder)
// Traverse all our nsCOMArrays.
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMARRAY(mStyleSheets)
@ -1730,6 +1732,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDocument)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mFirstBaseNodeWithHref)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mDOMImplementation)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mOriginalDocument)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mCachedEncoder)
NS_IMPL_CYCLE_COLLECTION_UNLINK_USERDATA
@ -1946,7 +1949,7 @@ nsDocument::ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup,
mLastModified.Truncate();
// XXXbz I guess we're assuming that the caller will either pass in
// a channel with a useful type or call SetContentType?
mContentType.Truncate();
SetContentTypeInternal(EmptyCString());
mContentLanguage.Truncate();
mBaseTarget.Truncate();
mReferrer.Truncate();
@ -2154,7 +2157,7 @@ nsDocument::StartDocumentLoad(const char* aCommand, nsIChannel* aChannel,
contentType.EndReading(end);
semicolon = start;
FindCharInReadable(';', semicolon, end);
mContentType = Substring(start, semicolon);
SetContentTypeInternal(Substring(start, semicolon));
}
RetrieveRelevantHeaders(aChannel);
@ -2435,7 +2438,7 @@ nsDocument::SetApplicationCache(nsIApplicationCache *aApplicationCache)
NS_IMETHODIMP
nsDocument::GetContentType(nsAString& aContentType)
{
CopyUTF8toUTF16(mContentType, aContentType);
CopyUTF8toUTF16(GetContentTypeInternal(), aContentType);
return NS_OK;
}
@ -2443,11 +2446,11 @@ nsDocument::GetContentType(nsAString& aContentType)
void
nsDocument::SetContentType(const nsAString& aContentType)
{
NS_ASSERTION(mContentType.IsEmpty() ||
mContentType.Equals(NS_ConvertUTF16toUTF8(aContentType)),
NS_ASSERTION(GetContentTypeInternal().IsEmpty() ||
GetContentTypeInternal().Equals(NS_ConvertUTF16toUTF8(aContentType)),
"Do you really want to change the content-type?");
CopyUTF16toUTF8(aContentType, mContentType);
SetContentTypeInternal(NS_ConvertUTF16toUTF8(aContentType));
}
/* Return true if the document is in the focused top-level window, and is an
@ -7304,7 +7307,7 @@ nsDocument::CloneDocHelper(nsDocument* clone) const
clone->mCompatMode = mCompatMode;
clone->mBidiOptions = mBidiOptions;
clone->mContentLanguage = mContentLanguage;
clone->mContentType = mContentType;
clone->SetContentTypeInternal(GetContentTypeInternal());
clone->mSecurityInfo = mSecurityInfo;
// State from nsDocument
@ -7318,7 +7321,12 @@ void
nsDocument::SetReadyStateInternal(ReadyState rs)
{
mReadyState = rs;
// TODO fire "readystatechange"
nsRefPtr<nsPLDOMEvent> plevent =
new nsPLDOMEvent(this, NS_LITERAL_STRING("readystatechange"), PR_FALSE, PR_FALSE);
if (plevent) {
plevent->RunDOMEventWhenSafe();
}
}
nsIDocument::ReadyState

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -308,6 +308,7 @@ nsICanvasRenderingContextWebGL_ReadPixels(JSContext *cx, uintN argc, jsval *vp)
* TexImage2D takes:
* TexImage2D(uint, int, uint, int, int, int, uint, uint, ArrayBufferView)\
* TexImage2D(uint, int, uint, uint, uint, nsIDOMElement)
* TexImage2D(uint, int, uint, uint, uint, ImageData)
*/
static JSBool
nsICanvasRenderingContextWebGL_TexImage2D(JSContext *cx, uintN argc, jsval *vp)
@ -360,6 +361,34 @@ nsICanvasRenderingContextWebGL_TexImage2D(JSContext *cx, uintN argc, jsval *vp)
if (NS_FAILED(rv)) return JS_FALSE;
rv = self->TexImage2D_dom(argv0, argv1, argv2, argv3, argv4, elt);
if (NS_FAILED(rv)) {
// failed to interprete argv[5] as a DOMElement, now try to interprete it as ImageData
JSObject *argv5 = JSVAL_TO_OBJECT(argv[5]);
jsval js_width, js_height, js_data;
JS_GetProperty(cx, argv5, "width", &js_width);
JS_GetProperty(cx, argv5, "height", &js_height);
JS_GetProperty(cx, argv5, "data", &js_data);
if (js_width == JSVAL_VOID ||
js_height == JSVAL_VOID ||
js_data == JSVAL_VOID)
{
xpc_qsThrowBadArg(cx, NS_ERROR_FAILURE, vp, 5);
return JS_FALSE;
}
int32 int_width, int_height;
JSObject *obj_data = JSVAL_TO_OBJECT(js_data);
if (!JS_ValueToECMAInt32(cx, js_width, &int_width) ||
!JS_ValueToECMAInt32(cx, js_height, &int_height) ||
!js_IsTypedArray(obj_data))
{
xpc_qsThrowBadArg(cx, NS_ERROR_FAILURE, vp, 5);
return JS_FALSE;
}
rv = self->TexImage2D_array(argv0, argv1, argv2,
int_width, int_height, 0,
argv3, argv4, js::TypedArray::fromJSObject(obj_data));
}
} else if (argc > 8 && JSVAL_IS_OBJECT(argv[8])) {
// implement the variants taking a buffer/array as argv[8]
GET_UINT32_ARG(argv2, 2);
@ -403,6 +432,7 @@ nsICanvasRenderingContextWebGL_TexImage2D(JSContext *cx, uintN argc, jsval *vp)
/* TexSubImage2D takes:
* TexSubImage2D(uint, int, int, int, int, int, uint, uint, ArrayBufferView)
* TexSubImage2D(uint, int, int, int, uint, uint, nsIDOMElement)
* TexSubImage2D(uint, int, int, int, uint, uint, ImageData)
*/
static JSBool
nsICanvasRenderingContextWebGL_TexSubImage2D(JSContext *cx, uintN argc, jsval *vp)
@ -442,6 +472,35 @@ nsICanvasRenderingContextWebGL_TexSubImage2D(JSContext *cx, uintN argc, jsval *v
if (NS_FAILED(rv)) return JS_FALSE;
rv = self->TexSubImage2D_dom(argv0, argv1, argv2, argv3, argv4, argv5, elt);
if (NS_FAILED(rv)) {
// failed to interprete argv[6] as a DOMElement, now try to interprete it as ImageData
JSObject *argv6 = JSVAL_TO_OBJECT(argv[6]);
jsval js_width, js_height, js_data;
JS_GetProperty(cx, argv6, "width", &js_width);
JS_GetProperty(cx, argv6, "height", &js_height);
JS_GetProperty(cx, argv6, "data", &js_data);
if (js_width == JSVAL_VOID ||
js_height == JSVAL_VOID ||
js_data == JSVAL_VOID)
{
xpc_qsThrowBadArg(cx, NS_ERROR_FAILURE, vp, 6);
return JS_FALSE;
}
int32 int_width, int_height;
JSObject *obj_data = JSVAL_TO_OBJECT(js_data);
if (!JS_ValueToECMAInt32(cx, js_width, &int_width) ||
!JS_ValueToECMAInt32(cx, js_height, &int_height) ||
!js_IsTypedArray(obj_data))
{
xpc_qsThrowBadArg(cx, NS_ERROR_FAILURE, vp, 6);
return JS_FALSE;
}
rv = self->TexSubImage2D_array(argv0, argv1, argv2, argv3,
int_width, int_height,
argv4, argv5,
js::TypedArray::fromJSObject(obj_data));
}
} else if (argc > 8 && JSVAL_IS_OBJECT(argv[8])) {
// implement the variants taking a buffer/array as argv[8]
GET_INT32_ARG(argv4, 4);

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

@ -290,6 +290,9 @@ public:
nsresult ErrorInvalidEnum(const char *fmt = 0, ...);
nsresult ErrorInvalidOperation(const char *fmt = 0, ...);
nsresult ErrorInvalidValue(const char *fmt = 0, ...);
nsresult ErrorInvalidEnumInfo(const char *info) {
return ErrorInvalidEnum("%s: invalid enum value", info);
}
already_AddRefed<CanvasLayer> GetCanvasLayer(LayerManager *manager);
void MarkContextClean() { }
@ -316,10 +319,17 @@ protected:
PRBool SafeToCreateCanvas3DContext(nsHTMLCanvasElement *canvasElement);
PRBool InitAndValidateGL();
PRBool ValidateBuffers(PRUint32 count);
static PRBool ValidateCapabilityEnum(WebGLenum cap);
static PRBool ValidateBlendEquationEnum(WebGLuint cap);
static PRBool ValidateBlendFuncDstEnum(WebGLuint mode);
static PRBool ValidateBlendFuncSrcEnum(WebGLuint mode);
PRBool ValidateCapabilityEnum(WebGLenum cap, const char *info);
PRBool ValidateBlendEquationEnum(WebGLuint cap, const char *info);
PRBool ValidateBlendFuncDstEnum(WebGLuint mode, const char *info);
PRBool ValidateBlendFuncSrcEnum(WebGLuint mode, const char *info);
PRBool ValidateTextureTargetEnum(WebGLenum target, const char *info);
PRBool ValidateComparisonEnum(WebGLenum target, const char *info);
PRBool ValidateStencilOpEnum(WebGLenum action, const char *info);
PRBool ValidateFaceEnum(WebGLenum target, const char *info);
PRBool ValidateTexFormatAndType(WebGLenum format, WebGLenum type,
PRUint32 *texelSize, const char *info);
void Invalidate();
void MakeContextCurrent() { gl->MakeCurrent(); }

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

@ -296,8 +296,8 @@ GL_SAME_METHOD_4(BlendColor, BlendColor, float, float, float, float)
NS_IMETHODIMP WebGLContext::BlendEquation(WebGLenum mode)
{
if (!ValidateBlendEquationEnum(mode))
return ErrorInvalidEnum("BlendEquation: invalid mode");
if (!ValidateBlendEquationEnum(mode, "blendEquation: mode"))
return NS_OK;
MakeContextCurrent();
gl->fBlendEquation(mode);
@ -306,9 +306,9 @@ NS_IMETHODIMP WebGLContext::BlendEquation(WebGLenum mode)
NS_IMETHODIMP WebGLContext::BlendEquationSeparate(WebGLenum modeRGB, WebGLenum modeAlpha)
{
if (!ValidateBlendEquationEnum(modeRGB)
|| !ValidateBlendEquationEnum(modeAlpha))
return ErrorInvalidEnum("BlendEquationSeparate: invalid mode");
if (!ValidateBlendEquationEnum(modeRGB, "blendEquationSeparate: modeRGB") ||
!ValidateBlendEquationEnum(modeAlpha, "blendEquationSeparate: modeAlpha"))
return NS_OK;
MakeContextCurrent();
gl->fBlendEquationSeparate(modeRGB, modeAlpha);
@ -317,10 +317,9 @@ NS_IMETHODIMP WebGLContext::BlendEquationSeparate(WebGLenum modeRGB, WebGLenum m
NS_IMETHODIMP WebGLContext::BlendFunc(WebGLenum sfactor, WebGLenum dfactor)
{
if (!ValidateBlendFuncSrcEnum(sfactor))
return ErrorInvalidEnum("BlendFunc: invalid source factor");
if (!ValidateBlendFuncDstEnum(dfactor))
return ErrorInvalidEnum("BlendFunc: invalid destination factor");
if (!ValidateBlendFuncSrcEnum(sfactor, "blendFunc: sfactor") ||
!ValidateBlendFuncDstEnum(dfactor, "blendFunc: dfactor"))
return NS_OK;
MakeContextCurrent();
gl->fBlendFunc(sfactor, dfactor);
@ -331,12 +330,11 @@ NS_IMETHODIMP
WebGLContext::BlendFuncSeparate(WebGLenum srcRGB, WebGLenum dstRGB,
WebGLenum srcAlpha, WebGLenum dstAlpha)
{
if (!ValidateBlendFuncSrcEnum(srcRGB)
|| !ValidateBlendFuncSrcEnum(srcAlpha))
return ErrorInvalidEnum("BlendFuncSeparate: invalid source factor");
if (!ValidateBlendFuncDstEnum(dstRGB)
|| !ValidateBlendFuncDstEnum(dstAlpha))
return ErrorInvalidEnum("BlendFuncSeparate: invalid destination factor");
if (!ValidateBlendFuncSrcEnum(srcRGB, "blendFuncSeparate: srcRGB") ||
!ValidateBlendFuncSrcEnum(srcAlpha, "blendFuncSeparate: srcAlpha") ||
!ValidateBlendFuncDstEnum(dstRGB, "blendFuncSeparate: dstRGB") ||
!ValidateBlendFuncDstEnum(dstAlpha, "blendFuncSeparate: dstAlpha"))
return NS_OK;
MakeContextCurrent();
gl->fBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
@ -804,7 +802,16 @@ WebGLContext::DetachShader(nsIWebGLProgram *pobj, nsIWebGLShader *shobj)
return NS_OK;
}
GL_SAME_METHOD_1(DepthFunc, DepthFunc, WebGLenum)
NS_IMETHODIMP
WebGLContext::DepthFunc(WebGLenum func)
{
if (!ValidateComparisonEnum(func, "depthFunc"))
return NS_OK;
MakeContextCurrent();
gl->fDepthFunc(func);
return NS_OK;
}
GL_SAME_METHOD_1(DepthMask, DepthMask, WebGLboolean)
@ -946,8 +953,8 @@ WebGLContext::DrawElements(WebGLenum mode, WebGLsizei count, WebGLenum type, Web
NS_IMETHODIMP WebGLContext::Enable(WebGLenum cap)
{
if (!ValidateCapabilityEnum(cap))
return ErrorInvalidEnum("Enable: invalid capability enum");
if (!ValidateCapabilityEnum(cap, "enable"))
return NS_OK;
MakeContextCurrent();
gl->fEnable(cap);
@ -956,8 +963,8 @@ NS_IMETHODIMP WebGLContext::Enable(WebGLenum cap)
NS_IMETHODIMP WebGLContext::Disable(WebGLenum cap)
{
if (!ValidateCapabilityEnum(cap))
return ErrorInvalidEnum("Disable: invalid capability enum");
if (!ValidateCapabilityEnum(cap, "disable"))
return NS_OK;
MakeContextCurrent();
gl->fDisable(cap);
@ -1062,9 +1069,21 @@ GL_SAME_METHOD_0(Flush, Flush)
GL_SAME_METHOD_0(Finish, Finish)
GL_SAME_METHOD_1(FrontFace, FrontFace, WebGLenum)
NS_IMETHODIMP
WebGLContext::FrontFace(WebGLenum mode)
{
switch (mode) {
case LOCAL_GL_CW:
case LOCAL_GL_CCW:
break;
default:
return ErrorInvalidEnum("FrontFace: invalid mode");
}
GL_SAME_METHOD_1(GenerateMipmap, GenerateMipmap, WebGLenum)
MakeContextCurrent();
gl->fFrontFace(mode);
return NS_OK;
}
// returns an object: { size: ..., type: ..., name: ... }
NS_IMETHODIMP
@ -1107,6 +1126,17 @@ WebGLContext::GetActiveAttrib(nsIWebGLProgram *pobj, PRUint32 index, nsIWebGLAct
return NS_OK;
}
NS_IMETHODIMP
WebGLContext::GenerateMipmap(WebGLenum target)
{
if (!ValidateTextureTargetEnum(target, "generateMipmap"))
return NS_OK;
MakeContextCurrent();
gl->fGenerateMipmap(target);
return NS_OK;
}
NS_IMETHODIMP
WebGLContext::GetActiveUniform(nsIWebGLProgram *pobj, PRUint32 index, nsIWebGLActiveInfo **retval)
{
@ -1152,7 +1182,7 @@ WebGLContext::GetAttachedShaders(nsIWebGLProgram *pobj, nsIVariant **retval)
{
WebGLProgram *prog;
if (!GetConcreteObject(pobj, &prog))
return ErrorInvalidOperation("GetActiveAttrib: invalid program");
return ErrorInvalidOperation("GetAttachedShaders: invalid program");
nsCOMPtr<nsIWritableVariant> wrval = do_CreateInstance("@mozilla.org/variant;1");
NS_ENSURE_TRUE(wrval, NS_ERROR_FAILURE);
@ -1246,27 +1276,19 @@ WebGLContext::GetParameter(PRUint32 pname, nsIVariant **retval)
case LOCAL_GL_BLEND_DST_ALPHA:
case LOCAL_GL_BLEND_EQUATION_RGB:
case LOCAL_GL_BLEND_EQUATION_ALPHA:
//case LOCAL_GL_UNPACK_ALIGNMENT: // not supported
//case LOCAL_GL_PACK_ALIGNMENT: // not supported
case LOCAL_GL_UNPACK_ALIGNMENT:
case LOCAL_GL_PACK_ALIGNMENT:
case LOCAL_GL_GENERATE_MIPMAP_HINT:
case LOCAL_GL_SUBPIXEL_BITS:
case LOCAL_GL_MAX_TEXTURE_SIZE:
case LOCAL_GL_MAX_CUBE_MAP_TEXTURE_SIZE:
case LOCAL_GL_MAX_ELEMENTS_INDICES:
case LOCAL_GL_MAX_ELEMENTS_VERTICES:
case LOCAL_GL_SAMPLE_BUFFERS:
case LOCAL_GL_SAMPLES:
//case LOCAL_GL_COMPRESSED_TEXTURE_FORMATS:
//case LOCAL_GL_NUM_SHADER_BINARY_FORMATS:
case LOCAL_GL_MAX_VERTEX_ATTRIBS:
case LOCAL_GL_MAX_VERTEX_UNIFORM_COMPONENTS:
case LOCAL_GL_MAX_VARYING_FLOATS:
case LOCAL_GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS:
case LOCAL_GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS:
case LOCAL_GL_MAX_TEXTURE_IMAGE_UNITS:
case LOCAL_GL_MAX_FRAGMENT_UNIFORM_COMPONENTS:
//case LOCAL_GL_MAX_FRAGMENT_UNIFORM_VECTORS: // not present in desktop OpenGL
//case LOCAL_GL_MAX_VARYING_VECTORS: // not present in desktop OpenGL
case LOCAL_GL_MAX_RENDERBUFFER_SIZE:
case LOCAL_GL_RED_BITS:
case LOCAL_GL_GREEN_BITS:
@ -1274,9 +1296,8 @@ WebGLContext::GetParameter(PRUint32 pname, nsIVariant **retval)
case LOCAL_GL_ALPHA_BITS:
case LOCAL_GL_DEPTH_BITS:
case LOCAL_GL_STENCIL_BITS:
case LOCAL_GL_PACK_ALIGNMENT:
//case LOCAL_GL_IMPLEMENTATION_COLOR_READ_TYPE:
//case LOCAL_GL_IMPLEMENTATION_COLOR_READ_FORMAT:
case LOCAL_GL_IMPLEMENTATION_COLOR_READ_TYPE:
case LOCAL_GL_IMPLEMENTATION_COLOR_READ_FORMAT:
{
GLint i = 0;
gl->fGetIntegerv(pname, &i);
@ -1284,9 +1305,38 @@ WebGLContext::GetParameter(PRUint32 pname, nsIVariant **retval)
}
break;
#define LOCAL_GL_MAX_VARYING_VECTORS 0x8dfc // not present in desktop OpenGL
// temporarily add those defs here, as they're missing from
// gfx/thebes/public/GLDefs.h
// and from
// gfx/layers/opengl/glDefs.h
// and I don't know in which of these 2 files they should go (probably we're going to
// kill one of them soon?)
#define LOCAL_GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125
#define LOCAL_GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122
case LOCAL_GL_MAX_VARYING_VECTORS:
{
#ifdef USE_GLES2
GLint i = 0;
gl->fGetIntegerv(pname, &i);
wrval->SetAsInt32(i);
#else
// since this pname is absent from desktop OpenGL, we have to implement it by hand.
// The formula below comes from the public_webgl list, "problematic GetParameter pnames" thread
GLint i = 0, j = 0;
gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_OUTPUT_COMPONENTS, &i);
gl->fGetIntegerv(LOCAL_GL_MAX_FRAGMENT_INPUT_COMPONENTS, &j);
wrval->SetAsInt32(PR_MIN(i,j)/4);
#endif
}
break;
case LOCAL_GL_NUM_COMPRESSED_TEXTURE_FORMATS:
wrval->SetAsInt32(0);
break;
case LOCAL_GL_COMPRESSED_TEXTURE_FORMATS:
wrval->SetAsVoid(); // the spec says we must return null
break;
// unsigned int. here we may have to return very large values like 2^32-1 that can't be represented as
// javascript integer values. We just return them as doubles and javascript doesn't care.
@ -1332,6 +1382,14 @@ WebGLContext::GetParameter(PRUint32 pname, nsIVariant **retval)
}
break;
// bool, WebGL-specific
case UNPACK_FLIP_Y_WEBGL:
wrval->SetAsBool(mPixelStoreFlipY);
break;
case UNPACK_PREMULTIPLY_ALPHA_WEBGL:
wrval->SetAsBool(mPixelStorePremultiplyAlpha);
break;
//
// Complex values
//
@ -1795,13 +1853,8 @@ WebGLContext::GetTexParameter(WebGLenum target, WebGLenum pname, nsIVariant **re
MakeContextCurrent();
switch (target) {
case LOCAL_GL_TEXTURE_2D:
case LOCAL_GL_TEXTURE_CUBE_MAP:
break;
default:
return ErrorInvalidEnum("GetTexParameter: invalid target");
}
if (!ValidateTextureTargetEnum(target, "getTexParameter: target"))
return NS_OK;
switch (pname) {
case LOCAL_GL_TEXTURE_MIN_FILTER:
@ -1816,7 +1869,7 @@ WebGLContext::GetTexParameter(WebGLenum target, WebGLenum pname, nsIVariant **re
break;
default:
return ErrorInvalidEnum("GetTexParameter: invalid parameter");
return ErrorInvalidEnum("getTexParameter: invalid parameter");
}
*retval = wrval.forget().get();
@ -2054,9 +2107,9 @@ WebGLContext::IsTexture(nsIWebGLTexture *tobj, WebGLboolean *retval)
NS_IMETHODIMP
WebGLContext::IsEnabled(WebGLenum cap, WebGLboolean *retval)
{
if(!ValidateCapabilityEnum(cap)) {
if (!ValidateCapabilityEnum(cap, "isEnabled")) {
*retval = 0; // as per the OpenGL ES spec
return ErrorInvalidEnum("IsEnabled: invalid capability enum");
return NS_OK;
}
MakeContextCurrent();
@ -2344,19 +2397,79 @@ WebGLContext::RenderbufferStorage(WebGLenum target, WebGLenum internalformat, We
GL_SAME_METHOD_2(SampleCoverage, SampleCoverage, float, WebGLboolean)
GL_SAME_METHOD_4(Scissor, Scissor, WebGLint, WebGLint, WebGLsizei, WebGLsizei)
NS_IMETHODIMP
WebGLContext::Scissor(WebGLint x, WebGLint y, WebGLsizei width, WebGLsizei height)
{
if (width < 0 || height < 0)
return ErrorInvalidValue("Scissor: negative size");
GL_SAME_METHOD_3(StencilFunc, StencilFunc, WebGLenum, WebGLint, WebGLuint)
MakeContextCurrent();
gl->fScissor(x, y, width, height);
return NS_OK;
}
GL_SAME_METHOD_4(StencilFuncSeparate, StencilFuncSeparate, WebGLenum, WebGLenum, WebGLint, WebGLuint)
NS_IMETHODIMP
WebGLContext::StencilFunc(WebGLenum func, WebGLint ref, WebGLuint mask)
{
if (!ValidateComparisonEnum(func, "stencilFunc: func"))
return NS_OK;
MakeContextCurrent();
gl->fStencilFunc(func, ref, mask);
return NS_OK;
}
NS_IMETHODIMP
WebGLContext::StencilFuncSeparate(WebGLenum face, WebGLenum func, WebGLint ref, WebGLuint mask)
{
if (!ValidateFaceEnum(face, "stencilFuncSeparate: face") ||
!ValidateComparisonEnum(func, "stencilFuncSeparate: func"))
return NS_OK;
MakeContextCurrent();
gl->fStencilFuncSeparate(face, func, ref, mask);
return NS_OK;
}
GL_SAME_METHOD_1(StencilMask, StencilMask, WebGLuint)
GL_SAME_METHOD_2(StencilMaskSeparate, StencilMaskSeparate, WebGLenum, WebGLuint)
NS_IMETHODIMP
WebGLContext::StencilMaskSeparate(WebGLenum face, WebGLuint mask)
{
if (!ValidateFaceEnum(face, "stencilMaskSeparate: face"))
return NS_OK;
GL_SAME_METHOD_3(StencilOp, StencilOp, WebGLenum, WebGLenum, WebGLenum)
MakeContextCurrent();
gl->fStencilMaskSeparate(face, mask);
return NS_OK;
}
GL_SAME_METHOD_4(StencilOpSeparate, StencilOpSeparate, WebGLenum, WebGLenum, WebGLenum, WebGLenum)
NS_IMETHODIMP
WebGLContext::StencilOp(WebGLenum sfail, WebGLenum dpfail, WebGLenum dppass)
{
if (!ValidateStencilOpEnum(sfail, "stencilOp: sfail") ||
!ValidateStencilOpEnum(dpfail, "stencilOp: dpfail") ||
!ValidateStencilOpEnum(dppass, "stencilOp: dppass"))
return NS_OK;
MakeContextCurrent();
gl->fStencilOp(sfail, dpfail, dppass);
return NS_OK;
}
NS_IMETHODIMP
WebGLContext::StencilOpSeparate(WebGLenum face, WebGLenum sfail, WebGLenum dpfail, WebGLenum dppass)
{
if (!ValidateFaceEnum(face, "stencilOpSeparate: face") ||
!ValidateStencilOpEnum(sfail, "stencilOpSeparate: sfail") ||
!ValidateStencilOpEnum(dpfail, "stencilOpSeparate: dpfail") ||
!ValidateStencilOpEnum(dppass, "stencilOpSeparate: dppass"))
return NS_OK;
MakeContextCurrent();
gl->fStencilOpSeparate(face, sfail, dpfail, dppass);
return NS_OK;
}
template<int format>
inline void convert_pixel(PRUint8* dst, const PRUint8* src)
@ -2660,7 +2773,16 @@ WebGLContext::CreateRenderbuffer(nsIWebGLRenderbuffer **retval)
return NS_OK;
}
GL_SAME_METHOD_4(Viewport, Viewport, PRInt32, PRInt32, PRInt32, PRInt32)
NS_IMETHODIMP
WebGLContext::Viewport(WebGLint x, WebGLint y, WebGLsizei width, WebGLsizei height)
{
if (width < 0 || height < 0)
return ErrorInvalidOperation("Viewport: negative size");
MakeContextCurrent();
gl->fViewport(x, y, width, height);
return NS_OK;
}
NS_IMETHODIMP
WebGLContext::CompileShader(nsIWebGLShader *sobj)
@ -2886,7 +3008,7 @@ WebGLContext::TexImage2D_base(WebGLenum target, WebGLint level, WebGLenum intern
case LOCAL_GL_LUMINANCE_ALPHA:
break;
default:
return ErrorInvalidValue("TexImage2D: internal format not supported");
return ErrorInvalidEnum("TexImage2D: invalid internal format");
}
if (width < 0 || height < 0)
@ -2895,53 +3017,12 @@ WebGLContext::TexImage2D_base(WebGLenum target, WebGLint level, WebGLenum intern
if (border != 0)
return ErrorInvalidValue("TexImage2D: border must be 0");
// number of bytes per pixel
uint32 bufferPixelSize = 0;
switch (format) {
case LOCAL_GL_RED:
case LOCAL_GL_GREEN:
case LOCAL_GL_BLUE:
case LOCAL_GL_ALPHA:
case LOCAL_GL_LUMINANCE:
bufferPixelSize = 1;
break;
case LOCAL_GL_LUMINANCE_ALPHA:
bufferPixelSize = 2;
break;
case LOCAL_GL_RGB:
bufferPixelSize = 3;
break;
case LOCAL_GL_RGBA:
bufferPixelSize = 4;
break;
default:
return ErrorInvalidEnum("TexImage2D: pixel format not supported");
}
switch (type) {
case LOCAL_GL_BYTE:
case LOCAL_GL_UNSIGNED_BYTE:
break;
case LOCAL_GL_SHORT:
case LOCAL_GL_UNSIGNED_SHORT:
bufferPixelSize *= 2;
break;
case LOCAL_GL_INT:
case LOCAL_GL_UNSIGNED_INT:
case LOCAL_GL_FLOAT:
bufferPixelSize *= 4;
break;
case LOCAL_GL_UNSIGNED_SHORT_4_4_4_4:
case LOCAL_GL_UNSIGNED_SHORT_5_5_5_1:
case LOCAL_GL_UNSIGNED_SHORT_5_6_5:
bufferPixelSize *= 2;
break;
default:
return ErrorInvalidEnum("TexImage2D: invalid type argument");
}
PRUint32 texelSize = 0;
if (!ValidateTexFormatAndType(format, type, &texelSize, "texImage2D"))
return NS_OK;
// XXX overflow!
uint32 bytesNeeded = width * height * bufferPixelSize;
uint32 bytesNeeded = width * height * texelSize;
if (byteLength && byteLength < bytesNeeded)
return ErrorInvalidValue("TexImage2D: not enough data for operation (need %d, have %d)",
@ -3066,56 +3147,15 @@ WebGLContext::TexSubImage2D_base(WebGLenum target, WebGLint level,
if (width < 0 || height < 0)
return ErrorInvalidValue("TexSubImage2D: width and height must be > 0!");
PRUint32 texelSize = 0;
if (!ValidateTexFormatAndType(format, type, &texelSize, "texSubImage2D"))
return NS_OK;
if (width == 0 || height == 0)
return NS_OK; // ES 2.0 says it has no effect, we better return right now
// number of bytes per pixel
uint32 bufferPixelSize = 0;
switch (format) {
case LOCAL_GL_RED:
case LOCAL_GL_GREEN:
case LOCAL_GL_BLUE:
case LOCAL_GL_ALPHA:
case LOCAL_GL_LUMINANCE:
bufferPixelSize = 1;
break;
case LOCAL_GL_LUMINANCE_ALPHA:
bufferPixelSize = 2;
break;
case LOCAL_GL_RGB:
bufferPixelSize = 3;
break;
case LOCAL_GL_RGBA:
bufferPixelSize = 4;
break;
default:
return ErrorInvalidEnum("TexImage2D: pixel format not supported");
}
switch (type) {
case LOCAL_GL_BYTE:
case LOCAL_GL_UNSIGNED_BYTE:
break;
case LOCAL_GL_SHORT:
case LOCAL_GL_UNSIGNED_SHORT:
bufferPixelSize *= 2;
break;
case LOCAL_GL_INT:
case LOCAL_GL_UNSIGNED_INT:
case LOCAL_GL_FLOAT:
bufferPixelSize *= 4;
break;
case LOCAL_GL_UNSIGNED_SHORT_4_4_4_4:
case LOCAL_GL_UNSIGNED_SHORT_5_5_5_1:
case LOCAL_GL_UNSIGNED_SHORT_5_6_5:
bufferPixelSize *= 2;
break;
default:
return ErrorInvalidEnum("TexImage2D: invalid type argument");
}
// XXX overflow!
uint32 bytesNeeded = width * height * bufferPixelSize;
uint32 bytesNeeded = width * height * texelSize;
if (byteLength < bytesNeeded)
return ErrorInvalidValue("TexSubImage2D: not enough data for operation (need %d, have %d)", bytesNeeded, byteLength);

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

@ -125,7 +125,7 @@ WebGLContext::ValidateBuffers(PRUint32 count)
return PR_TRUE;
}
PRBool WebGLContext::ValidateCapabilityEnum(WebGLenum cap)
PRBool WebGLContext::ValidateCapabilityEnum(WebGLenum cap, const char *info)
{
switch (cap) {
case LOCAL_GL_BLEND:
@ -139,11 +139,12 @@ PRBool WebGLContext::ValidateCapabilityEnum(WebGLenum cap)
case LOCAL_GL_STENCIL_TEST:
return PR_TRUE;
default:
ErrorInvalidEnumInfo(info);
return PR_FALSE;
}
}
PRBool WebGLContext::ValidateBlendEquationEnum(WebGLenum mode)
PRBool WebGLContext::ValidateBlendEquationEnum(WebGLenum mode, const char *info)
{
switch (mode) {
case LOCAL_GL_FUNC_ADD:
@ -151,11 +152,12 @@ PRBool WebGLContext::ValidateBlendEquationEnum(WebGLenum mode)
case LOCAL_GL_FUNC_REVERSE_SUBTRACT:
return PR_TRUE;
default:
ErrorInvalidEnumInfo(info);
return PR_FALSE;
}
}
PRBool WebGLContext::ValidateBlendFuncDstEnum(WebGLenum factor)
PRBool WebGLContext::ValidateBlendFuncDstEnum(WebGLenum factor, const char *info)
{
switch (factor) {
case LOCAL_GL_ZERO:
@ -174,16 +176,130 @@ PRBool WebGLContext::ValidateBlendFuncDstEnum(WebGLenum factor)
case LOCAL_GL_ONE_MINUS_CONSTANT_ALPHA:
return PR_TRUE;
default:
ErrorInvalidEnumInfo(info);
return PR_FALSE;
}
}
PRBool WebGLContext::ValidateBlendFuncSrcEnum(WebGLenum factor)
PRBool WebGLContext::ValidateBlendFuncSrcEnum(WebGLenum factor, const char *info)
{
if(factor == LOCAL_GL_SRC_ALPHA_SATURATE)
if (factor == LOCAL_GL_SRC_ALPHA_SATURATE)
return PR_TRUE;
else
return ValidateBlendFuncDstEnum(factor);
return ValidateBlendFuncDstEnum(factor, info);
}
PRBool WebGLContext::ValidateTextureTargetEnum(WebGLenum target, const char *info)
{
switch (target) {
case LOCAL_GL_TEXTURE_2D:
case LOCAL_GL_TEXTURE_CUBE_MAP:
return PR_TRUE;
default:
ErrorInvalidEnumInfo(info);
return PR_FALSE;
}
}
PRBool WebGLContext::ValidateComparisonEnum(WebGLenum target, const char *info)
{
switch (target) {
case LOCAL_GL_NEVER:
case LOCAL_GL_LESS:
case LOCAL_GL_LEQUAL:
case LOCAL_GL_GREATER:
case LOCAL_GL_GEQUAL:
case LOCAL_GL_EQUAL:
case LOCAL_GL_NOTEQUAL:
case LOCAL_GL_ALWAYS:
return PR_TRUE;
default:
ErrorInvalidEnumInfo(info);
return PR_FALSE;
}
}
PRBool WebGLContext::ValidateStencilOpEnum(WebGLenum action, const char *info)
{
switch (action) {
case LOCAL_GL_KEEP:
case LOCAL_GL_ZERO:
case LOCAL_GL_REPLACE:
case LOCAL_GL_INCR:
case LOCAL_GL_INCR_WRAP:
case LOCAL_GL_DECR:
case LOCAL_GL_DECR_WRAP:
case LOCAL_GL_INVERT:
return PR_TRUE;
default:
ErrorInvalidEnumInfo(info);
return PR_FALSE;
}
}
PRBool WebGLContext::ValidateFaceEnum(WebGLenum target, const char *info)
{
switch (target) {
case LOCAL_GL_FRONT:
case LOCAL_GL_BACK:
case LOCAL_GL_FRONT_AND_BACK:
return PR_TRUE;
default:
ErrorInvalidEnumInfo(info);
return PR_FALSE;
}
}
PRBool WebGLContext::ValidateTexFormatAndType(WebGLenum format, WebGLenum type,
PRUint32 *texelSize, const char *info)
{
if (type == LOCAL_GL_UNSIGNED_BYTE)
{
switch (format) {
case LOCAL_GL_RED:
case LOCAL_GL_GREEN:
case LOCAL_GL_BLUE:
case LOCAL_GL_ALPHA:
case LOCAL_GL_LUMINANCE:
*texelSize = 1;
return PR_TRUE;
case LOCAL_GL_LUMINANCE_ALPHA:
*texelSize = 2;
return PR_TRUE;
case LOCAL_GL_RGB:
*texelSize = 3;
return PR_TRUE;
case LOCAL_GL_RGBA:
*texelSize = 4;
return PR_TRUE;
default:
ErrorInvalidEnum("%s: invalid format", info);
return PR_FALSE;
}
} else {
switch (type) {
case LOCAL_GL_UNSIGNED_SHORT_4_4_4_4:
case LOCAL_GL_UNSIGNED_SHORT_5_5_5_1:
if (format == LOCAL_GL_RGBA) {
*texelSize = 2;
return PR_TRUE;
} else {
ErrorInvalidOperation("%s: mutually incompatible format and type", info);
return PR_FALSE;
}
case LOCAL_GL_UNSIGNED_SHORT_5_6_5:
if (format == LOCAL_GL_RGB) {
*texelSize = 2;
return PR_TRUE;
} else {
ErrorInvalidOperation("%s: mutually incompatible format and type", info);
return PR_FALSE;
}
default:
ErrorInvalidEnum("%s: invalid type", info);
return PR_FALSE;
}
}
}
PRBool

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

@ -757,7 +757,9 @@ nsCanvasRenderingContext2D::~nsCanvasRenderingContext2D()
void
nsCanvasRenderingContext2D::Destroy()
{
if (mValid)
// only do this for non-docshell created contexts,
// since those are the ones that we created a surface for
if (mValid && !mDocShell)
gCanvasMemoryUsed -= mWidth * mHeight * 4;
mSurface = nsnull;

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

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

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

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

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

@ -1879,14 +1879,6 @@ nsEventStateManager::FillInEventFromGestureDown(nsMouseEvent* aEvent)
// If we're in the TRACKING state of the d&d gesture tracker, check the current position
// of the mouse in relation to the old one. If we've moved a sufficient amount from
// the mouse down, then fire off a drag gesture event.
//
// Note that when the mouse enters a new child window with its own view, the event's
// coordinates will be in relation to the origin of the inner child window, which could
// either be very different from that of the mouse coords of the mouse down and trigger
// a drag too early, or very similar which might not trigger a drag.
//
// Do we need to do anything about this? Let's wait and see.
//
void
nsEventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
nsMouseEvent *aEvent)
@ -3107,6 +3099,10 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
nsMouseEvent* mouseEvent = static_cast<nsMouseEvent*>(aEvent);
event.refPoint = mouseEvent->refPoint;
if (mouseEvent->widget) {
event.refPoint += mouseEvent->widget->WidgetToScreenOffset();
}
event.refPoint -= widget->WidgetToScreenOffset();
event.isShift = mouseEvent->isShift;
event.isControl = mouseEvent->isControl;
event.isAlt = mouseEvent->isAlt;

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

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

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

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

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

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

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

@ -960,7 +960,7 @@ nsHTMLTextAreaElement::ContentAppended(nsIDocument* aDocument,
nsIContent* aFirstNewContent,
PRInt32 /* unused */)
{
ContentChanged(aContainer);
ContentChanged(aFirstNewContent);
}
void

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

@ -1726,8 +1726,14 @@ nsTextEditorState::SetValue(const nsAString& aValue, PRBool aUserInput)
plaintextEditor->InsertText(insertValue);
}
if (!weakFrame.IsAlive()) {
NS_ASSERTION(!mBoundFrame, "The frame should have been unbounded");
SetValue(newValue, PR_FALSE);
// If the frame was destroyed because of a flush somewhere inside
// InsertText, mBoundFrame here will be false. But it's also possible
// for the frame to go away because of another reason (such as deleting
// the existing selection -- see bug 574558), in which case we don't
// need to reset the value here.
if (!mBoundFrame) {
SetValue(newValue, PR_FALSE);
}
valueSetter.Cancel();
return;
}

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

@ -342,7 +342,7 @@ nsHTMLDocument::ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup,
// Make the content type default to "text/html", we are a HTML
// document, after all. Once we start getting data, this may be
// changed.
mContentType = "text/html";
SetContentTypeInternal(nsDependentCString("text/html"));
}
nsStyleSet::sheetType
@ -1592,16 +1592,8 @@ nsHTMLDocument::GetBody(nsresult *aResult)
// The document is most likely a frameset document so look for the
// outer most frameset element
nsRefPtr<nsContentList> nodeList;
if (IsHTML()) {
nodeList = nsDocument::GetElementsByTagName(NS_LITERAL_STRING("frameset"));
} else {
nodeList =
nsDocument::GetElementsByTagNameNS(NS_LITERAL_STRING("http://www.w3.org/1999/xhtml"),
NS_LITERAL_STRING("frameset"));
}
nsRefPtr<nsContentList> nodeList =
NS_GetContentList(this, nsGkAtoms::frameset, kNameSpaceID_XHTML);
if (!nodeList) {
*aResult = NS_ERROR_OUT_OF_MEMORY;
@ -2035,7 +2027,7 @@ nsHTMLDocument::OpenCommon(const nsACString& aContentType, PRBool aReplace)
}
// This will be propagated to the parser when someone actually calls write()
mContentType = aContentType;
SetContentTypeInternal(aContentType);
mWriteState = eDocumentOpened;
@ -2134,7 +2126,7 @@ nsHTMLDocument::Close()
++mWriteLevel;
rv = mParser->Parse(EmptyString(), mParser->GetRootContextKey(),
mContentType, PR_TRUE);
GetContentTypeInternal(), PR_TRUE);
--mWriteLevel;
// XXX Make sure that all the document.written content is
@ -2234,11 +2226,11 @@ nsHTMLDocument::WriteCommon(const nsAString& aText,
// why pay that price when we don't need to?
if (aNewlineTerminate) {
rv = mParser->Parse(aText + new_line,
key, mContentType,
key, GetContentTypeInternal(),
(mWriteState == eNotWriting || (mWriteLevel > 1)));
} else {
rv = mParser->Parse(aText,
key, mContentType,
key, GetContentTypeInternal(),
(mWriteState == eNotWriting || (mWriteLevel > 1)));
}

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

@ -65,7 +65,6 @@ _TEST_FILES = test_bug1682.html \
test_bug369370.html \
bug369370-popup.png \
test_bug380383.html \
test_bug386495.html \
test_bug391777.html \
test_bug402680.html \
test_bug403868.html \
@ -103,6 +102,7 @@ _TEST_FILES = test_bug1682.html \
test_bug499092.html \
bug499092.xml \
bug499092.html \
test_bug571981.html \
$(NULL)
libs:: $(_TEST_FILES)

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

@ -1,42 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=386495
-->
<head>
<title>Test for Bug 386495</title>
<script type="text/javascript" src="/MochiKit/packed.js"></script>
<script type="text/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=386495">Mozilla Bug 386495</a>
<p id="display"></p>
<div id="content">
<iframe id="testIframe"></iframe>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 386495 **/
function finishTest() {
is(document.getElementById("testIframe").contentWindow.timeoutFired, false, "Timeout shouldn't fire.");
SimpleTest.finish();
}
function testContentEditable() {
document.getElementById('testIframe').style.display = 'block';
document.getElementById('testIframe').contentWindow.timeoutFired = false;
document.getElementById('testIframe').contentWindow.setTimeout("window.timeoutFired = true", 50);
document.getElementById('testIframe').contentDocument.designMode = 'on';
setTimeout(finishTest, 100);
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(testContentEditable);
</script>
</pre>
</body>
</html>

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

@ -0,0 +1,59 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=571981
-->
<head>
<title>Test for Bug 571981</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=571981">Mozilla Bug 571981</a>
<p id="display"></p>
<div id="content" style="display: none">
<iframe id="testframe"></iframe>
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 571981 **/
SimpleTest.waitForExplicitFinish();
addLoadEvent(function() {
var doc = document.getElementById("testframe").contentDocument;
var elem = doc.documentElement;
ok(elem.nodeName == "HTML" &&
elem.namespaceURI == "http://www.w3.org/1999/xhtml",
"documentElement should be an html element with nodename 'HTML'");
var childNodes = elem.childNodes;
elem = null;
for (var i = 0; i < childNodes.length; ++i) {
if (childNodes[i].nodeName == "BODY" &&
childNodes[i].namespaceURI == "http://www.w3.org/1999/xhtml") {
elem = childNodes[i];
}
}
ok(elem && doc.body == elem,
"HTMLDocument.body should be an html element with nodeName 'BODY' " +
"and a child of the documentElement");
doc.removeChild(doc.documentElement);
elem = doc.appendChild(doc.createElementNS("http://www.w3.org/1999/xhtml",
"frameset"));
var framesets = doc.getElementsByTagNameNS("http://www.w3.org/1999/xhtml",
"frameset");
ok(doc.body && doc.body == framesets[0],
"HTMLDocument.body should be the first html element in the document " +
"with nodename 'frameset'");
doc.removeChild(doc.documentElement);
doc.appendChild(doc.createElementNS('wrongnamespace', 'frameset'));
is(doc.body, null,
"HTMLDocument.body should not return non-html elements");
SimpleTest.finish();
});
</script>
</pre>
</body>
</html>

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

@ -0,0 +1,28 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" onload="boom();" class="reftest-wait">
<script type="text/javascript">
// <![CDATA[
function boom()
{
var t = document.getBoxObjectFor(document.documentElement).lastChild;
document.documentElement.style.counterIncrement = "c";
setTimeout(boom2, 0, t);
}
function boom2(t)
{
try {
document.documentElement.appendChild(t);
} catch(e) {
// appendChild is expected to throw
document.documentElement.removeAttribute("class");
}
}
// ]]>
</script>
</window>

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

@ -21,3 +21,4 @@ load 429085-1.xhtml
load 431906-1.html
load 451311-1.xul
load 461917-1.xhtml
load 467869-1.xul

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

@ -727,7 +727,7 @@ nsXULDocument::SynchronizeBroadcastListener(nsIDOMElement *aBroadcaster,
}
nsCOMPtr<nsIContent> broadcaster = do_QueryInterface(aBroadcaster);
nsCOMPtr<nsIContent> listener = do_QueryInterface(aListener);
PRBool notify = mInitialLayoutComplete || mHandlingDelayedBroadcasters;
PRBool notify = mDocumentLoaded || mHandlingDelayedBroadcasters;
// We may be copying event handlers etc, so we must also copy
// the script-type to the listener.

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

@ -11166,3 +11166,97 @@ nsDocShell::GetPrintPreview(nsIWebBrowserPrint** aPrintPreview)
#ifdef DEBUG
unsigned long nsDocShell::gNumberOfDocShells = 0;
#endif
NS_IMETHODIMP
nsDocShell::GetCanExecuteScripts(PRBool *aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
*aResult = PR_FALSE; // disallow by default
nsCOMPtr<nsIDocShell> docshell = this;
nsCOMPtr<nsIDocShellTreeItem> globalObjTreeItem =
do_QueryInterface(docshell);
if (globalObjTreeItem)
{
nsCOMPtr<nsIDocShellTreeItem> treeItem(globalObjTreeItem);
nsCOMPtr<nsIDocShellTreeItem> parentItem;
PRBool firstPass = PR_TRUE;
PRBool lookForParents = PR_FALSE;
// Walk up the docshell tree to see if any containing docshell disallows scripts
do
{
nsresult rv = docshell->GetAllowJavascript(aResult);
if (NS_FAILED(rv)) return rv;
if (!*aResult) {
nsDocShell* realDocshell = static_cast<nsDocShell*>(docshell.get());
if (realDocshell->mContentViewer) {
nsIDocument* doc = realDocshell->mContentViewer->GetDocument();
if (doc && doc->HasFlag(NODE_IS_EDITABLE) &&
realDocshell->mEditorData) {
nsCOMPtr<nsIEditingSession> editSession;
realDocshell->mEditorData->GetEditingSession(getter_AddRefs(editSession));
PRBool jsDisabled = PR_FALSE;
if (editSession &&
NS_SUCCEEDED(rv = editSession->GetJsAndPluginsDisabled(&jsDisabled))) {
if (firstPass) {
if (jsDisabled) {
// We have a docshell which has been explicitly set
// to design mode, so we disallow scripts.
return NS_OK;
}
// The docshell was not explicitly set to design mode,
// so it must be so because a parent was explicitly
// set to design mode. We don't need to look at higher
// docshells.
*aResult = PR_TRUE;
break;
} else if (lookForParents && jsDisabled) {
// If a parent was explicitly set to design mode,
// we should allow script execution on the child.
*aResult = PR_TRUE;
break;
}
// If the child docshell allows scripting, and the
// parent is inside design mode, we don't need to look
// further.
*aResult = PR_TRUE;
return NS_OK;
}
NS_WARNING("The editing session does not work?");
return NS_FAILED(rv) ? rv : NS_ERROR_FAILURE;
}
if (firstPass) {
// Don't be too hard on docshells on the first pass.
// There may be a parent docshell which has been set
// to design mode, so look for it.
lookForParents = PR_TRUE;
} else {
// We have a docshell which disallows scripts
// and is not editable, so we shouldn't allow
// scripts at all.
return NS_OK;
}
}
} else if (lookForParents) {
// The parent docshell was not explicitly set to design
// mode, so js on the child docshell was disabled for
// another reason. Therefore, we need to disable js.
return NS_OK;
}
firstPass = PR_FALSE;
treeItem->GetParent(getter_AddRefs(parentItem));
treeItem.swap(parentItem);
docshell = do_QueryInterface(treeItem);
#ifdef DEBUG
if (treeItem && !docshell) {
NS_ERROR("cannot get a docshell from a treeItem!");
}
#endif // DEBUG
} while (treeItem && docshell);
}
return NS_OK;
}

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

@ -71,7 +71,7 @@ interface nsIPrincipal;
interface nsIWebBrowserPrint;
interface nsIVariant;
[scriptable, uuid(3adde256-05a9-43a7-a190-f8fe75eecfd6)]
[scriptable, uuid(8ac6b880-776a-44d4-b271-a7e64ae3debd)]
interface nsIDocShell : nsISupports
{
/**
@ -511,4 +511,14 @@ interface nsIDocShell : nsISupports
* is loaded.
*/
readonly attribute nsIWebBrowserPrint printPreview;
/**
* Whether this docshell can execute scripts based on its hierarchy.
* The rule of thumb here is that we disable js if this docshell or any
* of its parents disallow scripting, unless the only reason for js being
* disabled in this docshell is a parent docshell having a document that
* is in design mode. In that case, we explicitly allow scripting on the
* current docshell.
*/
readonly attribute boolean canExecuteScripts;
};

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

@ -479,15 +479,15 @@
using namespace mozilla::dom;
#include "mozilla/dom/indexedDB/IndexedDatabaseRequest.h"
#include "mozilla/dom/indexedDB/IDBFactory.h"
#include "mozilla/dom/indexedDB/IDBRequest.h"
#include "mozilla/dom/indexedDB/IDBDatabaseRequest.h"
#include "mozilla/dom/indexedDB/IDBDatabase.h"
#include "mozilla/dom/indexedDB/IDBEvents.h"
#include "mozilla/dom/indexedDB/IDBObjectStoreRequest.h"
#include "mozilla/dom/indexedDB/IDBTransactionRequest.h"
#include "mozilla/dom/indexedDB/IDBCursorRequest.h"
#include "mozilla/dom/indexedDB/IDBObjectStore.h"
#include "mozilla/dom/indexedDB/IDBTransaction.h"
#include "mozilla/dom/indexedDB/IDBCursor.h"
#include "mozilla/dom/indexedDB/IDBKeyRange.h"
#include "mozilla/dom/indexedDB/IDBIndexRequest.h"
#include "mozilla/dom/indexedDB/IDBIndex.h"
static NS_DEFINE_CID(kDOMSOF_CID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
@ -1418,11 +1418,11 @@ static nsDOMClassInfoData sClassInfoData[] = {
NS_DEFINE_CLASSINFO_DATA(CloseEvent, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(IndexedDatabaseRequest, nsDOMGenericSH,
NS_DEFINE_CLASSINFO_DATA(IDBFactory, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(IDBRequest, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(IDBDatabaseRequest, nsDOMGenericSH,
NS_DEFINE_CLASSINFO_DATA(IDBDatabase, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(IDBErrorEvent, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
@ -1430,15 +1430,15 @@ static nsDOMClassInfoData sClassInfoData[] = {
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(IDBTransactionEvent, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(IDBObjectStoreRequest, nsDOMGenericSH,
NS_DEFINE_CLASSINFO_DATA(IDBObjectStore, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(IDBTransactionRequest, nsDOMGenericSH,
NS_DEFINE_CLASSINFO_DATA(IDBTransaction, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(IDBCursorRequest, nsDOMGenericSH,
NS_DEFINE_CLASSINFO_DATA(IDBCursor, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(IDBKeyRange, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
NS_DEFINE_CLASSINFO_DATA(IDBIndexRequest, nsDOMGenericSH,
NS_DEFINE_CLASSINFO_DATA(IDBIndex, nsDOMGenericSH,
DOM_DEFAULT_SCRIPTABLE_FLAGS)
};
@ -1532,6 +1532,7 @@ jsval nsDOMClassInfo::sOnpopstate_id = JSVAL_VOID;
jsval nsDOMClassInfo::sOnbeforeunload_id = JSVAL_VOID;
jsval nsDOMClassInfo::sOnunload_id = JSVAL_VOID;
jsval nsDOMClassInfo::sOnhashchange_id = JSVAL_VOID;
jsval nsDOMClassInfo::sOnreadystatechange_id = JSVAL_VOID;
jsval nsDOMClassInfo::sOnpageshow_id = JSVAL_VOID;
jsval nsDOMClassInfo::sOnpagehide_id = JSVAL_VOID;
jsval nsDOMClassInfo::sOnabort_id = JSVAL_VOID;
@ -1733,6 +1734,7 @@ nsDOMClassInfo::DefineStaticJSVals(JSContext *cx)
SET_JSVAL_TO_STRING(sOnbeforeunload_id, cx, "onbeforeunload");
SET_JSVAL_TO_STRING(sOnunload_id, cx, "onunload");
SET_JSVAL_TO_STRING(sOnhashchange_id, cx, "onhashchange");
SET_JSVAL_TO_STRING(sOnreadystatechange_id, cx, "onreadystatechange");
SET_JSVAL_TO_STRING(sOnpageshow_id, cx, "onpageshow");
SET_JSVAL_TO_STRING(sOnpagehide_id, cx, "onpagehide");
SET_JSVAL_TO_STRING(sOnabort_id, cx, "onabort");
@ -3921,8 +3923,8 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_EVENT_MAP_ENTRIES
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(IndexedDatabaseRequest, nsIIndexedDatabaseRequest)
DOM_CLASSINFO_MAP_ENTRY(nsIIndexedDatabaseRequest)
DOM_CLASSINFO_MAP_BEGIN(IDBFactory, nsIIDBFactory)
DOM_CLASSINFO_MAP_ENTRY(nsIIDBFactory)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(IDBRequest, nsIIDBRequest)
@ -3931,8 +3933,7 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(IDBDatabaseRequest, nsIIDBDatabaseRequest)
DOM_CLASSINFO_MAP_ENTRY(nsIIDBDatabaseRequest)
DOM_CLASSINFO_MAP_BEGIN(IDBDatabase, nsIIDBDatabase)
DOM_CLASSINFO_MAP_ENTRY(nsIIDBDatabase)
DOM_CLASSINFO_MAP_END
@ -3955,20 +3956,17 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEvent)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(IDBObjectStoreRequest, nsIIDBObjectStoreRequest)
DOM_CLASSINFO_MAP_ENTRY(nsIIDBObjectStoreRequest)
DOM_CLASSINFO_MAP_BEGIN(IDBObjectStore, nsIIDBObjectStore)
DOM_CLASSINFO_MAP_ENTRY(nsIIDBObjectStore)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(IDBTransactionRequest, nsIIDBTransactionRequest)
DOM_CLASSINFO_MAP_ENTRY(nsIIDBTransactionRequest)
DOM_CLASSINFO_MAP_BEGIN(IDBTransaction, nsIIDBTransaction)
DOM_CLASSINFO_MAP_ENTRY(nsIIDBTransaction)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget)
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(IDBCursorRequest, nsIIDBCursorRequest)
DOM_CLASSINFO_MAP_ENTRY(nsIIDBCursorRequest)
DOM_CLASSINFO_MAP_BEGIN(IDBCursor, nsIIDBCursor)
DOM_CLASSINFO_MAP_ENTRY(nsIIDBCursor)
DOM_CLASSINFO_MAP_END
@ -3976,8 +3974,7 @@ nsDOMClassInfo::Init()
DOM_CLASSINFO_MAP_ENTRY(nsIIDBKeyRange)
DOM_CLASSINFO_MAP_END
DOM_CLASSINFO_MAP_BEGIN(IDBIndexRequest, nsIIDBIndexRequest)
DOM_CLASSINFO_MAP_ENTRY(nsIIDBIndexRequest)
DOM_CLASSINFO_MAP_BEGIN(IDBIndex, nsIIDBIndex)
DOM_CLASSINFO_MAP_ENTRY(nsIIDBIndex)
DOM_CLASSINFO_MAP_END
@ -4709,6 +4706,7 @@ nsDOMClassInfo::ShutDown()
sOnbeforeunload_id = JSVAL_VOID;
sOnunload_id = JSVAL_VOID;
sOnhashchange_id = JSVAL_VOID;
sOnreadystatechange_id = JSVAL_VOID;
sOnpageshow_id = JSVAL_VOID;
sOnpagehide_id = JSVAL_VOID;
sOnabort_id = JSVAL_VOID;
@ -7646,7 +7644,8 @@ nsEventReceiverSH::ReallyIsEventName(jsval id, jschar aFirstChar)
id == sOnmouseup_id ||
id == sOnmousedown_id);
case 'r' :
return (id == sOnreset_id ||
return (id == sOnreadystatechange_id ||
id == sOnreset_id ||
id == sOnresize_id);
case 's' :
return (id == sOnscroll_id ||

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

@ -321,6 +321,7 @@ protected:
static jsval sOnbeforeunload_id;
static jsval sOnunload_id;
static jsval sOnhashchange_id;
static jsval sOnreadystatechange_id;
static jsval sOnpageshow_id;
static jsval sOnpagehide_id;
static jsval sOnabort_id;

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

@ -480,14 +480,14 @@ DOMCI_CLASS(FormData)
DOMCI_CLASS(WebSocket)
DOMCI_CLASS(CloseEvent)
DOMCI_CLASS(IndexedDatabaseRequest)
DOMCI_CLASS(IDBFactory)
DOMCI_CLASS(IDBRequest)
DOMCI_CLASS(IDBDatabaseRequest)
DOMCI_CLASS(IDBDatabase)
DOMCI_CLASS(IDBErrorEvent)
DOMCI_CLASS(IDBSuccessEvent)
DOMCI_CLASS(IDBTransactionEvent)
DOMCI_CLASS(IDBObjectStoreRequest)
DOMCI_CLASS(IDBTransactionRequest)
DOMCI_CLASS(IDBCursorRequest)
DOMCI_CLASS(IDBObjectStore)
DOMCI_CLASS(IDBTransaction)
DOMCI_CLASS(IDBCursor)
DOMCI_CLASS(IDBKeyRange)
DOMCI_CLASS(IDBIndexRequest)
DOMCI_CLASS(IDBIndex)

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