зеркало из https://github.com/mozilla/gecko-dev.git
Revert inbound to 3d5d1daa2505 to stop OS X M5 failures (backout not clean/could have been a bad merge) on a CLOSED TREE
This commit is contained in:
Родитель
7e6c93672c
Коммит
f4181983a1
|
@ -26,11 +26,21 @@
|
|||
#include "mozilla/dom/Element.h"
|
||||
|
||||
#include "nsIAccessibleRelation.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIDocShellTreeItem.h"
|
||||
#include "nsIDocShellTreeNode.h"
|
||||
#include "nsIDocShellTreeOwner.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMHTMLAnchorElement.h"
|
||||
#include "nsIDOMHTMLImageElement.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsIDOMHTMLSelectElement.h"
|
||||
#include "nsIDOMDataContainerEvent.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsIDOMXULMultSelectCntrlEl.h"
|
||||
#include "nsIDOMXULPopupElement.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsIFrame.h"
|
||||
|
@ -252,9 +262,9 @@ RootAccessible::DocumentActivated(DocAccessible* aDocument)
|
|||
NS_IMETHODIMP
|
||||
RootAccessible::HandleEvent(nsIDOMEvent* aDOMEvent)
|
||||
{
|
||||
MOZ_ASSERT(aDOMEvent);
|
||||
nsCOMPtr<nsIDOMNSEvent> DOMNSEvent(do_QueryInterface(aDOMEvent));
|
||||
nsCOMPtr<nsIDOMEventTarget> DOMEventTarget;
|
||||
aDOMEvent->GetOriginalTarget(getter_AddRefs(DOMEventTarget));
|
||||
DOMNSEvent->GetOriginalTarget(getter_AddRefs(DOMEventTarget));
|
||||
nsCOMPtr<nsINode> origTargetNode(do_QueryInterface(DOMEventTarget));
|
||||
if (!origTargetNode)
|
||||
return NS_OK;
|
||||
|
@ -289,9 +299,9 @@ RootAccessible::HandleEvent(nsIDOMEvent* aDOMEvent)
|
|||
void
|
||||
RootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
|
||||
{
|
||||
MOZ_ASSERT(aDOMEvent);
|
||||
nsCOMPtr<nsIDOMNSEvent> DOMNSEvent(do_QueryInterface(aDOMEvent));
|
||||
nsCOMPtr<nsIDOMEventTarget> DOMEventTarget;
|
||||
aDOMEvent->GetOriginalTarget(getter_AddRefs(DOMEventTarget));
|
||||
DOMNSEvent->GetOriginalTarget(getter_AddRefs(DOMEventTarget));
|
||||
nsCOMPtr<nsINode> origTargetNode(do_QueryInterface(DOMEventTarget));
|
||||
|
||||
nsAutoString eventType;
|
||||
|
|
|
@ -68,6 +68,7 @@ pref("mozilla.widget.force-24bpp", true);
|
|||
pref("mozilla.widget.use-buffer-pixmap", true);
|
||||
pref("mozilla.widget.disable-native-theme", true);
|
||||
pref("layout.reflow.synthMouseMove", false);
|
||||
pref("dom.send_after_paint_to_content", true);
|
||||
|
||||
/* download manager (don't show the window or alert) */
|
||||
pref("browser.download.useDownloadDir", true);
|
||||
|
|
|
@ -67,13 +67,13 @@ function test_gestureListener(evt)
|
|||
is(evt.delta, test_expectedDelta,
|
||||
"evt.delta (" + evt.delta + ") does not match expected value");
|
||||
|
||||
is(evt.shiftKey, (test_expectedModifiers & Components.interfaces.nsIDOMEvent.SHIFT_MASK) != 0,
|
||||
is(evt.shiftKey, (test_expectedModifiers & Components.interfaces.nsIDOMNSEvent.SHIFT_MASK) != 0,
|
||||
"evt.shiftKey did not match expected value");
|
||||
is(evt.ctrlKey, (test_expectedModifiers & Components.interfaces.nsIDOMEvent.CONTROL_MASK) != 0,
|
||||
is(evt.ctrlKey, (test_expectedModifiers & Components.interfaces.nsIDOMNSEvent.CONTROL_MASK) != 0,
|
||||
"evt.ctrlKey did not match expected value");
|
||||
is(evt.altKey, (test_expectedModifiers & Components.interfaces.nsIDOMEvent.ALT_MASK) != 0,
|
||||
is(evt.altKey, (test_expectedModifiers & Components.interfaces.nsIDOMNSEvent.ALT_MASK) != 0,
|
||||
"evt.altKey did not match expected value");
|
||||
is(evt.metaKey, (test_expectedModifiers & Components.interfaces.nsIDOMEvent.META_MASK) != 0,
|
||||
is(evt.metaKey, (test_expectedModifiers & Components.interfaces.nsIDOMNSEvent.META_MASK) != 0,
|
||||
"evt.metaKey did not match expected value");
|
||||
|
||||
if (evt.type == "MozTapGesture") {
|
||||
|
@ -158,19 +158,19 @@ function test_TestEventListeners()
|
|||
e("MozEdgeUIGesture", 0, 0, 0);
|
||||
|
||||
// event.shiftKey
|
||||
let modifier = Components.interfaces.nsIDOMEvent.SHIFT_MASK;
|
||||
let modifier = Components.interfaces.nsIDOMNSEvent.SHIFT_MASK;
|
||||
e("MozSwipeGesture", SimpleGestureEvent.DIRECTION_RIGHT, 0, modifier);
|
||||
|
||||
// event.metaKey
|
||||
modifier = Components.interfaces.nsIDOMEvent.META_MASK;
|
||||
modifier = Components.interfaces.nsIDOMNSEvent.META_MASK;
|
||||
e("MozSwipeGesture", SimpleGestureEvent.DIRECTION_RIGHT, 0, modifier);
|
||||
|
||||
// event.altKey
|
||||
modifier = Components.interfaces.nsIDOMEvent.ALT_MASK;
|
||||
modifier = Components.interfaces.nsIDOMNSEvent.ALT_MASK;
|
||||
e("MozSwipeGesture", SimpleGestureEvent.DIRECTION_RIGHT, 0, modifier);
|
||||
|
||||
// event.ctrlKey
|
||||
modifier = Components.interfaces.nsIDOMEvent.CONTROL_MASK;
|
||||
modifier = Components.interfaces.nsIDOMNSEvent.CONTROL_MASK;
|
||||
e("MozSwipeGesture", SimpleGestureEvent.DIRECTION_RIGHT, 0, modifier);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ srcdir = @srcdir@
|
|||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
EXTRA_COMPONENTS = \
|
||||
nsSessionStore.manifest \
|
||||
|
@ -19,16 +18,24 @@ EXTRA_PP_COMPONENTS = \
|
|||
nsSessionStartup.js \
|
||||
$(NULL)
|
||||
|
||||
JS_MODULES_PATH := $(FINAL_TARGET)/modules/sessionstore
|
||||
libs::
|
||||
$(NSINSTALL) $(srcdir)/*.jsm $(FINAL_TARGET)/modules/sessionstore
|
||||
|
||||
EXTRA_JS_MODULES := \
|
||||
DocumentUtils.jsm \
|
||||
SessionStorage.jsm \
|
||||
XPathGenerator.jsm \
|
||||
$(NULL)
|
||||
|
||||
EXTRA_PP_JS_MODULES := \
|
||||
SS_EXTRA_PP_JS_MODULES = \
|
||||
SessionStore.jsm \
|
||||
$(NULL)
|
||||
|
||||
ifdef SS_EXTRA_PP_JS_MODULES
|
||||
libs:: $(SS_EXTRA_PP_JS_MODULES)
|
||||
ifndef NO_DIST_INSTALL
|
||||
$(EXIT_ON_ERROR) \
|
||||
$(NSINSTALL) -D $(FINAL_TARGET)/modules/sessionstore; \
|
||||
for i in $^; do \
|
||||
dest=$(FINAL_TARGET)/modules/sessionstore/`basename $$i`; \
|
||||
$(RM) -f $$dest; \
|
||||
$(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $$i > $$dest; \
|
||||
done
|
||||
endif
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
|
@ -1384,14 +1384,11 @@ libs::
|
|||
endif
|
||||
|
||||
################################################################################
|
||||
# Copy each element of EXTRA_JS_MODULES to JS_MODULES_PATH, or
|
||||
# $(FINAL_TARGET)/modules if that isn't defined.
|
||||
JS_MODULES_PATH ?= $(FINAL_TARGET)/modules
|
||||
|
||||
# Copy each element of EXTRA_JS_MODULES to $(FINAL_TARGET)/modules
|
||||
ifdef EXTRA_JS_MODULES
|
||||
libs:: $(EXTRA_JS_MODULES)
|
||||
ifndef NO_DIST_INSTALL
|
||||
$(call install_cmd,$(IFLAGS1) $^ $(JS_MODULES_PATH))
|
||||
$(call install_cmd,$(IFLAGS1) $^ $(FINAL_TARGET)/modules)
|
||||
endif
|
||||
|
||||
endif
|
||||
|
@ -1400,9 +1397,9 @@ ifdef EXTRA_PP_JS_MODULES
|
|||
libs:: $(EXTRA_PP_JS_MODULES)
|
||||
ifndef NO_DIST_INSTALL
|
||||
$(EXIT_ON_ERROR) \
|
||||
$(NSINSTALL) -D $(JS_MODULES_PATH); \
|
||||
$(NSINSTALL) -D $(FINAL_TARGET)/modules; \
|
||||
for i in $^; do \
|
||||
dest=$(JS_MODULES_PATH)/`basename $$i`; \
|
||||
dest=$(FINAL_TARGET)/modules/`basename $$i`; \
|
||||
$(RM) -f $$dest; \
|
||||
$(PYTHON) $(topsrcdir)/config/Preprocessor.py $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) $$i > $$dest; \
|
||||
done
|
||||
|
|
|
@ -2019,44 +2019,6 @@ public:
|
|||
*/
|
||||
static bool IsJavaScriptLanguage(const nsString& aName, PRUint32 *aVerFlags);
|
||||
|
||||
/**
|
||||
* Returns the JSVersion for a string of the form '1.n', n = 0, ..., 8, and
|
||||
* JSVERSION_UNKNOWN for other strings.
|
||||
*/
|
||||
static JSVersion ParseJavascriptVersion(const nsAString& aVersionStr);
|
||||
|
||||
static bool IsJavascriptMIMEType(const nsAString& aMIMEType)
|
||||
{
|
||||
// Table ordered from most to least likely JS MIME types.
|
||||
static const char* jsTypes[] = {
|
||||
"text/javascript",
|
||||
"text/ecmascript",
|
||||
"application/javascript",
|
||||
"application/ecmascript",
|
||||
"application/x-javascript",
|
||||
"application/x-ecmascript",
|
||||
"text/javascript1.0",
|
||||
"text/javascript1.1",
|
||||
"text/javascript1.2",
|
||||
"text/javascript1.3",
|
||||
"text/javascript1.4",
|
||||
"text/javascript1.5",
|
||||
"text/jscript",
|
||||
"text/livescript",
|
||||
"text/x-ecmascript",
|
||||
"text/x-javascript",
|
||||
nullptr
|
||||
};
|
||||
|
||||
for (PRUint32 i = 0; jsTypes[i]; ++i) {
|
||||
if (aMIMEType.LowerCaseEqualsASCII(jsTypes[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static void SplitMimeType(const nsAString& aValue, nsString& aType,
|
||||
nsString& aParams);
|
||||
|
||||
|
|
|
@ -444,8 +444,10 @@ nsAttrAndChildArray::RemoveAttrAt(PRUint32 aPos, nsAttrValue& aValue)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsRefPtr<nsMappedAttributes> mapped =
|
||||
GetModifiableMapped(nullptr, nullptr, false);
|
||||
nsRefPtr<nsMappedAttributes> mapped;
|
||||
nsresult rv = GetModifiableMapped(nullptr, nullptr, false,
|
||||
getter_AddRefs(mapped));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mapped->RemoveAttrAt(aPos, aValue);
|
||||
|
||||
|
@ -556,15 +558,18 @@ nsAttrAndChildArray::SetAndTakeMappedAttr(nsIAtom* aLocalName,
|
|||
nsMappedAttributeElement* aContent,
|
||||
nsHTMLStyleSheet* aSheet)
|
||||
{
|
||||
nsRefPtr<nsMappedAttributes> mapped;
|
||||
|
||||
bool willAdd = true;
|
||||
if (mImpl && mImpl->mMappedAttrs) {
|
||||
willAdd = !mImpl->mMappedAttrs->GetAttr(aLocalName);
|
||||
willAdd = mImpl->mMappedAttrs->GetAttr(aLocalName) == nullptr;
|
||||
}
|
||||
|
||||
nsRefPtr<nsMappedAttributes> mapped =
|
||||
GetModifiableMapped(aContent, aSheet, willAdd);
|
||||
nsresult rv = GetModifiableMapped(aContent, aSheet, willAdd,
|
||||
getter_AddRefs(mapped));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsresult rv = mapped->SetAndTakeAttr(aLocalName, aValue);
|
||||
rv = mapped->SetAndTakeAttr(aLocalName, aValue);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return MakeMappedUnique(mapped);
|
||||
|
@ -579,8 +584,10 @@ nsAttrAndChildArray::DoSetMappedAttrStyleSheet(nsHTMLStyleSheet* aSheet)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsRefPtr<nsMappedAttributes> mapped =
|
||||
GetModifiableMapped(nullptr, nullptr, false);
|
||||
nsRefPtr<nsMappedAttributes> mapped;
|
||||
nsresult rv = GetModifiableMapped(nullptr, nullptr, false,
|
||||
getter_AddRefs(mapped));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mapped->SetStyleSheet(aSheet);
|
||||
|
||||
|
@ -690,20 +697,33 @@ nsAttrAndChildArray::MappedAttrCount() const
|
|||
return mImpl && mImpl->mMappedAttrs ? (PRUint32)mImpl->mMappedAttrs->Count() : 0;
|
||||
}
|
||||
|
||||
nsMappedAttributes*
|
||||
nsresult
|
||||
nsAttrAndChildArray::GetModifiableMapped(nsMappedAttributeElement* aContent,
|
||||
nsHTMLStyleSheet* aSheet,
|
||||
bool aWillAddAttr)
|
||||
bool aWillAddAttr,
|
||||
nsMappedAttributes** aModifiable)
|
||||
{
|
||||
*aModifiable = nullptr;
|
||||
|
||||
if (mImpl && mImpl->mMappedAttrs) {
|
||||
return mImpl->mMappedAttrs->Clone(aWillAddAttr);
|
||||
*aModifiable = mImpl->mMappedAttrs->Clone(aWillAddAttr);
|
||||
NS_ENSURE_TRUE(*aModifiable, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
NS_ADDREF(*aModifiable);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(aContent, "Trying to create modifiable without content");
|
||||
NS_ASSERTION(aContent, "Trying to create modifiable without content");
|
||||
|
||||
nsMapRuleToAttributesFunc mapRuleFunc =
|
||||
aContent->GetAttributeMappingFunction();
|
||||
return new nsMappedAttributes(aSheet, mapRuleFunc);
|
||||
*aModifiable = new nsMappedAttributes(aSheet, mapRuleFunc);
|
||||
NS_ENSURE_TRUE(*aModifiable, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
NS_ADDREF(*aModifiable);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -127,11 +127,10 @@ private:
|
|||
PRUint32 NonMappedAttrCount() const;
|
||||
PRUint32 MappedAttrCount() const;
|
||||
|
||||
// Returns a non-null zero-refcount object.
|
||||
nsMappedAttributes*
|
||||
GetModifiableMapped(nsMappedAttributeElement* aContent,
|
||||
nsHTMLStyleSheet* aSheet,
|
||||
bool aWillAddAttr);
|
||||
nsresult GetModifiableMapped(nsMappedAttributeElement* aContent,
|
||||
nsHTMLStyleSheet* aSheet,
|
||||
bool aWillAddAttr,
|
||||
nsMappedAttributes** aModifiable);
|
||||
nsresult MakeMappedUnique(nsMappedAttributes* aAttributes);
|
||||
|
||||
PRUint32 AttrSlotsSize() const
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "nsIDOMNode.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsIDOMDragEvent.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
|
@ -56,7 +57,7 @@
|
|||
class NS_STACK_CLASS DragDataProducer
|
||||
{
|
||||
public:
|
||||
DragDataProducer(nsPIDOMWindow* aWindow,
|
||||
DragDataProducer(nsIDOMWindow* aWindow,
|
||||
nsIContent* aTarget,
|
||||
nsIContent* aSelectionTargetNode,
|
||||
bool aIsAltKeyPressed);
|
||||
|
@ -84,7 +85,7 @@ private:
|
|||
static void GetSelectedLink(nsISelection* inSelection,
|
||||
nsIContent **outLinkNode);
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> mWindow;
|
||||
nsCOMPtr<nsIDOMWindow> mWindow;
|
||||
nsCOMPtr<nsIContent> mTarget;
|
||||
nsCOMPtr<nsIContent> mSelectionTargetNode;
|
||||
bool mIsAltKeyPressed;
|
||||
|
@ -104,7 +105,7 @@ private:
|
|||
|
||||
|
||||
nsresult
|
||||
nsContentAreaDragDrop::GetDragData(nsPIDOMWindow* aWindow,
|
||||
nsContentAreaDragDrop::GetDragData(nsIDOMWindow* aWindow,
|
||||
nsIContent* aTarget,
|
||||
nsIContent* aSelectionTargetNode,
|
||||
bool aIsAltKeyPressed,
|
||||
|
@ -238,7 +239,7 @@ nsContentAreaDragDropDataProvider::GetFlavorData(nsITransferable *aTransferable,
|
|||
return rv;
|
||||
}
|
||||
|
||||
DragDataProducer::DragDataProducer(nsPIDOMWindow* aWindow,
|
||||
DragDataProducer::DragDataProducer(nsIDOMWindow* aWindow,
|
||||
nsIContent* aTarget,
|
||||
nsIContent* aSelectionTargetNode,
|
||||
bool aIsAltKeyPressed)
|
||||
|
@ -648,7 +649,9 @@ DragDataProducer::Produce(nsDOMDataTransfer* aDataTransfer,
|
|||
mInfoString.Truncate();
|
||||
mTitleString.Truncate();
|
||||
|
||||
nsCOMPtr<nsIDocument> doc = mWindow->GetDoc();
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
mWindow->GetDocument(getter_AddRefs(domDoc));
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(domDoc);
|
||||
NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE);
|
||||
|
||||
// if we have selected text, use it in preference to the node
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include "nsITransferable.h"
|
||||
|
||||
class nsIDOMNode;
|
||||
class nsPIDOMWindow;
|
||||
class nsIDOMWindow;
|
||||
class nsIDOMDragEvent;
|
||||
class nsISelection;
|
||||
class nsITransferable;
|
||||
|
@ -49,7 +49,7 @@ public:
|
|||
* aDragNode - [out] the link, image or area being dragged, or null if the
|
||||
* drag occurred on another element.
|
||||
*/
|
||||
static nsresult GetDragData(nsPIDOMWindow* aWindow,
|
||||
static nsresult GetDragData(nsIDOMWindow* aWindow,
|
||||
nsIContent* aTarget,
|
||||
nsIContent* aSelectionTargetNode,
|
||||
bool aIsAltKeyPressed,
|
||||
|
|
|
@ -88,6 +88,7 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
|
|||
#include "nsContentErrors.h"
|
||||
#include "nsUnicharUtilCIID.h"
|
||||
#include "nsINativeKeyBindings.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsXULPopupManager.h"
|
||||
#include "nsIPermissionManager.h"
|
||||
#include "nsIScriptObjectPrincipal.h"
|
||||
|
@ -844,28 +845,6 @@ nsContentUtils::IsJavaScriptLanguage(const nsString& aName, PRUint32 *aFlags)
|
|||
return true;
|
||||
}
|
||||
|
||||
JSVersion
|
||||
nsContentUtils::ParseJavascriptVersion(const nsAString& aVersionStr)
|
||||
{
|
||||
if (aVersionStr.Length() != 3 || aVersionStr[0] != '1' ||
|
||||
aVersionStr[1] != '.') {
|
||||
return JSVERSION_UNKNOWN;
|
||||
}
|
||||
|
||||
switch (aVersionStr[2]) {
|
||||
case '0': return JSVERSION_1_0;
|
||||
case '1': return JSVERSION_1_1;
|
||||
case '2': return JSVERSION_1_2;
|
||||
case '3': return JSVERSION_1_3;
|
||||
case '4': return JSVERSION_1_4;
|
||||
case '5': return JSVERSION_1_5;
|
||||
case '6': return JSVERSION_1_6;
|
||||
case '7': return JSVERSION_1_7;
|
||||
case '8': return JSVERSION_1_8;
|
||||
default: return JSVERSION_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsContentUtils::SplitMimeType(const nsAString& aValue, nsString& aType,
|
||||
nsString& aParams)
|
||||
|
@ -4688,13 +4667,14 @@ nsContentUtils::DOMEventToNativeKeyEvent(nsIDOMKeyEvent* aKeyEvent,
|
|||
nsNativeKeyEvent* aNativeEvent,
|
||||
bool aGetCharCode)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent = do_QueryInterface(aKeyEvent);
|
||||
bool defaultPrevented;
|
||||
aKeyEvent->GetPreventDefault(&defaultPrevented);
|
||||
nsevent->GetPreventDefault(&defaultPrevented);
|
||||
if (defaultPrevented)
|
||||
return false;
|
||||
|
||||
bool trusted = false;
|
||||
aKeyEvent->GetIsTrusted(&trusted);
|
||||
nsevent->GetIsTrusted(&trusted);
|
||||
if (!trusted)
|
||||
return false;
|
||||
|
||||
|
|
|
@ -2262,6 +2262,7 @@ nsDocument::ResetStylesheetsToURI(nsIURI* aURI)
|
|||
// is probably the right thing to do.
|
||||
|
||||
// Now reset our inline style and attribute sheets.
|
||||
nsresult rv = NS_OK;
|
||||
if (mAttrStyleSheet) {
|
||||
// Remove this sheet from all style sets
|
||||
nsCOMPtr<nsIPresShell> shell = GetShell();
|
||||
|
@ -2271,8 +2272,11 @@ nsDocument::ResetStylesheetsToURI(nsIURI* aURI)
|
|||
}
|
||||
mAttrStyleSheet->Reset(aURI);
|
||||
} else {
|
||||
mAttrStyleSheet = new nsHTMLStyleSheet(aURI, this);
|
||||
NS_ADDREF(mAttrStyleSheet);
|
||||
rv = NS_NewHTMLStyleSheet(&mAttrStyleSheet, aURI, this);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_IF_RELEASE(mAttrStyleSheet);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
}
|
||||
|
||||
// Don't use AddStyleSheet, since it'll put the sheet into style
|
||||
|
@ -2289,7 +2293,8 @@ nsDocument::ResetStylesheetsToURI(nsIURI* aURI)
|
|||
mStyleAttrStyleSheet->Reset(aURI);
|
||||
} else {
|
||||
mStyleAttrStyleSheet = new nsHTMLCSSStyleSheet();
|
||||
nsresult rv = mStyleAttrStyleSheet->Init(aURI, this);
|
||||
NS_ENSURE_TRUE(mStyleAttrStyleSheet, NS_ERROR_OUT_OF_MEMORY);
|
||||
rv = mStyleAttrStyleSheet->Init(aURI, this);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
|
@ -2303,7 +2308,7 @@ nsDocument::ResetStylesheetsToURI(nsIURI* aURI)
|
|||
FillStyleSet(shell->StyleSet());
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
return rv;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -6414,44 +6419,15 @@ nsDocument::IsScriptEnabled()
|
|||
}
|
||||
|
||||
nsRadioGroupStruct*
|
||||
nsDocument::GetRadioGroupInternal(const nsAString& aName) const
|
||||
nsDocument::GetRadioGroup(const nsAString& aName)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
nsAutoString tmKey(aName);
|
||||
if (IsHTML()) {
|
||||
nsAutoString lcName;
|
||||
ToLowerCase(aName, lcName);
|
||||
MOZ_ASSERT(aName == lcName);
|
||||
ToLowerCase(tmKey); //should case-insensitive.
|
||||
}
|
||||
#endif
|
||||
|
||||
nsRadioGroupStruct* radioGroup;
|
||||
if (!mRadioGroups.Get(aName, &radioGroup)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return radioGroup;
|
||||
}
|
||||
|
||||
nsRadioGroupStruct*
|
||||
nsDocument::GetRadioGroup(const nsAString& aName) const
|
||||
{
|
||||
nsAutoString tmKey(aName);
|
||||
if (IsHTML()) {
|
||||
ToLowerCase(tmKey); //should case-insensitive.
|
||||
}
|
||||
|
||||
return GetRadioGroupInternal(tmKey);
|
||||
}
|
||||
|
||||
nsRadioGroupStruct*
|
||||
nsDocument::GetOrCreateRadioGroup(const nsAString& aName)
|
||||
{
|
||||
nsAutoString tmKey(aName);
|
||||
if (IsHTML()) {
|
||||
ToLowerCase(tmKey); //should case-insensitive.
|
||||
}
|
||||
|
||||
if (nsRadioGroupStruct* radioGroup = GetRadioGroupInternal(tmKey)) {
|
||||
if (mRadioGroups.Get(tmKey, &radioGroup)) {
|
||||
return radioGroup;
|
||||
}
|
||||
|
||||
|
@ -6465,7 +6441,9 @@ NS_IMETHODIMP
|
|||
nsDocument::SetCurrentRadioButton(const nsAString& aName,
|
||||
nsIDOMHTMLInputElement* aRadio)
|
||||
{
|
||||
nsRadioGroupStruct* radioGroup = GetOrCreateRadioGroup(aName);
|
||||
nsRadioGroupStruct* radioGroup = GetRadioGroup(aName);
|
||||
NS_ENSURE_TRUE(radioGroup, NS_OK);
|
||||
|
||||
radioGroup->mSelectedRadioButton = aRadio;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -6474,7 +6452,9 @@ NS_IMETHODIMP
|
|||
nsDocument::GetCurrentRadioButton(const nsAString& aName,
|
||||
nsIDOMHTMLInputElement** aRadio)
|
||||
{
|
||||
nsRadioGroupStruct* radioGroup = GetOrCreateRadioGroup(aName);
|
||||
nsRadioGroupStruct* radioGroup = GetRadioGroup(aName);
|
||||
NS_ENSURE_TRUE(radioGroup, NS_OK);
|
||||
|
||||
*aRadio = radioGroup->mSelectedRadioButton;
|
||||
NS_IF_ADDREF(*aRadio);
|
||||
return NS_OK;
|
||||
|
@ -6492,7 +6472,8 @@ nsDocument::GetNextRadioButton(const nsAString& aName,
|
|||
// opposed to nsHTMLDocument?
|
||||
*aRadioOut = nullptr;
|
||||
|
||||
nsRadioGroupStruct* radioGroup = GetOrCreateRadioGroup(aName);
|
||||
nsRadioGroupStruct* radioGroup = GetRadioGroup(aName);
|
||||
NS_ENSURE_TRUE(radioGroup, NS_ERROR_FAILURE);
|
||||
|
||||
// Return the radio button relative to the focused radio button.
|
||||
// If no radio is focused, get the radio relative to the selected one.
|
||||
|
@ -6537,7 +6518,8 @@ NS_IMETHODIMP
|
|||
nsDocument::AddToRadioGroup(const nsAString& aName,
|
||||
nsIFormControl* aRadio)
|
||||
{
|
||||
nsRadioGroupStruct* radioGroup = GetOrCreateRadioGroup(aName);
|
||||
nsRadioGroupStruct* radioGroup = GetRadioGroup(aName);
|
||||
NS_ENSURE_TRUE(radioGroup, NS_OK);
|
||||
|
||||
radioGroup->mRadioButtons.AppendObject(aRadio);
|
||||
|
||||
|
@ -6553,7 +6535,8 @@ NS_IMETHODIMP
|
|||
nsDocument::RemoveFromRadioGroup(const nsAString& aName,
|
||||
nsIFormControl* aRadio)
|
||||
{
|
||||
nsRadioGroupStruct* radioGroup = GetOrCreateRadioGroup(aName);
|
||||
nsRadioGroupStruct* radioGroup = GetRadioGroup(aName);
|
||||
NS_ENSURE_TRUE(radioGroup, NS_OK);
|
||||
|
||||
radioGroup->mRadioButtons.RemoveObject(aRadio);
|
||||
|
||||
|
@ -6572,7 +6555,8 @@ nsDocument::WalkRadioGroup(const nsAString& aName,
|
|||
nsIRadioVisitor* aVisitor,
|
||||
bool aFlushContent)
|
||||
{
|
||||
nsRadioGroupStruct* radioGroup = GetOrCreateRadioGroup(aName);
|
||||
nsRadioGroupStruct* radioGroup = GetRadioGroup(aName);
|
||||
NS_ENSURE_TRUE(radioGroup, NS_OK);
|
||||
|
||||
for (int i = 0; i < radioGroup->mRadioButtons.Count(); i++) {
|
||||
if (!aVisitor->Visit(radioGroup->mRadioButtons[i])) {
|
||||
|
@ -6586,14 +6570,26 @@ nsDocument::WalkRadioGroup(const nsAString& aName,
|
|||
PRUint32
|
||||
nsDocument::GetRequiredRadioCount(const nsAString& aName) const
|
||||
{
|
||||
nsRadioGroupStruct* radioGroup = GetRadioGroup(aName);
|
||||
nsRadioGroupStruct* radioGroup = nullptr;
|
||||
// TODO: we should call GetRadioGroup here (and make it const) but for that
|
||||
// we would need to have an explicit CreateRadioGroup() instead of create
|
||||
// one when GetRadioGroup is called. See bug 636123.
|
||||
nsAutoString tmKey(aName);
|
||||
if (IsHTML())
|
||||
ToLowerCase(tmKey); //should case-insensitive.
|
||||
mRadioGroups.Get(tmKey, &radioGroup);
|
||||
|
||||
return radioGroup ? radioGroup->mRequiredRadioCount : 0;
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::RadioRequiredChanged(const nsAString& aName, nsIFormControl* aRadio)
|
||||
{
|
||||
nsRadioGroupStruct* radioGroup = GetOrCreateRadioGroup(aName);
|
||||
nsRadioGroupStruct* radioGroup = GetRadioGroup(aName);
|
||||
|
||||
if (!radioGroup) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContent> element = do_QueryInterface(aRadio);
|
||||
NS_ASSERTION(element, "radio controls have to be content elements");
|
||||
|
@ -6609,14 +6605,27 @@ nsDocument::RadioRequiredChanged(const nsAString& aName, nsIFormControl* aRadio)
|
|||
bool
|
||||
nsDocument::GetValueMissingState(const nsAString& aName) const
|
||||
{
|
||||
nsRadioGroupStruct* radioGroup = GetRadioGroup(aName);
|
||||
nsRadioGroupStruct* radioGroup = nullptr;
|
||||
// TODO: we should call GetRadioGroup here (and make it const) but for that
|
||||
// we would need to have an explicit CreateRadioGroup() instead of create
|
||||
// one when GetRadioGroup is called. See bug 636123.
|
||||
nsAutoString tmKey(aName);
|
||||
if (IsHTML())
|
||||
ToLowerCase(tmKey); //should case-insensitive.
|
||||
mRadioGroups.Get(tmKey, &radioGroup);
|
||||
|
||||
return radioGroup && radioGroup->mGroupSuffersFromValueMissing;
|
||||
}
|
||||
|
||||
void
|
||||
nsDocument::SetValueMissingState(const nsAString& aName, bool aValue)
|
||||
{
|
||||
nsRadioGroupStruct* radioGroup = GetOrCreateRadioGroup(aName);
|
||||
nsRadioGroupStruct* radioGroup = GetRadioGroup(aName);
|
||||
|
||||
if (!radioGroup) {
|
||||
return;
|
||||
}
|
||||
|
||||
radioGroup->mGroupSuffersFromValueMissing = aValue;
|
||||
}
|
||||
|
||||
|
|
|
@ -723,13 +723,8 @@ public:
|
|||
virtual void SetValueMissingState(const nsAString& aName, bool aValue);
|
||||
|
||||
// for radio group
|
||||
nsRadioGroupStruct* GetRadioGroup(const nsAString& aName) const;
|
||||
nsRadioGroupStruct* GetOrCreateRadioGroup(const nsAString& aName);
|
||||
nsRadioGroupStruct* GetRadioGroup(const nsAString& aName);
|
||||
|
||||
private:
|
||||
nsRadioGroupStruct* GetRadioGroupInternal(const nsAString& aName) const;
|
||||
|
||||
public:
|
||||
// nsIDOMNode
|
||||
NS_DECL_NSIDOMNODE
|
||||
|
||||
|
|
|
@ -437,11 +437,10 @@ nsINode::RemoveChild(nsINode *aOldChild)
|
|||
}
|
||||
|
||||
if (IsNodeOfType(eDATA_NODE)) {
|
||||
// aOldChild can't be one of our children.
|
||||
return NS_ERROR_DOM_NOT_FOUND_ERR;
|
||||
return NS_ERROR_DOM_HIERARCHY_REQUEST_ERR;
|
||||
}
|
||||
|
||||
if (aOldChild->GetNodeParent() == this) {
|
||||
if (aOldChild && aOldChild->GetNodeParent() == this) {
|
||||
nsContentUtils::MaybeFireNodeRemoved(aOldChild, this, OwnerDoc());
|
||||
}
|
||||
|
||||
|
|
|
@ -68,7 +68,9 @@ void* nsMappedAttributes::operator new(size_t aSize, PRUint32 aAttrCount) CPP_TH
|
|||
aAttrCount * sizeof(InternalAttr));
|
||||
|
||||
#ifdef DEBUG
|
||||
static_cast<nsMappedAttributes*>(newAttrs)->mBufferSize = aAttrCount;
|
||||
if (newAttrs) {
|
||||
static_cast<nsMappedAttributes*>(newAttrs)->mBufferSize = aAttrCount;
|
||||
}
|
||||
#endif
|
||||
|
||||
return newAttrs;
|
||||
|
|
|
@ -26,8 +26,8 @@ public:
|
|||
nsMappedAttributes(nsHTMLStyleSheet* aSheet,
|
||||
nsMapRuleToAttributesFunc aMapRuleFunc);
|
||||
|
||||
// Do not return null.
|
||||
void* operator new(size_t size, PRUint32 aAttrCount = 1) CPP_THROW_NEW;
|
||||
|
||||
nsMappedAttributes* Clone(bool aWillAddAttr);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
|
|
@ -1839,7 +1839,7 @@ nsRange::CompareBoundaryPoints(PRUint16 aHow, nsIDOMRange* aOtherRange,
|
|||
break;
|
||||
default:
|
||||
// We were passed an illegal value
|
||||
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
}
|
||||
|
||||
if (mRoot != otherRange->GetRoot())
|
||||
|
|
|
@ -352,50 +352,6 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
static inline bool
|
||||
ParseTypeAttribute(const nsAString& aType, JSVersion* aVersion)
|
||||
{
|
||||
MOZ_ASSERT(!aType.IsEmpty());
|
||||
MOZ_ASSERT(aVersion);
|
||||
MOZ_ASSERT(*aVersion == JSVERSION_DEFAULT);
|
||||
|
||||
nsContentTypeParser parser(aType);
|
||||
|
||||
nsAutoString mimeType;
|
||||
nsresult rv = parser.GetType(mimeType);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
|
||||
if (!nsContentUtils::IsJavascriptMIMEType(mimeType)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Get the version string, and ensure the language supports it.
|
||||
nsAutoString versionName;
|
||||
rv = parser.GetParameter("version", versionName);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*aVersion = nsContentUtils::ParseJavascriptVersion(versionName);
|
||||
} else if (rv != NS_ERROR_INVALID_ARG) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsAutoString value;
|
||||
rv = parser.GetParameter("e4x", value);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if (value.Length() == 1 && value[0] == '1') {
|
||||
// This happens in about 2 web pages. Enable E4X no matter what JS
|
||||
// version number was selected. We do this by turning on the "moar
|
||||
// XML" version bit. This is OK even if version has
|
||||
// JSVERSION_UNKNOWN (-1).
|
||||
*aVersion = js::VersionSetMoarXML(*aVersion, true);
|
||||
}
|
||||
} else if (rv != NS_ERROR_INVALID_ARG) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
|
||||
{
|
||||
|
@ -437,38 +393,126 @@ nsScriptLoader::ProcessScriptElement(nsIScriptElement *aElement)
|
|||
return false;
|
||||
}
|
||||
|
||||
JSVersion version = JSVERSION_DEFAULT;
|
||||
PRUint32 typeID = nsIProgrammingLanguage::JAVASCRIPT;
|
||||
PRUint32 version = 0;
|
||||
nsAutoString language, type, src;
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// Check the type attribute to determine language and version.
|
||||
// If type exists, it trumps the deprecated 'language='
|
||||
nsAutoString type;
|
||||
aElement->GetScriptType(type);
|
||||
if (!type.IsEmpty()) {
|
||||
NS_ENSURE_TRUE(ParseTypeAttribute(type, &version), false);
|
||||
nsContentTypeParser parser(type);
|
||||
|
||||
nsAutoString mimeType;
|
||||
rv = parser.GetType(mimeType);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
|
||||
// Javascript keeps the fast path, optimized for most-likely type
|
||||
// Table ordered from most to least likely JS MIME types.
|
||||
// See bug 62485, feel free to add <script type="..."> survey data to it,
|
||||
// or to a new bug once 62485 is closed.
|
||||
static const char *jsTypes[] = {
|
||||
"text/javascript",
|
||||
"text/ecmascript",
|
||||
"application/javascript",
|
||||
"application/ecmascript",
|
||||
"application/x-javascript",
|
||||
nullptr
|
||||
};
|
||||
|
||||
bool isJavaScript = false;
|
||||
for (PRInt32 i = 0; jsTypes[i]; i++) {
|
||||
if (mimeType.LowerCaseEqualsASCII(jsTypes[i])) {
|
||||
isJavaScript = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isJavaScript) {
|
||||
typeID = nsIProgrammingLanguage::UNKNOWN;
|
||||
}
|
||||
|
||||
if (typeID != nsIProgrammingLanguage::UNKNOWN) {
|
||||
// Get the version string, and ensure the language supports it.
|
||||
nsAutoString versionName;
|
||||
rv = parser.GetParameter("version", versionName);
|
||||
if (NS_FAILED(rv)) {
|
||||
// no version attribute - version remains 0.
|
||||
if (rv != NS_ERROR_INVALID_ARG)
|
||||
return false;
|
||||
} else {
|
||||
nsCOMPtr<nsIScriptRuntime> runtime;
|
||||
rv = NS_GetJSRuntime(getter_AddRefs(runtime));
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_ERROR("Failed to locate the language with this ID");
|
||||
return false;
|
||||
}
|
||||
rv = runtime->ParseVersion(versionName, &version);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("This script language version is not supported - ignored");
|
||||
typeID = nsIProgrammingLanguage::UNKNOWN;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Some js specifics yet to be abstracted.
|
||||
if (typeID == nsIProgrammingLanguage::JAVASCRIPT) {
|
||||
nsAutoString value;
|
||||
rv = parser.GetParameter("e4x", value);
|
||||
if (NS_FAILED(rv)) {
|
||||
if (rv != NS_ERROR_INVALID_ARG)
|
||||
return false;
|
||||
} else {
|
||||
if (value.Length() == 1 && value[0] == '1')
|
||||
// This happens in about 2 web pages. Enable E4X no matter what JS
|
||||
// version number was selected. We do this by turning on the "moar
|
||||
// XML" version bit. This is OK even if version has
|
||||
// JSVERSION_UNKNOWN (-1).
|
||||
version = js::VersionSetMoarXML(JSVersion(version), true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// no 'type=' element
|
||||
// "language" is a deprecated attribute of HTML, so we check it only for
|
||||
// HTML script elements.
|
||||
if (scriptContent->IsHTML()) {
|
||||
nsAutoString language;
|
||||
scriptContent->GetAttr(kNameSpaceID_None, nsGkAtoms::language, language);
|
||||
if (!language.IsEmpty()) {
|
||||
if (nsContentUtils::IsJavaScriptLanguage(language, &version))
|
||||
typeID = nsIProgrammingLanguage::JAVASCRIPT;
|
||||
else
|
||||
typeID = nsIProgrammingLanguage::UNKNOWN;
|
||||
// IE, Opera, etc. do not respect language version, so neither should
|
||||
// we at this late date in the browser wars saga. Note that this change
|
||||
// affects HTML but not XUL or SVG (but note also that XUL has its own
|
||||
// code to check nsContentUtils::IsJavaScriptLanguage -- that's probably
|
||||
// a separate bug, one we may not be able to fix short of XUL2). See
|
||||
// bug 255895 (https://bugzilla.mozilla.org/show_bug.cgi?id=255895).
|
||||
PRUint32 dummy;
|
||||
if (!nsContentUtils::IsJavaScriptLanguage(language, &dummy)) {
|
||||
return false;
|
||||
}
|
||||
NS_ASSERTION(JSVERSION_DEFAULT == 0,
|
||||
"We rely on all languages having 0 as a version default");
|
||||
version = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If we don't know the language, we don't know how to evaluate
|
||||
if (typeID == nsIProgrammingLanguage::UNKNOWN) {
|
||||
return false;
|
||||
}
|
||||
// If not from a chrome document (which is always trusted), we need some way
|
||||
// of checking the language is "safe". Currently the only other language
|
||||
// impl is Python, and that is *not* safe in untrusted code - so fixing
|
||||
// this isn't a priority.!
|
||||
// See also similar code in nsXULContentSink.cpp
|
||||
if (typeID != nsIProgrammingLanguage::JAVASCRIPT &&
|
||||
!nsContentUtils::IsChromeDoc(mDocument)) {
|
||||
NS_WARNING("Untrusted language called from non-chrome - ignored");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Step 14. in the HTML5 spec
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
nsRefPtr<nsScriptLoadRequest> request;
|
||||
if (aElement->GetScriptExternal()) {
|
||||
// external script
|
||||
|
|
|
@ -1120,7 +1120,9 @@ nsTreeSanitizer::SanitizeStyleSheet(const nsAString& aOriginal,
|
|||
// -moz-binding is blacklisted.
|
||||
bool didSanitize = false;
|
||||
// Create a sheet to hold the parsed CSS
|
||||
nsRefPtr<nsCSSStyleSheet> sheet = new nsCSSStyleSheet();
|
||||
nsRefPtr<nsCSSStyleSheet> sheet;
|
||||
rv = NS_NewCSSStyleSheet(getter_AddRefs(sheet));
|
||||
NS_ENSURE_SUCCESS(rv, true);
|
||||
sheet->SetURIs(aDocument->GetDocumentURI(), nullptr, aBaseURI);
|
||||
sheet->SetPrincipal(aDocument->NodePrincipal());
|
||||
// Create the CSS parser, and parse the CSS text.
|
||||
|
|
|
@ -3175,21 +3175,15 @@ nsXMLHttpRequest::Send(nsIVariant* aVariant, const Nullable<RequestBody>& aBody)
|
|||
}
|
||||
|
||||
/* void setRequestHeader (in AUTF8String header, in AUTF8String value); */
|
||||
// http://dvcs.w3.org/hg/xhr/raw-file/tip/Overview.html#dom-xmlhttprequest-setrequestheader
|
||||
NS_IMETHODIMP
|
||||
nsXMLHttpRequest::SetRequestHeader(const nsACString& header,
|
||||
const nsACString& value)
|
||||
{
|
||||
// Step 1 and 2
|
||||
if (!(mState & XML_HTTP_REQUEST_OPENED)) {
|
||||
return NS_ERROR_DOM_INVALID_STATE_ERR;
|
||||
}
|
||||
NS_ASSERTION(mChannel, "mChannel must be valid if we're OPENED.");
|
||||
nsresult rv;
|
||||
|
||||
// Step 3
|
||||
// Make sure we don't store an invalid header name in mCORSUnsafeHeaders
|
||||
if (!IsValidHTTPToken(header)) { // XXX nsHttp::IsValidToken?
|
||||
return NS_ERROR_DOM_SYNTAX_ERR;
|
||||
if (!IsValidHTTPToken(header)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// Check that we haven't already opened the channel. We can't rely on
|
||||
|
@ -3197,7 +3191,7 @@ nsXMLHttpRequest::SetRequestHeader(const nsACString& header,
|
|||
// still be waiting for mCORSPreflightChannel to actually open mChannel
|
||||
if (mCORSPreflightChannel) {
|
||||
bool pending;
|
||||
nsresult rv = mCORSPreflightChannel->IsPending(&pending);
|
||||
rv = mCORSPreflightChannel->IsPending(&pending);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (pending) {
|
||||
|
@ -3205,10 +3199,13 @@ nsXMLHttpRequest::SetRequestHeader(const nsACString& header,
|
|||
}
|
||||
}
|
||||
|
||||
if (!(mState & XML_HTTP_REQUEST_OPENED))
|
||||
return NS_ERROR_IN_PROGRESS;
|
||||
|
||||
if (!mChannel) // open() initializes mChannel, and open()
|
||||
return NS_ERROR_FAILURE; // must be called before first setRequestHeader()
|
||||
|
||||
nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(mChannel);
|
||||
nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(mChannel));
|
||||
if (!httpChannel) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -3217,11 +3214,12 @@ nsXMLHttpRequest::SetRequestHeader(const nsACString& header,
|
|||
// the executing script has UniversalXPConnect.
|
||||
|
||||
bool privileged;
|
||||
if (NS_FAILED(IsCapabilityEnabled("UniversalXPConnect", &privileged)))
|
||||
rv = IsCapabilityEnabled("UniversalXPConnect", &privileged);
|
||||
if (NS_FAILED(rv))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (!privileged) {
|
||||
// Step 5: Check for dangerous headers.
|
||||
// Check for dangerous headers
|
||||
const char *kInvalidHeaders[] = {
|
||||
"accept-charset", "accept-encoding", "access-control-request-headers",
|
||||
"access-control-request-method", "connection", "content-length",
|
||||
|
@ -3266,10 +3264,7 @@ nsXMLHttpRequest::SetRequestHeader(const nsACString& header,
|
|||
}
|
||||
|
||||
// We need to set, not add to, the header.
|
||||
nsresult rv = httpChannel->SetRequestHeader(header, value, false);
|
||||
if (rv == NS_ERROR_INVALID_ARG) {
|
||||
return NS_ERROR_DOM_SYNTAX_ERR;
|
||||
}
|
||||
rv = httpChannel->SetRequestHeader(header, value, false);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// We'll want to duplicate this header for any replacement channels (eg. on redirect)
|
||||
RequestHeader reqHeader = {
|
||||
|
@ -3277,6 +3272,7 @@ nsXMLHttpRequest::SetRequestHeader(const nsACString& header,
|
|||
};
|
||||
mModifiedRequestHeaders.AppendElement(reqHeader);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -4015,6 +4011,7 @@ DOMCI_DATA(XMLHttpProgressEvent, nsXMLHttpProgressEvent)
|
|||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsXMLHttpProgressEvent)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMProgressEvent)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIDOMEvent, nsIDOMProgressEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNSEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMProgressEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMLSProgressEvent)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(XMLHttpProgressEvent)
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "nsTArray.h"
|
||||
#include "nsIJSNativeInitializer.h"
|
||||
#include "nsIDOMLSProgressEvent.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsITimer.h"
|
||||
#include "nsDOMProgressEvent.h"
|
||||
#include "nsDOMEventTargetHelper.h"
|
||||
|
@ -34,13 +35,13 @@
|
|||
#include "nsDOMBlobBuilder.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsIScriptObjectPrincipal.h"
|
||||
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/dom/TypedArray.h"
|
||||
#include "mozilla/dom/XMLHttpRequestBinding.h"
|
||||
#include "mozilla/dom/XMLHttpRequestUploadBinding.h"
|
||||
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/dom/TypedArray.h"
|
||||
|
||||
class nsILoadGroup;
|
||||
class AsyncVerifyRedirectCallbackForwarder;
|
||||
class nsIUnicodeDecoder;
|
||||
|
@ -709,7 +710,8 @@ protected:
|
|||
// helper class to expose a progress DOM Event
|
||||
|
||||
class nsXMLHttpProgressEvent : public nsIDOMProgressEvent,
|
||||
public nsIDOMLSProgressEvent
|
||||
public nsIDOMLSProgressEvent,
|
||||
public nsIDOMNSEvent
|
||||
{
|
||||
public:
|
||||
nsXMLHttpProgressEvent(nsIDOMProgressEvent* aInner,
|
||||
|
@ -719,8 +721,9 @@ public:
|
|||
virtual ~nsXMLHttpProgressEvent();
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsXMLHttpProgressEvent, nsIDOMProgressEvent)
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsXMLHttpProgressEvent, nsIDOMNSEvent)
|
||||
NS_FORWARD_NSIDOMEVENT(mInner->)
|
||||
NS_FORWARD_NSIDOMNSEVENT(mInner->)
|
||||
NS_FORWARD_NSIDOMPROGRESSEVENT(mInner->)
|
||||
NS_DECL_NSIDOMLSPROGRESSEVENT
|
||||
|
||||
|
|
|
@ -175,6 +175,7 @@ DOMCI_DATA(Event, nsDOMEvent)
|
|||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMEvent)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNSEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIJSNativeInitializer)
|
||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(Event)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
@ -535,7 +536,7 @@ NS_IMETHODIMP
|
|||
nsDOMEvent::InitEvent(const nsAString& aEventTypeArg, bool aCanBubbleArg, bool aCancelableArg)
|
||||
{
|
||||
// Make sure this event isn't already being dispatched.
|
||||
NS_ENSURE_TRUE(!NS_IS_EVENT_IN_DISPATCH(mEvent), NS_OK);
|
||||
NS_ENSURE_TRUE(!NS_IS_EVENT_IN_DISPATCH(mEvent), NS_ERROR_INVALID_ARG);
|
||||
|
||||
if (NS_IS_TRUSTED_EVENT(mEvent)) {
|
||||
// Ensure the caller is permitted to dispatch trusted DOM events.
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#define nsDOMEvent_h__
|
||||
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
|
@ -23,6 +24,7 @@ struct JSContext;
|
|||
struct JSObject;
|
||||
|
||||
class nsDOMEvent : public nsIDOMEvent,
|
||||
public nsIDOMNSEvent,
|
||||
public nsIJSNativeInitializer
|
||||
{
|
||||
public:
|
||||
|
@ -189,6 +191,9 @@ public:
|
|||
// nsIDOMEvent Interface
|
||||
NS_DECL_NSIDOMEVENT
|
||||
|
||||
// nsIDOMNSEvent Interface
|
||||
NS_DECL_NSIDOMNSEVENT
|
||||
|
||||
// nsIJSNativeInitializer
|
||||
NS_IMETHOD Initialize(nsISupports* aOwner, JSContext* aCx, JSObject* aObj,
|
||||
PRUint32 aArgc, jsval* aArgv);
|
||||
|
@ -246,12 +251,6 @@ protected:
|
|||
NS_IMETHOD InitEvent(const nsAString & eventTypeArg, bool canBubbleArg, bool cancelableArg) { return _to InitEvent(eventTypeArg, canBubbleArg, cancelableArg); } \
|
||||
NS_IMETHOD GetDefaultPrevented(bool *aDefaultPrevented) { return _to GetDefaultPrevented(aDefaultPrevented); } \
|
||||
NS_IMETHOD StopImmediatePropagation(void) { return _to StopImmediatePropagation(); } \
|
||||
NS_IMETHOD GetOriginalTarget(nsIDOMEventTarget** aOriginalTarget) { return _to GetOriginalTarget(aOriginalTarget); } \
|
||||
NS_IMETHOD GetExplicitOriginalTarget(nsIDOMEventTarget** aExplicitOriginalTarget) { return _to GetExplicitOriginalTarget(aExplicitOriginalTarget); } \
|
||||
NS_IMETHOD PreventBubble() { return _to PreventBubble(); } \
|
||||
NS_IMETHOD PreventCapture() { return _to PreventCapture(); } \
|
||||
NS_IMETHOD GetPreventDefault(bool* aRetval) { return _to GetPreventDefault(aRetval); } \
|
||||
NS_IMETHOD GetIsTrusted(bool* aIsTrusted) { return _to GetIsTrusted(aIsTrusted); } \
|
||||
NS_IMETHOD SetTarget(nsIDOMEventTarget *aTarget) { return _to SetTarget(aTarget); } \
|
||||
NS_IMETHOD_(bool) IsDispatchStopped(void) { return _to IsDispatchStopped(); } \
|
||||
NS_IMETHOD_(nsEvent *) GetInternalNSEvent(void) { return _to GetInternalNSEvent(); } \
|
||||
|
|
|
@ -29,6 +29,8 @@ public:
|
|||
NS_IMETHOD_(void) Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType);
|
||||
NS_IMETHOD_(bool) Deserialize(const IPC::Message* aMsg, void** aIter);
|
||||
|
||||
NS_FORWARD_NSIDOMNSEVENT(nsDOMEvent::)
|
||||
|
||||
virtual nsresult InitFromCtor(const nsAString& aType,
|
||||
JSContext* aCx, jsval* aVal);
|
||||
|
||||
|
|
|
@ -545,7 +545,7 @@ nsEventDispatcher::Dispatch(nsISupports* aTarget,
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// Make sure that nsIDOMEvent::target and nsIDOMEvent::originalTarget
|
||||
// Make sure that nsIDOMEvent::target and nsIDOMNSEvent::originalTarget
|
||||
// point to the last item in the chain.
|
||||
if (!aEvent->target) {
|
||||
// Note, CurrentTarget() points always to the object returned by
|
||||
|
@ -682,8 +682,10 @@ nsEventDispatcher::DispatchDOMEvent(nsISupports* aTarget,
|
|||
if (innerEvent->flags & NS_EVENT_DISPATCHED) {
|
||||
innerEvent->target = nullptr;
|
||||
innerEvent->originalTarget = nullptr;
|
||||
} else {
|
||||
aDOMEvent->GetIsTrusted(&dontResetTrusted);
|
||||
}
|
||||
else {
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aDOMEvent));
|
||||
nsevent->GetIsTrusted(&dontResetTrusted);
|
||||
}
|
||||
|
||||
if (!dontResetTrusted) {
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "nsDOMEvent.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsCaret.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsITextControlFrame.h"
|
||||
#include "nsGkAtoms.h"
|
||||
|
|
|
@ -2292,7 +2292,7 @@ nsEventStateManager::DetermineDragTarget(nsPresContext* aPresContext,
|
|||
*aTargetNode = nullptr;
|
||||
|
||||
nsCOMPtr<nsISupports> container = aPresContext->GetContainer();
|
||||
nsCOMPtr<nsPIDOMWindow> window = do_GetInterface(container);
|
||||
nsCOMPtr<nsIDOMWindow> window = do_GetInterface(container);
|
||||
if (!window)
|
||||
return;
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "nsPresContext.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsINode.h"
|
||||
#include "nsIFrame.h"
|
||||
|
@ -201,7 +202,8 @@ nsIMEStateManager::OnClickInEditor(nsPresContext* aPresContext,
|
|||
NS_ENSURE_TRUE(widget, );
|
||||
|
||||
bool isTrusted;
|
||||
nsresult rv = aMouseEvent->GetIsTrusted(&isTrusted);
|
||||
nsCOMPtr<nsIDOMNSEvent> NSEvent = do_QueryInterface(aMouseEvent);
|
||||
nsresult rv = NSEvent->GetIsTrusted(&isTrusted);
|
||||
NS_ENSURE_SUCCESS(rv, );
|
||||
if (!isTrusted) {
|
||||
return; // ignore untrusted event.
|
||||
|
|
|
@ -84,9 +84,8 @@ MOCHITEST_FILES = \
|
|||
test_bug741666.html \
|
||||
test_dom_keyboard_event.html \
|
||||
test_dom_mouse_event.html \
|
||||
test_bug603008.html \
|
||||
test_bug716822.html \
|
||||
test_bug742376.html \
|
||||
test_bug603008.html \
|
||||
$(NULL)
|
||||
|
||||
#bug 585630
|
||||
|
|
|
@ -53,7 +53,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=238987
|
|||
shouldStop = true;
|
||||
}
|
||||
} else if (e.target.id == "end") {
|
||||
modifier = Components.interfaces.nsIDOMEvent.SHIFT_MASK;
|
||||
modifier = Components.interfaces.nsIDOMNSEvent.SHIFT_MASK;
|
||||
} else if (modifier) {
|
||||
var expected = backwardFocusArray.pop();
|
||||
ok(expected == e.target.id,
|
||||
|
|
|
@ -19,8 +19,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=409604
|
|||
|
||||
/** Test for Bug 409604 **/
|
||||
|
||||
var modifier = Components.interfaces.nsIDOMEvent.ALT_MASK |
|
||||
Components.interfaces.nsIDOMEvent.SHIFT_MASK;
|
||||
var modifier = Components.interfaces.nsIDOMNSEvent.ALT_MASK |
|
||||
Components.interfaces.nsIDOMNSEvent.SHIFT_MASK;
|
||||
var expectedFocus = "a,c,d,e,f,g,h,i,j,k,l,m,n,p,x,y";
|
||||
// XXX the "map" test is causing trouble, see bug 433089
|
||||
var focusArray = expectedFocus.split(",");
|
||||
|
|
|
@ -81,7 +81,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=617528
|
|||
browser.removeEventListener("contextmenu", onContextMenu1, false);
|
||||
|
||||
browser.addEventListener("contextmenu", onContextMenu2, false);
|
||||
var shiftMask = Components.interfaces.nsIDOMEvent.SHIFT_MASK;
|
||||
var shiftMask = Components.interfaces.nsIDOMNSEvent.SHIFT_MASK;
|
||||
wu.sendMouseEvent("contextmenu", left, top, 2, 1, shiftMask);
|
||||
browser.removeEventListener("contextmenu", onContextMenu2, false);
|
||||
|
||||
|
|
|
@ -1,28 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=716822
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 716822</title>
|
||||
<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=716822">Mozilla Bug 716822</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
/** Test for Bug 716822 **/
|
||||
for (var p in window.NSEvent) {
|
||||
ok(p in window.Event, p + " should be in Event.");
|
||||
is(window.NSEvent[p], window.Event[p], "Value of " + p);
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -58,6 +58,7 @@
|
|||
#include "nsGkAtoms.h"
|
||||
#include "nsEventStateManager.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsDOMCSSDeclaration.h"
|
||||
#include "nsITextControlFrame.h"
|
||||
#include "nsIForm.h"
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "nsIFrame.h"
|
||||
#include "nsIFormControlFrame.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
|
|
|
@ -46,6 +46,7 @@
|
|||
#include "nsPresState.h"
|
||||
#include "nsLayoutErrors.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIDOMHTMLCollection.h"
|
||||
#include "nsLinebreakConverter.h" //to strip out carriage returns
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsXBLPrototypeHandler.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
|
@ -85,8 +86,10 @@ nsXBLKeyEventHandler::ExecuteMatchedHandlers(nsIDOMKeyEvent* aKeyEvent,
|
|||
PRUint32 aCharCode,
|
||||
bool aIgnoreShiftKey)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNSEvent> domNSEvent = do_QueryInterface(aKeyEvent);
|
||||
bool trustedEvent = false;
|
||||
aKeyEvent->GetIsTrusted(&trustedEvent);
|
||||
if (domNSEvent)
|
||||
domNSEvent->GetIsTrusted(&trustedEvent);
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> target;
|
||||
aKeyEvent->GetCurrentTarget(getter_AddRefs(target));
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "nsEventListenerManager.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsPIWindowRoot.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
|
@ -209,8 +210,11 @@ nsXBLPrototypeHandler::ExecuteHandler(nsIDOMEventTarget* aTarget,
|
|||
// XUL handlers and commands shouldn't be triggered by non-trusted
|
||||
// events.
|
||||
if (isXULKey || isXBLCommand) {
|
||||
nsCOMPtr<nsIDOMNSEvent> domNSEvent = do_QueryInterface(aEvent);
|
||||
bool trustedEvent = false;
|
||||
aEvent->GetIsTrusted(&trustedEvent);
|
||||
if (domNSEvent) {
|
||||
domNSEvent->GetIsTrusted(&trustedEvent);
|
||||
}
|
||||
|
||||
if (!trustedEvent)
|
||||
return NS_OK;
|
||||
|
@ -356,17 +360,20 @@ nsXBLPrototypeHandler::DispatchXBLCommand(nsIDOMEventTarget* aTarget, nsIDOMEven
|
|||
// This is a special-case optimization to make command handling fast.
|
||||
// It isn't really a part of XBL, but it helps speed things up.
|
||||
|
||||
// See if preventDefault has been set. If so, don't execute.
|
||||
bool preventDefault = false;
|
||||
nsCOMPtr<nsIDOMNSEvent> domNSEvent = do_QueryInterface(aEvent);
|
||||
if (domNSEvent) {
|
||||
domNSEvent->GetPreventDefault(&preventDefault);
|
||||
}
|
||||
|
||||
if (preventDefault)
|
||||
return NS_OK;
|
||||
|
||||
if (aEvent) {
|
||||
// See if preventDefault has been set. If so, don't execute.
|
||||
bool preventDefault = false;
|
||||
aEvent->GetPreventDefault(&preventDefault);
|
||||
if (preventDefault) {
|
||||
return NS_OK;
|
||||
}
|
||||
bool dispatchStopped = aEvent->IsDispatchStopped();
|
||||
if (dispatchStopped) {
|
||||
if (dispatchStopped)
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
||||
// Instead of executing JS, let's get the controller for the bound
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "nsIAtom.h"
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsXBLService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsGkAtoms.h"
|
||||
|
@ -279,14 +280,17 @@ DoCommandCallback(const char *aCommand, void *aData)
|
|||
nsresult
|
||||
nsXBLWindowKeyHandler::WalkHandlers(nsIDOMKeyEvent* aKeyEvent, nsIAtom* aEventType)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNSEvent> domNSEvent = do_QueryInterface(aKeyEvent);
|
||||
bool prevent;
|
||||
aKeyEvent->GetPreventDefault(&prevent);
|
||||
domNSEvent->GetPreventDefault(&prevent);
|
||||
if (prevent)
|
||||
return NS_OK;
|
||||
|
||||
bool trustedEvent = false;
|
||||
// Don't process the event if it was not dispatched from a trusted source
|
||||
aKeyEvent->GetIsTrusted(&trustedEvent);
|
||||
if (domNSEvent) {
|
||||
//Don't process the event if it was not dispatched from a trusted source
|
||||
domNSEvent->GetIsTrusted(&trustedEvent);
|
||||
}
|
||||
|
||||
if (!trustedEvent)
|
||||
return NS_OK;
|
||||
|
@ -299,7 +303,7 @@ nsXBLWindowKeyHandler::WalkHandlers(nsIDOMKeyEvent* aKeyEvent, nsIAtom* aEventTy
|
|||
if (!el) {
|
||||
if (mUserHandler) {
|
||||
WalkHandlersInternal(aKeyEvent, aEventType, mUserHandler);
|
||||
aKeyEvent->GetPreventDefault(&prevent);
|
||||
domNSEvent->GetPreventDefault(&prevent);
|
||||
if (prevent)
|
||||
return NS_OK; // Handled by the user bindings. Our work here is done.
|
||||
}
|
||||
|
|
|
@ -99,6 +99,7 @@
|
|||
#include "nsEventDispatcher.h"
|
||||
#include "mozAutoDocUpdate.h"
|
||||
#include "nsIDOMXULCommandEvent.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsCCUncollectableMarker.h"
|
||||
|
||||
namespace css = mozilla::css;
|
||||
|
@ -1135,18 +1136,19 @@ nsXULElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
|||
// pointed to by the command attribute. The new event's
|
||||
// sourceEvent will be the original command event that we're
|
||||
// handling.
|
||||
nsCOMPtr<nsIDOMEvent> domEvent = aVisitor.mDOMEvent;
|
||||
while (domEvent) {
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent =
|
||||
do_QueryInterface(aVisitor.mDOMEvent);
|
||||
while (nsevent) {
|
||||
nsCOMPtr<nsIDOMEventTarget> oTarget;
|
||||
domEvent->GetOriginalTarget(getter_AddRefs(oTarget));
|
||||
nsevent->GetOriginalTarget(getter_AddRefs(oTarget));
|
||||
NS_ENSURE_STATE(!SameCOMIdentity(oTarget, commandContent));
|
||||
nsCOMPtr<nsIDOMEvent> tmp;
|
||||
nsCOMPtr<nsIDOMXULCommandEvent> commandEvent =
|
||||
do_QueryInterface(domEvent);
|
||||
do_QueryInterface(nsevent);
|
||||
if (commandEvent) {
|
||||
commandEvent->GetSourceEvent(getter_AddRefs(domEvent));
|
||||
} else {
|
||||
domEvent = NULL;
|
||||
commandEvent->GetSourceEvent(getter_AddRefs(tmp));
|
||||
}
|
||||
nsevent = do_QueryInterface(tmp);
|
||||
}
|
||||
|
||||
nsInputEvent* orig =
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "nsIDOMXULDocument.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
|
@ -92,6 +93,12 @@ nsXULPopupListener::HandleEvent(nsIDOMEvent* aEvent)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// check if someone has attempted to prevent this action.
|
||||
nsCOMPtr<nsIDOMNSEvent> domNSEvent = do_QueryInterface(mouseEvent);
|
||||
if (!domNSEvent) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Get the node that was clicked on.
|
||||
nsCOMPtr<nsIDOMEventTarget> target;
|
||||
mouseEvent->GetTarget(getter_AddRefs(target));
|
||||
|
@ -116,7 +123,7 @@ nsXULPopupListener::HandleEvent(nsIDOMEvent* aEvent)
|
|||
}
|
||||
|
||||
bool preventDefault;
|
||||
mouseEvent->GetPreventDefault(&preventDefault);
|
||||
domNSEvent->GetPreventDefault(&preventDefault);
|
||||
if (preventDefault && targetNode && mIsContext) {
|
||||
// Someone called preventDefault on a context menu.
|
||||
// Let's make sure they are allowed to do so.
|
||||
|
@ -166,6 +173,8 @@ nsXULPopupListener::HandleEvent(nsIDOMEvent* aEvent)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent = do_QueryInterface(aEvent);
|
||||
|
||||
if (mIsContext) {
|
||||
#ifndef NS_CONTEXT_MENU_IS_MOUSEUP
|
||||
// If the context menu launches on mousedown,
|
||||
|
|
|
@ -865,7 +865,29 @@ XULContentSinkImpl::OpenScript(const PRUnichar** aAttributes,
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
if (nsContentUtils::IsJavascriptMIMEType(mimeType)) {
|
||||
// Javascript keeps the fast path, optimized for most-likely type
|
||||
// Table ordered from most to least likely JS MIME types. For .xul
|
||||
// files that we host, the likeliest type is application/x-javascript.
|
||||
// See bug 62485, feel free to add <script type="..."> survey data to it,
|
||||
// or to a new bug once 62485 is closed.
|
||||
static const char *jsTypes[] = {
|
||||
"application/x-javascript",
|
||||
"text/javascript",
|
||||
"text/ecmascript",
|
||||
"application/javascript",
|
||||
"application/ecmascript",
|
||||
nullptr
|
||||
};
|
||||
|
||||
bool isJavaScript = false;
|
||||
for (PRInt32 i = 0; jsTypes[i]; i++) {
|
||||
if (mimeType.LowerCaseEqualsASCII(jsTypes[i])) {
|
||||
isJavaScript = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (isJavaScript) {
|
||||
langID = nsIProgrammingLanguage::JAVASCRIPT;
|
||||
version = JSVERSION_LATEST;
|
||||
} else {
|
||||
|
@ -876,11 +898,20 @@ XULContentSinkImpl::OpenScript(const PRUnichar** aAttributes,
|
|||
// Get the version string, and ensure the language supports it.
|
||||
nsAutoString versionName;
|
||||
rv = parser.GetParameter("version", versionName);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
version = nsContentUtils::ParseJavascriptVersion(versionName);
|
||||
} else if (rv != NS_ERROR_INVALID_ARG) {
|
||||
return rv;
|
||||
if (NS_FAILED(rv)) {
|
||||
if (rv != NS_ERROR_INVALID_ARG)
|
||||
return rv;
|
||||
// no version specified - version remains the default.
|
||||
} else {
|
||||
nsCOMPtr<nsIScriptRuntime> runtime;
|
||||
rv = NS_GetJSRuntime(getter_AddRefs(runtime));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
rv = runtime->ParseVersion(versionName, &version);
|
||||
if (NS_FAILED(rv)) {
|
||||
NS_WARNING("This script language version is not supported - ignored");
|
||||
langID = nsIProgrammingLanguage::UNKNOWN;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Some js specifics yet to be abstracted.
|
||||
|
|
|
@ -951,9 +951,11 @@ NS_IMETHODIMP nsDocShell::GetInterface(const nsIID & aIID, void **aSink)
|
|||
}
|
||||
else if (aIID.Equals(NS_GET_IID(nsIDocument)) &&
|
||||
NS_SUCCEEDED(EnsureContentViewer())) {
|
||||
nsCOMPtr<nsIDocument> doc = mContentViewer->GetDocument();
|
||||
doc.forget(aSink);
|
||||
return *aSink ? NS_OK : NS_NOINTERFACE;
|
||||
nsCOMPtr<nsIDOMDocument> domDoc;
|
||||
mContentViewer->GetDOMDocument(getter_AddRefs(domDoc));
|
||||
if (!domDoc)
|
||||
return NS_NOINTERFACE;
|
||||
return domDoc->QueryInterface(aIID, aSink);
|
||||
}
|
||||
else if (aIID.Equals(NS_GET_IID(nsIApplicationCacheContainer))) {
|
||||
*aSink = nullptr;
|
||||
|
|
|
@ -193,9 +193,9 @@ let Activities = {
|
|||
debug(JSON.stringify(aResults));
|
||||
|
||||
// We have no matching activity registered, let's fire an error.
|
||||
if (aResults.options.length === 0) {
|
||||
if (aResults.length === 0) {
|
||||
ppmm.sendAsyncMessage("Activity:FireError", {
|
||||
"id": aMsg.id,
|
||||
"id": aMsg.id,
|
||||
"error": "NO_PROVIDER"
|
||||
});
|
||||
return;
|
||||
|
@ -207,7 +207,7 @@ let Activities = {
|
|||
// The user has cancelled the choice, fire an error.
|
||||
if (aChoice === -1) {
|
||||
ppmm.sendAsyncMessage("Activity:FireError", {
|
||||
"id": aMsg.id,
|
||||
"id": aMsg.id,
|
||||
"error": "USER_ABORT"
|
||||
});
|
||||
return;
|
||||
|
|
|
@ -64,6 +64,7 @@
|
|||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMXMLDocument.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
@ -2374,6 +2375,7 @@ nsDOMClassInfo::RegisterExternalClasses()
|
|||
|
||||
#define DOM_CLASSINFO_EVENT_MAP_ENTRIES \
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMEvent) \
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEvent) \
|
||||
|
||||
#define DOM_CLASSINFO_UI_EVENT_MAP_ENTRIES \
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMUIEvent) \
|
||||
|
@ -6394,6 +6396,14 @@ nsDOMConstructor::ResolveInterfaceConstants(JSContext *cx, JSObject *obj)
|
|||
nsresult rv = DefineInterfaceConstants(cx, obj, class_iid);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Special case for |Event|, Event needs constants from NSEvent
|
||||
// too for backwards compatibility.
|
||||
if (class_iid->Equals(NS_GET_IID(nsIDOMEvent))) {
|
||||
rv = DefineInterfaceConstants(cx, obj,
|
||||
&NS_GET_IID(nsIDOMNSEvent));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
// Special case for |IDBKeyRange| which gets funny "static" functions.
|
||||
if (class_iid->Equals(NS_GET_IID(nsIIDBKeyRange)) &&
|
||||
!indexedDB::IDBKeyRange::DefineConstructors(cx, obj)) {
|
||||
|
@ -6538,6 +6548,14 @@ ResolvePrototype(nsIXPConnect *aXPConnect, nsGlobalWindow *aWin, JSContext *cx,
|
|||
rv = DefineInterfaceConstants(cx, class_obj, primary_iid);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Special case for |Event|, Event needs constants from NSEvent
|
||||
// too for backwards compatibility.
|
||||
if (primary_iid->Equals(NS_GET_IID(nsIDOMEvent))) {
|
||||
rv = DefineInterfaceConstants(cx, class_obj,
|
||||
&NS_GET_IID(nsIDOMNSEvent));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
// Special case for |IDBKeyRange| which gets funny "static" functions.
|
||||
if (primary_iid->Equals(NS_GET_IID(nsIIDBKeyRange)) &&
|
||||
!indexedDB::IDBKeyRange::DefineConstructors(cx, class_obj)) {
|
||||
|
@ -7369,12 +7387,17 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
|||
}
|
||||
|
||||
if (sDocument_id == id) {
|
||||
nsCOMPtr<nsIDocument> document = win->GetDoc();
|
||||
JS::Value v;
|
||||
nsCOMPtr<nsIDOMDocument> document;
|
||||
rv = win->GetDocument(getter_AddRefs(document));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// FIXME Ideally we'd have an nsIDocument here and get nsWrapperCache
|
||||
// from it.
|
||||
jsval v;
|
||||
nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
|
||||
rv = WrapNative(cx, JS_GetGlobalForScopeChain(cx), document, document,
|
||||
&NS_GET_IID(nsIDOMDocument), &v, getter_AddRefs(holder),
|
||||
false);
|
||||
rv = WrapNative(cx, JS_GetGlobalForScopeChain(cx), document,
|
||||
&NS_GET_IID(nsIDOMDocument), false, &v,
|
||||
getter_AddRefs(holder));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// The PostCreate hook for the document will handle defining the
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "nsPresContext.h"
|
||||
#include "nsDOMClassInfoID.h"
|
||||
#include "nsDOMError.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsDOMWindowUtils.h"
|
||||
#include "nsQueryContentEventResult.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
|
|
|
@ -2830,23 +2830,25 @@ nsGlobalWindow::GetPrincipal()
|
|||
// nsGlobalWindow::nsIDOMWindow
|
||||
//*****************************************************************************
|
||||
|
||||
void
|
||||
nsPIDOMWindow::MaybeCreateDoc()
|
||||
{
|
||||
MOZ_ASSERT(!mDoc);
|
||||
if (nsIDocShell* docShell = GetDocShell()) {
|
||||
// Note that |document| here is the same thing as our mDocument, but we
|
||||
// don't have to explicitly set the member variable because the docshell
|
||||
// has already called SetNewDocument().
|
||||
nsCOMPtr<nsIDocument> document = do_GetInterface(docShell);
|
||||
}
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsGlobalWindow::GetDocument(nsIDOMDocument** aDocument)
|
||||
{
|
||||
nsCOMPtr<nsIDOMDocument> document = do_QueryInterface(GetDoc());
|
||||
document.forget(aDocument);
|
||||
// This method *should* forward calls to the outer window, but since
|
||||
// there's nothing here that *depends* on anything in the outer
|
||||
// (GetDocShell() eliminates that dependency), we won't do that to
|
||||
// avoid the extra virtual function call.
|
||||
|
||||
// lazily instantiate an about:blank document if necessary, and if
|
||||
// we have what it takes to do so. Note that domdoc here is the same
|
||||
// thing as our mDocument, but we don't have to explicitly set the
|
||||
// member variable because the docshell has already called
|
||||
// SetNewDocument().
|
||||
nsIDocShell *docShell;
|
||||
if (!mDocument && (docShell = GetDocShell()))
|
||||
nsCOMPtr<nsIDOMDocument> domdoc(do_GetInterface(docShell));
|
||||
|
||||
NS_IF_ADDREF(*aDocument = mDocument);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@
|
|||
#include "nsIScriptContext.h"
|
||||
|
||||
#define NS_ISCRIPTRUNTIME_IID \
|
||||
{ 0xfa30d7a8, 0x7f0a, 0x437a, \
|
||||
{ 0xa1, 0x0c, 0xc2, 0xbe, 0xa3, 0xdb, 0x4f, 0x4b } }
|
||||
{ 0xb146580f, 0x55f7, 0x4d97, \
|
||||
{ 0x8a, 0xbb, 0x4a, 0x50, 0xb0, 0xa8, 0x04, 0x97 } }
|
||||
|
||||
/**
|
||||
* A singleton language environment for an application. Responsible for
|
||||
|
@ -21,6 +21,13 @@ class nsIScriptRuntime : public nsISupports
|
|||
public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISCRIPTRUNTIME_IID)
|
||||
|
||||
/* Parses a "version string" for the language into a bit-mask used by
|
||||
* the language implementation. If the specified version is not supported
|
||||
* an error should be returned. If the specified version is blank, a default
|
||||
* version should be assumed
|
||||
*/
|
||||
virtual nsresult ParseVersion(const nsString &aVersionStr, PRUint32 *verFlags) = 0;
|
||||
|
||||
/* Factory for a new context for this language */
|
||||
virtual already_AddRefed<nsIScriptContext> CreateContext() = 0;
|
||||
|
||||
|
|
|
@ -3658,6 +3658,29 @@ nsJSRuntime::CreateContext()
|
|||
return scriptContext.forget();
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsJSRuntime::ParseVersion(const nsString &aVersionStr, PRUint32 *flags)
|
||||
{
|
||||
NS_PRECONDITION(flags, "Null flags param?");
|
||||
JSVersion jsVersion = JSVERSION_UNKNOWN;
|
||||
if (aVersionStr.Length() != 3 || aVersionStr[0] != '1' || aVersionStr[1] != '.')
|
||||
jsVersion = JSVERSION_UNKNOWN;
|
||||
else switch (aVersionStr[2]) {
|
||||
case '0': jsVersion = JSVERSION_1_0; break;
|
||||
case '1': jsVersion = JSVERSION_1_1; break;
|
||||
case '2': jsVersion = JSVERSION_1_2; break;
|
||||
case '3': jsVersion = JSVERSION_1_3; break;
|
||||
case '4': jsVersion = JSVERSION_1_4; break;
|
||||
case '5': jsVersion = JSVERSION_1_5; break;
|
||||
case '6': jsVersion = JSVERSION_1_6; break;
|
||||
case '7': jsVersion = JSVERSION_1_7; break;
|
||||
case '8': jsVersion = JSVERSION_1_8; break;
|
||||
default: jsVersion = JSVERSION_UNKNOWN;
|
||||
}
|
||||
*flags = (PRUint32)jsVersion;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//static
|
||||
void
|
||||
nsJSRuntime::Startup()
|
||||
|
|
|
@ -317,6 +317,8 @@ public:
|
|||
|
||||
virtual already_AddRefed<nsIScriptContext> CreateContext();
|
||||
|
||||
virtual nsresult ParseVersion(const nsString &aVersionStr, PRUint32 *flags);
|
||||
|
||||
virtual nsresult DropScriptObject(void *object);
|
||||
virtual nsresult HoldScriptObject(void *object);
|
||||
|
||||
|
|
|
@ -172,20 +172,6 @@ public:
|
|||
return mDoc;
|
||||
}
|
||||
|
||||
nsIDocument* GetDoc()
|
||||
{
|
||||
if (!mDoc) {
|
||||
MaybeCreateDoc();
|
||||
}
|
||||
return mDoc;
|
||||
}
|
||||
|
||||
protected:
|
||||
// Lazily instantiate an about:blank document if necessary, and if
|
||||
// we have what it takes to do so.
|
||||
void MaybeCreateDoc();
|
||||
|
||||
public:
|
||||
// Internal getter/setter for the frame element, this version of the
|
||||
// getter crosses chrome boundaries whereas the public scriptable
|
||||
// one doesn't for security reasons.
|
||||
|
|
|
@ -403,7 +403,13 @@ QueryInterface(JSContext* cx, unsigned argc, JS::Value* vp)
|
|||
JSBool
|
||||
ThrowingConstructor(JSContext* cx, unsigned argc, JS::Value* vp)
|
||||
{
|
||||
return ThrowErrorMessage(cx, MSG_ILLEGAL_CONSTRUCTOR);
|
||||
return Throw<true>(cx, NS_ERROR_FAILURE);
|
||||
}
|
||||
|
||||
JSBool
|
||||
ThrowingConstructorWorkers(JSContext* cx, unsigned argc, JS::Value* vp)
|
||||
{
|
||||
return Throw<false>(cx, NS_ERROR_FAILURE);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
@ -690,6 +690,8 @@ JSBool
|
|||
QueryInterface(JSContext* cx, unsigned argc, JS::Value* vp);
|
||||
JSBool
|
||||
ThrowingConstructor(JSContext* cx, unsigned argc, JS::Value* vp);
|
||||
JSBool
|
||||
ThrowingConstructorWorkers(JSContext* cx, unsigned argc, JS::Value* vp);
|
||||
|
||||
template<class T>
|
||||
class NonNull
|
||||
|
|
|
@ -1118,7 +1118,7 @@ class CGCreateInterfaceObjectsMethod(CGAbstractMethod):
|
|||
constructHook = CONSTRUCT_HOOK_NAME
|
||||
constructArgs = methodLength(self.descriptor.interface.ctor())
|
||||
else:
|
||||
constructHook = "ThrowingConstructor"
|
||||
constructHook = "ThrowingConstructorWorkers" if self.descriptor.workers else "ThrowingConstructor"
|
||||
constructArgs = 0
|
||||
|
||||
call = CGGeneric(("return dom::CreateInterfaceObjects(aCx, aGlobal, aReceiver, parentProto,\n"
|
||||
|
@ -1213,27 +1213,24 @@ def CheckPref(descriptor, globalName, varName, retval, wrapperCache = None):
|
|||
"""
|
||||
if not descriptor.prefable:
|
||||
return ""
|
||||
|
||||
if wrapperCache:
|
||||
wrapperCache = " %s->ClearIsDOMBinding();\n" % (wrapperCache)
|
||||
else:
|
||||
wrapperCache = ""
|
||||
|
||||
failureCode = (" %s = false;\n" +
|
||||
" return %s;") % (varName, retval)
|
||||
return """
|
||||
{
|
||||
XPCWrappedNativeScope* scope =
|
||||
XPCWrappedNativeScope::FindInJSObjectScope(aCx, %s);
|
||||
if (!scope) {
|
||||
%s
|
||||
return %s;
|
||||
}
|
||||
|
||||
if (!scope->ExperimentalBindingsEnabled()) {
|
||||
%s%s
|
||||
%s %s = false;
|
||||
return %s;
|
||||
}
|
||||
}
|
||||
""" % (globalName, failureCode, wrapperCache, failureCode)
|
||||
""" % (globalName, retval, wrapperCache, varName, retval)
|
||||
|
||||
class CGDefineDOMInterfaceMethod(CGAbstractMethod):
|
||||
"""
|
||||
|
|
|
@ -24,4 +24,3 @@ MSG_DEF(MSG_MISSING_ARGUMENTS, 1, "Not enough arguments to {0}.")
|
|||
MSG_DEF(MSG_NOT_OBJECT, 0, "Value not an object.")
|
||||
MSG_DEF(MSG_DOES_NOT_IMPLEMENT_INTERFACE, 1, "Value does not implement interface {0}.")
|
||||
MSG_DEF(MSG_NOT_IN_UNION, 1, "Value could not be converted to any of: {0}.")
|
||||
MSG_DEF(MSG_ILLEGAL_CONSTRUCTOR, 0, "Illegal constructor.")
|
||||
|
|
|
@ -62,16 +62,15 @@ EXPORTS_mozilla = \
|
|||
$(NULL)
|
||||
|
||||
EXPORTS_$(binding_include_path) = \
|
||||
BindingUtils.h \
|
||||
DOMJSClass.h \
|
||||
Errors.msg \
|
||||
Nullable.h \
|
||||
PrimitiveConversions.h \
|
||||
PrototypeList.h \
|
||||
RegisterBindings.h \
|
||||
Nullable.h \
|
||||
TypedArray.h \
|
||||
UnionConversions.h \
|
||||
BindingUtils.h \
|
||||
UnionTypes.h \
|
||||
UnionConversions.h \
|
||||
$(exported_binding_headers) \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -49,8 +49,7 @@ bindinggen_dependencies := \
|
|||
$(GLOBAL_DEPS) \
|
||||
$(NULL)
|
||||
|
||||
MOCHITEST_FILES := \
|
||||
test_bug773326.html \
|
||||
MOCHITEST_FILES = \
|
||||
test_enums.html \
|
||||
test_integers.html \
|
||||
test_interfaceToString.html \
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
<title>Test for Bug 773326</title>
|
||||
<script src=/resources/testharness.js></script>
|
||||
<script src=/resources/testharnessreport.js></script>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
test(function() {
|
||||
new Worker("data:text/javascript,new XMLHttpRequest(42)");
|
||||
}, "Should not crash")
|
||||
</script>
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
interface nsIDOMBluetoothDevice;
|
||||
|
||||
[scriptable, builtinclass, uuid(819b4683-23a9-4af9-96b9-2c40a14ecb0b)]
|
||||
[scriptable, builtinclass, uuid(49294da3-b698-4a7f-aca2-3f9bc44c7625)]
|
||||
interface nsIDOMBluetoothDeviceEvent : nsIDOMEvent
|
||||
{
|
||||
readonly attribute nsIDOMBluetoothDevice device;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include "nsIDOMEvent.idl"
|
||||
|
||||
[scriptable, builtinclass, uuid(5927bb1f-e8eb-4b40-ae20-cd02f34412ce)]
|
||||
[scriptable, builtinclass, uuid(2604ce78-abaa-4af4-b456-daa4c6386a11)]
|
||||
interface nsIDOMBluetoothPropertyEvent : nsIDOMEvent
|
||||
{
|
||||
readonly attribute DOMString property;
|
||||
|
|
|
@ -13,7 +13,6 @@ DIRS = \
|
|||
failures/editing/selecttest \
|
||||
failures/html/tests/submission/Opera/microdata \
|
||||
failures/webapps/DOMCore/tests/approved \
|
||||
failures/webapps/DOMCore/tests/submissions/Ms2ger \
|
||||
failures/webapps/DOMCore/tests/submissions/Opera \
|
||||
failures/webapps/WebStorage/tests/submissions/Infraware \
|
||||
failures/webapps/WebStorage/tests/submissions/Ms2ger \
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,43 +0,0 @@
|
|||
# THIS FILE IS AUTOGENERATED BY parseFailures.py - DO NOT EDIT
|
||||
|
||||
DEPTH = ../../../../../../../..
|
||||
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
relativesrcdir = dom/imptests/failures/webapps/DOMCore/tests/submissions/Ms2ger
|
||||
|
||||
DIRS = \
|
||||
$(NULL)
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_FILES = \
|
||||
test_DOMImplementation-createDocument.html.json \
|
||||
test_Document-createElementNS.html.json \
|
||||
test_Document-getElementsByTagName.html.json \
|
||||
test_Element-children.html.json \
|
||||
test_Event-constructors.html.json \
|
||||
test_Event-defaultPrevented.html.json \
|
||||
test_EventTarget-dispatchEvent.html.json \
|
||||
test_Node-appendChild.html.json \
|
||||
test_Node-constants.html.json \
|
||||
test_Node-insertBefore.html.json \
|
||||
test_Node-isEqualNode.xhtml.json \
|
||||
test_Node-removeChild.html.json \
|
||||
test_Node-replaceChild.html.json \
|
||||
test_NodeFilter-constants.html.json \
|
||||
test_Range-attributes.html.json \
|
||||
test_Range-commonAncestorContainer.html.json \
|
||||
test_Range-comparePoint.html.json \
|
||||
test_Range-detach.html.json \
|
||||
test_Range-intersectsNode.html.json \
|
||||
test_attributes.html.json \
|
||||
test_case.html.json \
|
||||
test_historical.html.json \
|
||||
test_interfaces.html.json \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_FILES)
|
||||
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
|
|
@ -1,11 +0,0 @@
|
|||
{
|
||||
"DOMImplementation.createDocument(namespaceURI, qualifiedName, doctype) 16": true,
|
||||
"DOMImplementation.createDocument(namespaceURI, qualifiedName, doctype) 31": true,
|
||||
"DOMImplementation.createDocument(namespaceURI, qualifiedName, doctype) 46": true,
|
||||
"DOMImplementation.createDocument(namespaceURI, qualifiedName, doctype) 61": true,
|
||||
"DOMImplementation.createDocument(namespaceURI, qualifiedName, doctype) 76": true,
|
||||
"DOMImplementation.createDocument(namespaceURI, qualifiedName, doctype) 92": true,
|
||||
"DOMImplementation.createDocument(namespaceURI, qualifiedName, doctype) 93": true,
|
||||
"DOMImplementation.createDocument(namespaceURI, qualifiedName, doctype) 95": true,
|
||||
"DOMImplementation.createDocument(namespaceURI, qualifiedName, doctype) 97": true
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"Invalid Name: \u0300foo": true
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
{
|
||||
"Document.getElementsByTagName 2": true,
|
||||
"Document.getElementsByTagName 3": true
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"HTMLCollection edge cases 1": true
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"Event constructors": true
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"initEvent should unset defaultPrevented.": true
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"If the event's dispatch flag is set, an InvalidStateError must be thrown.": true
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"Node.appendChild": true
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
{
|
||||
"Constants for createDocumentPosition on [object DOM Constructor.prototype].": true,
|
||||
"Constants for nodeType on [object DOM Constructor.prototype].": true
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"Calling insertBefore with a non-Node first argument must throw TypeError.": true,
|
||||
"Calling insertBefore with a non-Node first argument on a leaf node Comment node <!--Foo--> must throw TypeError.": true,
|
||||
"Calling insertBefore with a non-Node first argument on a leaf node DocumentType node must throw TypeError.": true,
|
||||
"Calling insertBefore with a non-Node first argument on a leaf node ProcessingInstruction node with target \"foo\" and data \"bar\" must throw TypeError.": true,
|
||||
"Calling insertBefore with a non-Node first argument on a leaf node Text node \"Foo\" must throw TypeError.": true
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"isEqualNode should return true when only the internal subsets of DocumentTypes differ.": true
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"Passing a value that is not a Node reference to removeChild should throw TypeError.": true
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
{
|
||||
"If the context node is not a node that can contain children, a NotFoundError exception should be thrown": true,
|
||||
"Passing null to replaceChild should throw a TypeError.": true
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
{
|
||||
"Constants for acceptNode on undefined.": true,
|
||||
"Constants for whatToShow on undefined.": true
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"Range attributes": true
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"Detached Range": true
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
{
|
||||
"Range.comparePoint": true,
|
||||
"Range.comparePoint 1": true
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"Range.detach": true
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"Range.intersectsNode": true,
|
||||
"Range.intersectsNode 1": true,
|
||||
"Range.intersectsNode 2": true
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"AttrExodus": true,
|
||||
"First set attribute is returned by setAttribute": true,
|
||||
"First set attribute is returned with mapped attribute set first": true,
|
||||
"setAttribute should throw a NAMESPACE_ERR when qualifiedName starts with 'xmlns'": true
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"getElementsByTagName ABC": true,
|
||||
"getElementsByTagName Abc": true,
|
||||
"getElementsByTagName abc": true,
|
||||
"getElementsByTagName \u00c4": true,
|
||||
"getElementsByTagName \u00e4": true
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
{
|
||||
"DocumentType member must be nuked: internalSubset": true,
|
||||
"Historical DOM features must be removed: CDATASection": true,
|
||||
"Historical DOM features must be removed: NamedNodeMap": true,
|
||||
"Historical DOM features must be removed: UserDataHandler": true,
|
||||
"Historical DOM features must be removed: createAttribute": true,
|
||||
"Historical DOM features must be removed: createAttributeNS": true,
|
||||
"Historical DOM features must be removed: createCDATASection": true,
|
||||
"Historical DOM features must be removed: getAttributeNode": true,
|
||||
"Historical DOM features must be removed: getAttributeNodeNS": true,
|
||||
"Historical DOM features must be removed: inputEncoding": true,
|
||||
"Historical DOM features must be removed: removeAttributeNode": true,
|
||||
"Historical DOM features must be removed: setAttributeNode": true,
|
||||
"Node member must be nuked: getUserData": true,
|
||||
"Node member must be nuked: hasAttributes": true,
|
||||
"Node member must be nuked: isSupported": true,
|
||||
"Node member must be nuked: setUserData": true
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
{
|
||||
"Should be able to delete CharacterData.": true,
|
||||
"Should be able to delete Document.": true,
|
||||
"Should be able to delete Node.": true,
|
||||
"Should be able to delete NodeFilter.": true
|
||||
}
|
|
@ -12,6 +12,7 @@ include $(DEPTH)/config/autoconf.mk
|
|||
|
||||
MOCHITEST_FILES = \
|
||||
test_interfaces.html.json \
|
||||
test_setrequestheader-invalid-arguments.htm.json \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
{
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 1": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 2": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 3": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 4": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 5": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 6": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 7": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 8": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 9": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 10": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 11": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 12": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 13": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 14": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 15": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 16": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 17": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 18": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 19": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 20": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 21": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 22": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 23": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 24": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 25": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 26": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 27": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 28": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 29": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 30": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 31": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 32": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 33": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 34": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 35": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 36": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 37": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 38": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 39": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 40": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 41": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 42": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 43": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 44": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 45": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 46": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 47": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 48": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 49": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 50": true,
|
||||
"XMLHttpRequest: setRequestHeader() with invalid arguments 51": true
|
||||
}
|
|
@ -779,11 +779,11 @@ IdlException.prototype.test_members = function()
|
|||
assert_throws(new TypeError(), function()
|
||||
{
|
||||
window[this.name].prototype[member.name];
|
||||
}.bind(this), "getting property on prototype object must throw TypeError");
|
||||
}, "getting property on prototype object must throw TypeError");
|
||||
assert_throws(new TypeError(), function()
|
||||
{
|
||||
desc.get.call({});
|
||||
}.bind(this), "calling getter on wrong object type must throw TypeError");
|
||||
}, "calling getter on wrong object type must throw TypeError");
|
||||
}.bind(this), this.name + " exception: field " + member.name + " on exception interface prototype object");
|
||||
}
|
||||
}
|
||||
|
@ -946,11 +946,11 @@ IdlInterface.prototype.test_self = function()
|
|||
assert_throws(new TypeError(), function()
|
||||
{
|
||||
window[this.name]();
|
||||
}.bind(this), "interface object didn't throw TypeError when called as a function");
|
||||
}, "interface object didn't throw TypeError when called as a function");
|
||||
assert_throws(new TypeError(), function()
|
||||
{
|
||||
new window[this.name]();
|
||||
}.bind(this), "interface object didn't throw TypeError when called as a constructor");
|
||||
}, "interface object didn't throw TypeError when called as a constructor");
|
||||
}
|
||||
}.bind(this), this.name + " interface: existence and properties of interface object");
|
||||
|
||||
|
@ -1367,7 +1367,7 @@ IdlInterface.prototype.test_interface_of = function(desc, obj, exception, expect
|
|||
assert_throws(new TypeError(), function()
|
||||
{
|
||||
obj[member.name].apply(obj, args);
|
||||
}.bind(this), "Called with " + i + " arguments");
|
||||
}, "Called with " + i + " arguments");
|
||||
|
||||
args.push(create_suitable_object(member.arguments[i].type));
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ tr.notrun > td:first-child {
|
|||
color:blue;
|
||||
}
|
||||
|
||||
.pass > td:first-child, .fail > td:first-child, .timeout > td:first-child, .notrun > td:first-child {
|
||||
.pass .fail .timeout .notrun > td:first-child {
|
||||
font-variant:small-caps;
|
||||
}
|
||||
|
||||
|
|
|
@ -290,14 +290,6 @@ policies and contribution forms [3].
|
|||
* asserts if called. Used to ensure that some codepath is *not* taken e.g.
|
||||
* an event does not fire.
|
||||
*
|
||||
* assert_any(assert_func, actual, expected_array, extra_arg_1, ... extra_arg_N)
|
||||
* asserts that one assert_func(actual, expected_array_N, extra_arg1, ..., extra_arg_N)
|
||||
* is true for some expected_array_N in expected_array. This only works for assert_func
|
||||
* with signature assert_func(actual, expected, args_1, ..., args_N). Note that tests
|
||||
* with multiple allowed pass conditions are bad practice unless the spec specifically
|
||||
* allows multiple behaviours. Test authors should not use this method simply to hide
|
||||
* UA bugs.
|
||||
*
|
||||
* assert_exists(object, property_name, description)
|
||||
* *** deprecated ***
|
||||
* asserts that object has an own property property_name
|
||||
|
@ -450,7 +442,6 @@ policies and contribution forms [3].
|
|||
switch (typeof val)
|
||||
{
|
||||
case "string":
|
||||
val = val.replace("\\", "\\\\");
|
||||
for (var i = 0; i < 32; i++)
|
||||
{
|
||||
var replace = "\\";
|
||||
|
@ -593,13 +584,6 @@ policies and contribution forms [3].
|
|||
* Test if two primitives are equal or two objects
|
||||
* are the same object
|
||||
*/
|
||||
if (typeof actual != typeof expected)
|
||||
{
|
||||
assert(false, "assert_equals", description,
|
||||
"expected (" + typeof expected + ") ${expected} but got (" + typeof actual + ") ${actual}",
|
||||
{expected:expected, actual:actual});
|
||||
return;
|
||||
}
|
||||
assert(same_value(actual, expected), "assert_equals", description,
|
||||
"expected ${expected} but got ${actual}",
|
||||
{expected:expected, actual:actual});
|
||||
|
@ -905,27 +889,6 @@ policies and contribution forms [3].
|
|||
}
|
||||
expose(assert_unreached, "assert_unreached");
|
||||
|
||||
function assert_any(assert_func, actual, expected_array)
|
||||
{
|
||||
var args = [].slice.call(arguments, 3)
|
||||
var errors = []
|
||||
var passed = false;
|
||||
forEach(expected_array,
|
||||
function(expected)
|
||||
{
|
||||
try {
|
||||
assert_func.apply(this, [actual, expected].concat(args))
|
||||
passed = true;
|
||||
} catch(e) {
|
||||
errors.push(e.message);
|
||||
}
|
||||
});
|
||||
if (!passed) {
|
||||
throw new AssertionError(errors.join("\n\n"));
|
||||
}
|
||||
}
|
||||
expose(assert_any, "assert_any");
|
||||
|
||||
function Test(name, properties)
|
||||
{
|
||||
this.name = name;
|
||||
|
@ -1017,23 +980,6 @@ policies and contribution forms [3].
|
|||
};
|
||||
};
|
||||
|
||||
Test.prototype.step_func_done = function(func, this_obj)
|
||||
{
|
||||
var test_this = this;
|
||||
|
||||
if (arguments.length === 1)
|
||||
{
|
||||
this_obj = test_this;
|
||||
}
|
||||
|
||||
return function()
|
||||
{
|
||||
test_this.step.apply(test_this, [func, this_obj].concat(
|
||||
Array.prototype.slice.call(arguments)));
|
||||
test_this.done();
|
||||
};
|
||||
};
|
||||
|
||||
Test.prototype.set_timeout = function()
|
||||
{
|
||||
var this_obj = this;
|
||||
|
@ -1574,7 +1520,7 @@ policies and contribution forms [3].
|
|||
return '';
|
||||
}
|
||||
|
||||
log.appendChild(document.createElementNS(xhtml_ns, "section"));
|
||||
log.appendChild(document.createElement("section"));
|
||||
var assertions = has_assertions();
|
||||
var html = "<h2>Details</h2><table id='results' " + (assertions ? "class='assertions'" : "" ) + ">"
|
||||
+ "<thead><tr><th>Result</th><th>Test Name</th>"
|
||||
|
@ -1918,4 +1864,4 @@ policies and contribution forms [3].
|
|||
}
|
||||
|
||||
})();
|
||||
// vim: set expandtab shiftwidth=4 tabstop=4:
|
||||
// vim: set expandtab shiftwidth=4 tabstop=4:
|
|
@ -1,6 +1,5 @@
|
|||
DIRS += \
|
||||
webapps/DOMCore/tests/approved \
|
||||
webapps/DOMCore/tests/submissions/Ms2ger \
|
||||
webapps/DOMCore/tests/submissions/Opera \
|
||||
webapps/WebStorage/tests/submissions \
|
||||
webapps/XMLHttpRequest/tests/submissions/Ms2ger \
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
https://dvcs.w3.org/hg/webapps|webapps
|
||||
DOMCore/tests/approved
|
||||
DOMCore/tests/submissions/Ms2ger
|
||||
DOMCore/tests/submissions/Opera
|
||||
WebStorage/tests/submissions
|
||||
XMLHttpRequest/tests/submissions/Ms2ger
|
||||
|
|
|
@ -1,39 +0,0 @@
|
|||
test(function() {
|
||||
var invalid = [
|
||||
["A", "?>"],
|
||||
["\u00B7A", "x"],
|
||||
["\u00D7A", "x"],
|
||||
["A\u00D7", "x"],
|
||||
["\\A", "x"],
|
||||
["\f", "x"],
|
||||
[0, "x"],
|
||||
["0", "x"]
|
||||
],
|
||||
valid = [
|
||||
["xml:fail", "x"],
|
||||
["A\u00B7A", "x"],
|
||||
["a0", "x"]
|
||||
]
|
||||
|
||||
for (var i = 0, il = invalid.length; i < il; i++) {
|
||||
test(function() {
|
||||
assert_throws("INVALID_CHARACTER_ERR", function() {
|
||||
document.createProcessingInstruction(invalid[i][0], invalid[i][1])
|
||||
})
|
||||
}, "Should throw an INVALID_CHARACTER_ERR for target " +
|
||||
format_value(invalid[i][0]) + " and data " +
|
||||
format_value(invalid[i][1]) + ".")
|
||||
}
|
||||
for (var i = 0, il = valid.length; i < il; ++i) {
|
||||
test(function() {
|
||||
var pi = document.createProcessingInstruction(valid[i][0], valid[i][1]);
|
||||
assert_equals(pi.target, valid[i][0]);
|
||||
assert_equals(pi.data, valid[i][1]);
|
||||
assert_equals(pi.ownerDocument, document);
|
||||
assert_true(pi instanceof ProcessingInstruction);
|
||||
assert_true(pi instanceof Node);
|
||||
}, "Should get a ProcessingInstruction for target " +
|
||||
format_value(valid[i][0]) + " and data " +
|
||||
format_value(valid[i][1]) + ".")
|
||||
}
|
||||
})
|
|
@ -1,115 +0,0 @@
|
|||
# THIS FILE IS AUTOGENERATED BY importTestsuite.py - DO NOT EDIT
|
||||
|
||||
DEPTH = ../../../../../../..
|
||||
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
relativesrcdir = dom/imptests/webapps/DOMCore/tests/submissions/Ms2ger
|
||||
|
||||
DIRS = \
|
||||
$(NULL)
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_FILES = \
|
||||
test_attributes.html \
|
||||
test_case.html \
|
||||
test_CharacterData-appendData.html \
|
||||
test_CharacterData-deleteData.html \
|
||||
test_CharacterData-insertData.html \
|
||||
test_CharacterData-replaceData.html \
|
||||
test_Document-adoptNode.html \
|
||||
test_Document-createComment.html \
|
||||
test_Document-createElement.html \
|
||||
test_Document-createElementNS.html \
|
||||
test_Document-createEvent.html \
|
||||
test_Document-createProcessingInstruction.html \
|
||||
test_Document-createProcessingInstruction-literal-1.xhtml \
|
||||
test_Document-createProcessingInstruction-literal-2.xhtml \
|
||||
test_Document-createProcessingInstruction.xhtml \
|
||||
test_Document-getElementById.html \
|
||||
test_Document-getElementsByTagName.html \
|
||||
test_Document-getElementsByTagNameNS.html \
|
||||
test_Document-importNode.html \
|
||||
test_DOMException-constants.html \
|
||||
test_DOMImplementation-createDocument.html \
|
||||
test_DOMImplementation-createDocumentType.html \
|
||||
test_DOMImplementation-createHTMLDocument.html \
|
||||
test_DOMImplementation-hasFeature.html \
|
||||
test_Element-childElementCount-dynamic-add.html \
|
||||
test_Element-childElementCount-dynamic-add.svg \
|
||||
test_Element-childElementCount-dynamic-add.xhtml \
|
||||
test_Element-childElementCount-dynamic-remove.html \
|
||||
test_Element-childElementCount-dynamic-remove.svg \
|
||||
test_Element-childElementCount-dynamic-remove.xhtml \
|
||||
test_Element-childElementCount.html \
|
||||
test_Element-childElementCount-nochild.html \
|
||||
test_Element-childElementCount-nochild.svg \
|
||||
test_Element-childElementCount-nochild.xhtml \
|
||||
test_Element-childElementCount.svg \
|
||||
test_Element-childElementCount.xhtml \
|
||||
test_Element-childElement-null.html \
|
||||
test_Element-childElement-null.svg \
|
||||
test_Element-childElement-null.xhtml \
|
||||
test_Element-children.html \
|
||||
test_Element-firstElementChild-entity.svg \
|
||||
test_Element-firstElementChild-entity.xhtml \
|
||||
test_Element-firstElementChild.html \
|
||||
test_Element-firstElementChild-namespace.html \
|
||||
test_Element-firstElementChild-namespace.svg \
|
||||
test_Element-firstElementChild-namespace.xhtml \
|
||||
test_Element-firstElementChild.svg \
|
||||
test_Element-firstElementChild.xhtml \
|
||||
test_Element-getElementsByClassName.html \
|
||||
test_Element-lastElementChild.html \
|
||||
test_Element-lastElementChild.svg \
|
||||
test_Element-lastElementChild.xhtml \
|
||||
test_Element-nextElementSibling.html \
|
||||
test_Element-nextElementSibling.svg \
|
||||
test_Element-nextElementSibling.xhtml \
|
||||
test_Element-previousElementSibling.html \
|
||||
test_Element-previousElementSibling.svg \
|
||||
test_Element-previousElementSibling.xhtml \
|
||||
test_Element-removeAttributeNS.html \
|
||||
test_Element-siblingElement-null.html \
|
||||
test_Element-siblingElement-null.svg \
|
||||
test_Element-siblingElement-null.xhtml \
|
||||
test_Element-tagName.html \
|
||||
test_Event-constants.html \
|
||||
test_Event-constructors.html \
|
||||
test_Event-defaultPrevented.html \
|
||||
test_Event-initEvent.html \
|
||||
test_EventTarget-dispatchEvent.html \
|
||||
test_historical.html \
|
||||
test_interfaces.html \
|
||||
test_Node-appendChild.html \
|
||||
test_Node-cloneNode.html \
|
||||
test_Node-constants.html \
|
||||
test_Node-insertBefore.html \
|
||||
test_Node-isEqualNode.xhtml \
|
||||
test_Node-lookupPrefix.xhtml \
|
||||
test_Node-nodeName.html \
|
||||
test_Node-nodeName.xhtml \
|
||||
test_Node-normalize.html \
|
||||
test_Node-parentElement.html \
|
||||
test_Node-parentNode.html \
|
||||
test_Node-removeChild.html \
|
||||
test_Node-replaceChild.html \
|
||||
test_NodeFilter-constants.html \
|
||||
test_Range-attributes.html \
|
||||
test_Range-commonAncestorContainer.html \
|
||||
test_Range-comparePoint.html \
|
||||
test_Range-detach.html \
|
||||
test_Range-intersectsNode.html \
|
||||
attributes.js \
|
||||
case.js \
|
||||
creators.js \
|
||||
constants.js \
|
||||
Document-createProcessingInstruction.js \
|
||||
productions.js \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_FILES)
|
||||
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
|
|
@ -1,14 +0,0 @@
|
|||
function attr_is(attr, v, ln, ns, p, n) {
|
||||
assert_equals(attr.value, v)
|
||||
assert_equals(attr.localName, ln)
|
||||
assert_equals(attr.namespaceURI, ns)
|
||||
assert_equals(attr.prefix, p)
|
||||
assert_equals(attr.name, n)
|
||||
}
|
||||
|
||||
function attributes_are(el, l) {
|
||||
for (var i = 0, il = l.length; i < il; i++) {
|
||||
attr_is(el.attributes[i], l[i][1], l[i][0], (l[i].length < 3) ? null : l[i][2], null, l[i][0])
|
||||
// assert_equals(el.attributes[i].ownerElement, el)
|
||||
}
|
||||
}
|
|
@ -1,178 +0,0 @@
|
|||
/*
|
||||
* document.createElement(NS)
|
||||
*
|
||||
* document.getElementsByTagName(NS)
|
||||
*
|
||||
* Element.setAttribute(NS)
|
||||
*
|
||||
* Element.getAttribute(NS)
|
||||
* Element.hasAttribute(NS)
|
||||
* Element.getElementsByTagName(NS)
|
||||
*/
|
||||
|
||||
var tests = [];
|
||||
setup(function() {
|
||||
var name_inputs = ["abc", "Abc", "ABC", "ä", "Ä"];
|
||||
var namespaces = ["http://www.w3.org/1999/xhtml", "http://www.w3.org/2000/svg", "http://FOO"];
|
||||
name_inputs.forEach(function(x) {
|
||||
tests.push(["createElement " + x, test_create_element, [x]]);
|
||||
tests.push(["setAttribute " +x, test_set_attribute, [x]]);
|
||||
tests.push(["getAttribute " +x, test_get_attribute, [x]]);
|
||||
tests.push(["getElementsByTagName " +x, test_get_elements_tag_name,
|
||||
[outer_product(namespaces, ["a"], name_inputs),
|
||||
x]]);
|
||||
});
|
||||
outer_product(namespaces, name_inputs, name_inputs).forEach(function(x) {
|
||||
tests.push(["createElementNS " + x, test_create_element_ns, x]);
|
||||
tests.push(["setAttributeNS " + x, test_set_attribute_ns, x]);
|
||||
tests.push(["getAttributeNS " + x, test_get_attribute_ns, x]);
|
||||
});
|
||||
outer_product([null].concat(namespaces), name_inputs).forEach(function(x) {
|
||||
tests.push(["getElementsByTagNameNS " + x, test_get_elements_tag_name_ns,
|
||||
outer_product(namespaces, name_inputs), x]);
|
||||
});
|
||||
name_inputs.forEach(function(x) {
|
||||
tests.push(["createElementNS " + x, test_create_element_ns, [null, null, x]]);
|
||||
tests.push(["setAttributeNS " + x, test_set_attribute_ns, [null, null, x]]);
|
||||
tests.push(["getAttributeNS " + x, test_get_attribute_ns, [null, null, x]]);
|
||||
});
|
||||
|
||||
});
|
||||
function outer_product() {
|
||||
var rv = [];
|
||||
function compute_outer_product() {
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
var index = args[0];
|
||||
if (index < args.length) {
|
||||
args[index].forEach(function(x) {
|
||||
compute_outer_product.apply(this, [index+1].concat(args.slice(1, index), x, args.slice(index+1)));
|
||||
});
|
||||
} else {
|
||||
rv.push(args.slice(1));
|
||||
}
|
||||
}
|
||||
compute_outer_product.apply(this, [1].concat(Array.prototype.slice.call(arguments)));
|
||||
return rv;
|
||||
}
|
||||
|
||||
function expected_case(input) {
|
||||
//is_html gets set by a global on the page loading the tests
|
||||
if (is_html) {
|
||||
return ascii_lowercase(input);
|
||||
} else {
|
||||
return input;
|
||||
}
|
||||
}
|
||||
|
||||
function ascii_lowercase(input) {
|
||||
return input.replace(/[A-Z]/g, function(x) {
|
||||
return x.toLowerCase();
|
||||
});
|
||||
}
|
||||
|
||||
function test_create_element(name) {
|
||||
var node = document.createElement(name);
|
||||
assert_equals(node.localName, expected_case(name));
|
||||
}
|
||||
|
||||
function test_create_element_ns(namespace, prefix, local_name) {
|
||||
var qualified_name = prefix ? prefix + ":" + local_name : local_name;
|
||||
var node = document.createElementNS(namespace, qualified_name);
|
||||
assert_equals(node.prefix, prefix, "prefix");
|
||||
assert_equals(node.localName, local_name, "localName");
|
||||
}
|
||||
|
||||
function test_set_attribute(name) {
|
||||
var node = document.createElement("div");
|
||||
node.setAttribute(name, "test");
|
||||
assert_equals(node.attributes[0].localName, expected_case(name));
|
||||
}
|
||||
|
||||
function test_set_attribute_ns(namespace, prefix, local_name) {
|
||||
var qualified_name = prefix ? prefix + ":" + local_name : local_name;
|
||||
var node = document.createElement("div");
|
||||
node.setAttributeNS(namespace, qualified_name, "test");
|
||||
var attr = node.attributes[0];
|
||||
assert_equals(attr.prefix, prefix, "prefix");
|
||||
assert_equals(attr.localName, local_name, "localName");
|
||||
}
|
||||
|
||||
function test_get_attribute(name) {
|
||||
var node = document.createElement("div");
|
||||
node.setAttribute(name, "test");
|
||||
var expected_name = expected_case(name);
|
||||
assert_equals(node.getAttribute(expected_name), "test");
|
||||
if (expected_name != name) {
|
||||
assert_equals(node.getAttribute(expected_name), "test");
|
||||
} else if (name !== ascii_lowercase(name)) {
|
||||
assert_equals(node.getAttribute(ascii_lowercase(name)), null);
|
||||
}
|
||||
}
|
||||
|
||||
function test_get_attribute_ns(namespace, prefix, local_name) {
|
||||
var qualified_name = prefix ? prefix + ":" + local_name : local_name;
|
||||
var node = document.createElement("div");
|
||||
node.setAttributeNS(namespace, qualified_name, "test");
|
||||
var expected_name = local_name;
|
||||
assert_equals(node.getAttributeNS(namespace, expected_name), "test");
|
||||
if (local_name !== ascii_lowercase(local_name)) {
|
||||
assert_equals(node.getAttributeNS(namespace, ascii_lowercase(local_name)), null);
|
||||
}
|
||||
}
|
||||
|
||||
function test_get_elements_tag_name(elements_to_create, search_string) {
|
||||
var container = document.createElement("div");
|
||||
elements_to_create.forEach(function(x) {
|
||||
var qualified_name = x[1] ? x[1] + ":" + x[2] : x[2];
|
||||
var element = document.createElementNS(x[0], qualified_name);
|
||||
container.appendChild(element);
|
||||
});
|
||||
var expected = Array.prototype.filter.call(container.childNodes,
|
||||
function(node) {
|
||||
if (is_html && node.namespaceURI === "http://www.w3.org/1999/xhtml") {
|
||||
return expected_case(node.localName) === expected_case(search_string);
|
||||
} else {
|
||||
return node.localName === expected_case(search_string);
|
||||
}
|
||||
});
|
||||
document.documentElement.appendChild(container);
|
||||
try {
|
||||
assert_array_equals(document.getElementsByTagName(search_string), expected);
|
||||
} catch(e) {
|
||||
throw e;
|
||||
} finally {
|
||||
document.documentElement.removeChild(container);
|
||||
}
|
||||
}
|
||||
|
||||
function test_get_elements_tag_name_ns(elements_to_create, search_input) {
|
||||
var search_uri = search_input[0];
|
||||
var search_name = search_input[1];
|
||||
var container = document.createElement("div");
|
||||
elements_to_create.forEach(function(x) {
|
||||
var qualified_name = x[1] ? x[1] + ":" + x[2] : x[2];
|
||||
var element = document.createElementNS(x[0], qualified_name);
|
||||
container.appendChild(element);
|
||||
});
|
||||
var expected = Array.prototype.filter.call(container.childNodes,
|
||||
function(node) {
|
||||
return node.namespaceURI === search_uri;
|
||||
return node.localName === search_name;
|
||||
});
|
||||
document.documentElement.appendChild(container);
|
||||
try {
|
||||
assert_array_equals(document.getElementsByTagNameNS(search_uri, search_name), expected);
|
||||
} catch(e) {
|
||||
throw e;
|
||||
} finally {
|
||||
document.documentElement.removeChild(container);
|
||||
}
|
||||
}
|
||||
|
||||
function test_func() {
|
||||
var func = arguments[0];
|
||||
var rest = arguments[1];
|
||||
func.apply(this, rest);
|
||||
}
|
||||
|
||||
generate_tests(test_func, tests);
|
|
@ -1,10 +0,0 @@
|
|||
function testConstants(objects, constants, msg) {
|
||||
objects.forEach(function(o) {
|
||||
test(function() {
|
||||
constants.forEach(function(d) {
|
||||
assert_true(d[0] in o, "Object " + o + " doesn't have " + d[0])
|
||||
assert_equals(o[d[0]], d[1], "Object " + o + " value for " + d[0] + " is wrong")
|
||||
})
|
||||
}, "Constants for " + msg + " on " + o + ".")
|
||||
})
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
var creators = {
|
||||
"element": "createElement",
|
||||
"text": "createTextNode",
|
||||
"comment": "createComment"
|
||||
};
|
|
@ -1,3 +0,0 @@
|
|||
var invalid_names = ["\\", "'", '"', "0", "0:a"] // XXX
|
||||
var valid_names = ["x", ":", "a:0"]
|
||||
var invalid_qnames = [":a", "b:", "x:y:z"] // XXX
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче