зеркало из https://github.com/mozilla/gecko-dev.git
Backing out bf0a78471e5e:dc7022e2d807 for inexplicable windows crashes.
This commit is contained in:
Родитель
69966a9faf
Коммит
77ca860259
|
@ -119,13 +119,13 @@ ProgressMeterAccessible<Max>::Value(nsString& aValue)
|
||||||
|
|
||||||
double maxValue = 0;
|
double maxValue = 0;
|
||||||
nsresult rv = GetMaximumValue(&maxValue);
|
nsresult rv = GetMaximumValue(&maxValue);
|
||||||
if (NS_FAILED(rv) || maxValue == 0)
|
NS_ENSURE_SUCCESS(rv, );
|
||||||
|
if (maxValue == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
double curValue = 0;
|
double curValue = 0;
|
||||||
GetCurrentValue(&curValue);
|
GetCurrentValue(&curValue);
|
||||||
if (NS_FAILED(rv))
|
NS_ENSURE_SUCCESS(rv, );
|
||||||
return;
|
|
||||||
|
|
||||||
// Treat the current value bigger than maximum as 100%.
|
// Treat the current value bigger than maximum as 100%.
|
||||||
double percentValue = (curValue < maxValue) ?
|
double percentValue = (curValue < maxValue) ?
|
||||||
|
|
|
@ -243,7 +243,8 @@ nsHTMLImageAccessible::GetLongDescURI() const
|
||||||
nsDocAccessible* document = Document();
|
nsDocAccessible* document = Document();
|
||||||
if (document) {
|
if (document) {
|
||||||
IDRefsIterator iter(document, mContent, nsGkAtoms::aria_describedby);
|
IDRefsIterator iter(document, mContent, nsGkAtoms::aria_describedby);
|
||||||
while (nsIContent* target = iter.NextElem()) {
|
nsIContent* target = nsnull;
|
||||||
|
while (target = iter.NextElem()) {
|
||||||
if ((target->IsHTML(nsGkAtoms::a) || target->IsHTML(nsGkAtoms::area)) &&
|
if ((target->IsHTML(nsGkAtoms::a) || target->IsHTML(nsGkAtoms::area)) &&
|
||||||
target->HasAttr(kNameSpaceID_None, nsGkAtoms::href)) {
|
target->HasAttr(kNameSpaceID_None, nsGkAtoms::href)) {
|
||||||
nsGenericHTMLElement* element =
|
nsGenericHTMLElement* element =
|
||||||
|
|
|
@ -363,7 +363,10 @@ JSContext *
|
||||||
nsScriptSecurityManager::GetSafeJSContext()
|
nsScriptSecurityManager::GetSafeJSContext()
|
||||||
{
|
{
|
||||||
// Get JSContext from stack.
|
// Get JSContext from stack.
|
||||||
return sJSContextStack->GetSafeJSContext();
|
JSContext *cx;
|
||||||
|
if (NS_FAILED(sJSContextStack->GetSafeJSContext(&cx)))
|
||||||
|
return nsnull;
|
||||||
|
return cx;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
|
|
|
@ -88,9 +88,9 @@ namespace dom {
|
||||||
class Link;
|
class Link;
|
||||||
|
|
||||||
// IID for the dom::Element interface
|
// IID for the dom::Element interface
|
||||||
#define NS_ELEMENT_IID \
|
#define NS_ELEMENT_IID \
|
||||||
{ 0xab6554b0, 0xb675, 0x45a7, \
|
{ 0xa1588efb, 0x5a84, 0x49cd, \
|
||||||
{ 0xac, 0x23, 0x44, 0x1c, 0x94, 0x5f, 0x3b, 0xee } }
|
{ 0x99, 0x1a, 0xac, 0x84, 0x9d, 0x92, 0x05, 0x0f } }
|
||||||
|
|
||||||
class Element : public nsIContent
|
class Element : public nsIContent
|
||||||
{
|
{
|
||||||
|
@ -171,53 +171,6 @@ public:
|
||||||
*/
|
*/
|
||||||
void ClearStyleStateLocks();
|
void ClearStyleStateLocks();
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the inline style rule, if any, for this element.
|
|
||||||
*/
|
|
||||||
virtual css::StyleRule* GetInlineStyleRule() = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the inline style rule for this element. This will send an appropriate
|
|
||||||
* AttributeChanged notification if aNotify is true.
|
|
||||||
*/
|
|
||||||
virtual nsresult SetInlineStyleRule(css::StyleRule* aStyleRule,
|
|
||||||
const nsAString* aSerialized,
|
|
||||||
bool aNotify) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the SMIL override style rule for this element. If the rule hasn't been
|
|
||||||
* created, this method simply returns null.
|
|
||||||
*/
|
|
||||||
virtual css::StyleRule* GetSMILOverrideStyleRule() = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the SMIL override style rule for this element. If aNotify is true, this
|
|
||||||
* method will notify the document's pres context, so that the style changes
|
|
||||||
* will be noticed.
|
|
||||||
*/
|
|
||||||
virtual nsresult SetSMILOverrideStyleRule(css::StyleRule* aStyleRule,
|
|
||||||
bool aNotify) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a new nsISMILAttr that allows the caller to animate the given
|
|
||||||
* attribute on this element.
|
|
||||||
*
|
|
||||||
* The CALLER OWNS the result and is responsible for deleting it.
|
|
||||||
*/
|
|
||||||
virtual nsISMILAttr* GetAnimatedAttr(PRInt32 aNamespaceID, nsIAtom* aName) = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the SMIL override style for this element. This is a style declaration
|
|
||||||
* that is applied *after* the inline style, and it can be used e.g. to store
|
|
||||||
* animated style values.
|
|
||||||
*
|
|
||||||
* Note: This method is analogous to the 'GetStyle' method in
|
|
||||||
* nsGenericHTMLElement and nsStyledElement.
|
|
||||||
*
|
|
||||||
* TODO: Bug 744157 - All callers QI to nsICSSDeclaration.
|
|
||||||
*/
|
|
||||||
virtual nsIDOMCSSStyleDeclaration* GetSMILOverrideStyle() = 0;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* Method to get the _intrinsic_ content state of this element. This is the
|
* Method to get the _intrinsic_ content state of this element. This is the
|
||||||
|
|
|
@ -395,6 +395,9 @@ public:
|
||||||
|
|
||||||
static PRUint32 CopyNewlineNormalizedUnicodeTo(nsReadingIterator<PRUnichar>& aSrcStart, const nsReadingIterator<PRUnichar>& aSrcEnd, nsAString& aDest);
|
static PRUint32 CopyNewlineNormalizedUnicodeTo(nsReadingIterator<PRUnichar>& aSrcStart, const nsReadingIterator<PRUnichar>& aSrcEnd, nsAString& aDest);
|
||||||
|
|
||||||
|
static nsISupports *
|
||||||
|
GetClassInfoInstance(nsDOMClassInfoID aID);
|
||||||
|
|
||||||
static const nsDependentSubstring TrimCharsInSet(const char* aSet,
|
static const nsDependentSubstring TrimCharsInSet(const char* aSet,
|
||||||
const nsAString& aValue);
|
const nsAString& aValue);
|
||||||
|
|
||||||
|
|
|
@ -77,8 +77,8 @@ enum nsLinkState {
|
||||||
|
|
||||||
// IID for the nsIContent interface
|
// IID for the nsIContent interface
|
||||||
#define NS_ICONTENT_IID \
|
#define NS_ICONTENT_IID \
|
||||||
{ 0xa887c108, 0xc25e, 0x42ab, \
|
{ 0x94671671, 0x9e1b, 0x447a, \
|
||||||
{ 0x87, 0xef, 0xad, 0x4b, 0xee, 0x50, 0x28, 0x28 } }
|
{ 0xad, 0xb7, 0xc3, 0x2e, 0x05, 0x6a, 0x96, 0xc9 } }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A node of content in a document's content model. This interface
|
* A node of content in a document's content model. This interface
|
||||||
|
@ -793,6 +793,22 @@ public:
|
||||||
*/
|
*/
|
||||||
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker) = 0;
|
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the inline style rule, if any, for this content node
|
||||||
|
*/
|
||||||
|
virtual mozilla::css::StyleRule* GetInlineStyleRule() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the inline style rule for this node. This will send an
|
||||||
|
* appropriate AttributeChanged notification if aNotify is true. If
|
||||||
|
* a serialized form of aStyleRule is available, a pointer to it
|
||||||
|
* should be passed in aSerialized. Otherwise, aSerialized should
|
||||||
|
* be null.
|
||||||
|
*/
|
||||||
|
NS_IMETHOD SetInlineStyleRule(mozilla::css::StyleRule* aStyleRule,
|
||||||
|
const nsAString* aSerialized,
|
||||||
|
bool aNotify) = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is the attribute named stored in the mapped attributes?
|
* Is the attribute named stored in the mapped attributes?
|
||||||
*
|
*
|
||||||
|
@ -859,6 +875,39 @@ public:
|
||||||
mPrimaryFrame = aFrame;
|
mPrimaryFrame = aFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Returns a new nsISMILAttr that allows the caller to animate the given
|
||||||
|
* attribute on this element.
|
||||||
|
*
|
||||||
|
* The CALLER OWNS the result and is responsible for deleting it.
|
||||||
|
*/
|
||||||
|
virtual nsISMILAttr* GetAnimatedAttr(PRInt32 aNamespaceID, nsIAtom* aName) = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the SMIL override style for this content node. This is a style
|
||||||
|
* declaration that is applied *after* the inline style, and it can be used
|
||||||
|
* e.g. to store animated style values.
|
||||||
|
*
|
||||||
|
* Note: This method is analogous to the 'GetStyle' method in
|
||||||
|
* nsGenericHTMLElement and nsStyledElement.
|
||||||
|
*/
|
||||||
|
virtual nsIDOMCSSStyleDeclaration* GetSMILOverrideStyle() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the SMIL override style rule for this content node. If the rule
|
||||||
|
* hasn't been created (or if this nsIContent object doesn't support SMIL
|
||||||
|
* override style), this method simply returns null.
|
||||||
|
*/
|
||||||
|
virtual mozilla::css::StyleRule* GetSMILOverrideStyleRule() = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the SMIL override style rule for this node. If aNotify is true, this
|
||||||
|
* method will notify the document's pres context, so that the style changes
|
||||||
|
* will be noticed.
|
||||||
|
*/
|
||||||
|
virtual nsresult SetSMILOverrideStyleRule(mozilla::css::StyleRule* aStyleRule,
|
||||||
|
bool aNotify) = 0;
|
||||||
|
|
||||||
nsresult LookupNamespaceURIInternal(const nsAString& aNamespacePrefix,
|
nsresult LookupNamespaceURIInternal(const nsAString& aNamespacePrefix,
|
||||||
nsAString& aNamespaceURI) const;
|
nsAString& aNamespaceURI) const;
|
||||||
|
|
||||||
|
|
|
@ -1623,7 +1623,8 @@ nsContentUtils::TraceSafeJSContext(JSTracer* aTrc)
|
||||||
if (!sThreadJSContextStack) {
|
if (!sThreadJSContextStack) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
JSContext* cx = sThreadJSContextStack->GetSafeJSContext();
|
JSContext* cx = nsnull;
|
||||||
|
sThreadJSContextStack->GetSafeJSContext(&cx);
|
||||||
if (!cx) {
|
if (!cx) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,6 @@ public:
|
||||||
PRUint32 argc, jsval* argv);
|
PRUint32 argc, jsval* argv);
|
||||||
|
|
||||||
// nsICharsetDetectionObserver
|
// nsICharsetDetectionObserver
|
||||||
using mozilla::dom::FileIOObject::Notify;
|
|
||||||
NS_IMETHOD Notify(const char *aCharset, nsDetectionConfident aConf);
|
NS_IMETHOD Notify(const char *aCharset, nsDetectionConfident aConf);
|
||||||
|
|
||||||
// FileIOObject overrides
|
// FileIOObject overrides
|
||||||
|
|
|
@ -3845,7 +3845,7 @@ nsDocument::SetScriptGlobalObject(nsIScriptGlobalObject *aScriptGlobalObject)
|
||||||
if (!cx) {
|
if (!cx) {
|
||||||
nsContentUtils::ThreadJSContextStack()->Peek(&cx);
|
nsContentUtils::ThreadJSContextStack()->Peek(&cx);
|
||||||
if (!cx) {
|
if (!cx) {
|
||||||
cx = nsContentUtils::ThreadJSContextStack()->GetSafeJSContext();
|
nsContentUtils::ThreadJSContextStack()->GetSafeJSContext(&cx);
|
||||||
NS_ASSERTION(cx, "Uhoh, no context, this is bad!");
|
NS_ASSERTION(cx, "Uhoh, no context, this is bad!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6054,7 +6054,7 @@ GetContextAndScope(nsIDocument* aOldDocument, nsIDocument* aNewDocument,
|
||||||
stack->Peek(&cx);
|
stack->Peek(&cx);
|
||||||
|
|
||||||
if (!cx) {
|
if (!cx) {
|
||||||
cx = stack->GetSafeJSContext();
|
stack->GetSafeJSContext(&cx);
|
||||||
|
|
||||||
if (!cx) {
|
if (!cx) {
|
||||||
// No safe context reachable, bail.
|
// No safe context reachable, bail.
|
||||||
|
@ -6469,33 +6469,36 @@ nsDocument::IsScriptEnabled()
|
||||||
return enabled;
|
return enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRadioGroupStruct*
|
nsresult
|
||||||
nsDocument::GetRadioGroup(const nsAString& aName)
|
nsDocument::GetRadioGroup(const nsAString& aName,
|
||||||
|
nsRadioGroupStruct **aRadioGroup)
|
||||||
{
|
{
|
||||||
nsAutoString tmKey(aName);
|
nsAutoString tmKey(aName);
|
||||||
if (IsHTML()) {
|
if(IsHTML())
|
||||||
ToLowerCase(tmKey); //should case-insensitive.
|
ToLowerCase(tmKey); //should case-insensitive.
|
||||||
}
|
if (mRadioGroups.Get(tmKey, aRadioGroup))
|
||||||
|
return NS_OK;
|
||||||
|
|
||||||
nsRadioGroupStruct* radioGroup;
|
nsAutoPtr<nsRadioGroupStruct> radioGroup(new nsRadioGroupStruct());
|
||||||
if (mRadioGroups.Get(tmKey, &radioGroup)) {
|
NS_ENSURE_TRUE(radioGroup, NS_ERROR_OUT_OF_MEMORY);
|
||||||
return radioGroup;
|
NS_ENSURE_TRUE(mRadioGroups.Put(tmKey, radioGroup), NS_ERROR_OUT_OF_MEMORY);
|
||||||
}
|
|
||||||
|
|
||||||
nsAutoPtr<nsRadioGroupStruct> newRadioGroup(new nsRadioGroupStruct());
|
*aRadioGroup = radioGroup;
|
||||||
NS_ENSURE_TRUE(mRadioGroups.Put(tmKey, newRadioGroup), nsnull);
|
radioGroup.forget();
|
||||||
|
|
||||||
return newRadioGroup.forget();
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsDocument::SetCurrentRadioButton(const nsAString& aName,
|
nsDocument::SetCurrentRadioButton(const nsAString& aName,
|
||||||
nsIDOMHTMLInputElement* aRadio)
|
nsIDOMHTMLInputElement* aRadio)
|
||||||
{
|
{
|
||||||
nsRadioGroupStruct* radioGroup = GetRadioGroup(aName);
|
nsRadioGroupStruct* radioGroup = nsnull;
|
||||||
NS_ENSURE_TRUE(radioGroup, NS_OK);
|
GetRadioGroup(aName, &radioGroup);
|
||||||
|
if (radioGroup) {
|
||||||
|
radioGroup->mSelectedRadioButton = aRadio;
|
||||||
|
}
|
||||||
|
|
||||||
radioGroup->mSelectedRadioButton = aRadio;
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6503,11 +6506,13 @@ NS_IMETHODIMP
|
||||||
nsDocument::GetCurrentRadioButton(const nsAString& aName,
|
nsDocument::GetCurrentRadioButton(const nsAString& aName,
|
||||||
nsIDOMHTMLInputElement** aRadio)
|
nsIDOMHTMLInputElement** aRadio)
|
||||||
{
|
{
|
||||||
nsRadioGroupStruct* radioGroup = GetRadioGroup(aName);
|
nsRadioGroupStruct* radioGroup = nsnull;
|
||||||
NS_ENSURE_TRUE(radioGroup, NS_OK);
|
GetRadioGroup(aName, &radioGroup);
|
||||||
|
if (radioGroup) {
|
||||||
|
*aRadio = radioGroup->mSelectedRadioButton;
|
||||||
|
NS_IF_ADDREF(*aRadio);
|
||||||
|
}
|
||||||
|
|
||||||
*aRadio = radioGroup->mSelectedRadioButton;
|
|
||||||
NS_IF_ADDREF(*aRadio);
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6524,8 +6529,9 @@ nsDocument::GetPositionInGroup(nsIDOMHTMLInputElement *aRadio,
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRadioGroupStruct* radioGroup = GetRadioGroup(name);
|
nsRadioGroupStruct* radioGroup = nsnull;
|
||||||
NS_ENSURE_TRUE(radioGroup, NS_ERROR_OUT_OF_MEMORY);
|
nsresult rv = GetRadioGroup(name, &radioGroup);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
nsCOMPtr<nsIFormControl> radioControl(do_QueryInterface(aRadio));
|
nsCOMPtr<nsIFormControl> radioControl(do_QueryInterface(aRadio));
|
||||||
NS_ASSERTION(radioControl, "Radio button should implement nsIFormControl");
|
NS_ASSERTION(radioControl, "Radio button should implement nsIFormControl");
|
||||||
|
@ -6548,8 +6554,11 @@ nsDocument::GetNextRadioButton(const nsAString& aName,
|
||||||
// opposed to nsHTMLDocument?
|
// opposed to nsHTMLDocument?
|
||||||
*aRadioOut = nsnull;
|
*aRadioOut = nsnull;
|
||||||
|
|
||||||
nsRadioGroupStruct* radioGroup = GetRadioGroup(aName);
|
nsRadioGroupStruct* radioGroup = nsnull;
|
||||||
NS_ENSURE_TRUE(radioGroup, NS_ERROR_FAILURE);
|
GetRadioGroup(aName, &radioGroup);
|
||||||
|
if (!radioGroup) {
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
// Return the radio button relative to the focused radio button.
|
// Return the radio button relative to the focused radio button.
|
||||||
// If no radio is focused, get the radio relative to the selected one.
|
// If no radio is focused, get the radio relative to the selected one.
|
||||||
|
@ -6594,16 +6603,18 @@ NS_IMETHODIMP
|
||||||
nsDocument::AddToRadioGroup(const nsAString& aName,
|
nsDocument::AddToRadioGroup(const nsAString& aName,
|
||||||
nsIFormControl* aRadio)
|
nsIFormControl* aRadio)
|
||||||
{
|
{
|
||||||
nsRadioGroupStruct* radioGroup = GetRadioGroup(aName);
|
nsRadioGroupStruct* radioGroup = nsnull;
|
||||||
NS_ENSURE_TRUE(radioGroup, NS_OK);
|
GetRadioGroup(aName, &radioGroup);
|
||||||
|
if (radioGroup) {
|
||||||
|
radioGroup->mRadioButtons.AppendObject(aRadio);
|
||||||
|
|
||||||
radioGroup->mRadioButtons.AppendObject(aRadio);
|
nsCOMPtr<nsIContent> element = do_QueryInterface(aRadio);
|
||||||
|
NS_ASSERTION(element, "radio controls have to be content elements");
|
||||||
nsCOMPtr<nsIContent> element = do_QueryInterface(aRadio);
|
if (element->HasAttr(kNameSpaceID_None, nsGkAtoms::required)) {
|
||||||
NS_ASSERTION(element, "radio controls have to be content elements");
|
radioGroup->mRequiredRadioCount++;
|
||||||
if (element->HasAttr(kNameSpaceID_None, nsGkAtoms::required)) {
|
}
|
||||||
radioGroup->mRequiredRadioCount++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6611,18 +6622,20 @@ NS_IMETHODIMP
|
||||||
nsDocument::RemoveFromRadioGroup(const nsAString& aName,
|
nsDocument::RemoveFromRadioGroup(const nsAString& aName,
|
||||||
nsIFormControl* aRadio)
|
nsIFormControl* aRadio)
|
||||||
{
|
{
|
||||||
nsRadioGroupStruct* radioGroup = GetRadioGroup(aName);
|
nsRadioGroupStruct* radioGroup = nsnull;
|
||||||
NS_ENSURE_TRUE(radioGroup, NS_OK);
|
GetRadioGroup(aName, &radioGroup);
|
||||||
|
if (radioGroup) {
|
||||||
|
radioGroup->mRadioButtons.RemoveObject(aRadio);
|
||||||
|
|
||||||
radioGroup->mRadioButtons.RemoveObject(aRadio);
|
nsCOMPtr<nsIContent> element = do_QueryInterface(aRadio);
|
||||||
|
NS_ASSERTION(element, "radio controls have to be content elements");
|
||||||
nsCOMPtr<nsIContent> element = do_QueryInterface(aRadio);
|
if (element->HasAttr(kNameSpaceID_None, nsGkAtoms::required)) {
|
||||||
NS_ASSERTION(element, "radio controls have to be content elements");
|
radioGroup->mRequiredRadioCount--;
|
||||||
if (element->HasAttr(kNameSpaceID_None, nsGkAtoms::required)) {
|
NS_ASSERTION(radioGroup->mRequiredRadioCount >= 0,
|
||||||
radioGroup->mRequiredRadioCount--;
|
"mRequiredRadioCount shouldn't be negative!");
|
||||||
NS_ASSERTION(radioGroup->mRequiredRadioCount >= 0,
|
}
|
||||||
"mRequiredRadioCount shouldn't be negative!");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6631,8 +6644,11 @@ nsDocument::WalkRadioGroup(const nsAString& aName,
|
||||||
nsIRadioVisitor* aVisitor,
|
nsIRadioVisitor* aVisitor,
|
||||||
bool aFlushContent)
|
bool aFlushContent)
|
||||||
{
|
{
|
||||||
nsRadioGroupStruct* radioGroup = GetRadioGroup(aName);
|
nsRadioGroupStruct* radioGroup = nsnull;
|
||||||
NS_ENSURE_TRUE(radioGroup, NS_OK);
|
GetRadioGroup(aName, &radioGroup);
|
||||||
|
if (!radioGroup) {
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < radioGroup->mRadioButtons.Count(); i++) {
|
for (int i = 0; i < radioGroup->mRadioButtons.Count(); i++) {
|
||||||
if (!aVisitor->Visit(radioGroup->mRadioButtons[i])) {
|
if (!aVisitor->Visit(radioGroup->mRadioButtons[i])) {
|
||||||
|
@ -6661,7 +6677,8 @@ nsDocument::GetRequiredRadioCount(const nsAString& aName) const
|
||||||
void
|
void
|
||||||
nsDocument::RadioRequiredChanged(const nsAString& aName, nsIFormControl* aRadio)
|
nsDocument::RadioRequiredChanged(const nsAString& aName, nsIFormControl* aRadio)
|
||||||
{
|
{
|
||||||
nsRadioGroupStruct* radioGroup = GetRadioGroup(aName);
|
nsRadioGroupStruct* radioGroup = nsnull;
|
||||||
|
GetRadioGroup(aName, &radioGroup);
|
||||||
|
|
||||||
if (!radioGroup) {
|
if (!radioGroup) {
|
||||||
return;
|
return;
|
||||||
|
@ -6696,7 +6713,8 @@ nsDocument::GetValueMissingState(const nsAString& aName) const
|
||||||
void
|
void
|
||||||
nsDocument::SetValueMissingState(const nsAString& aName, bool aValue)
|
nsDocument::SetValueMissingState(const nsAString& aName, bool aValue)
|
||||||
{
|
{
|
||||||
nsRadioGroupStruct* radioGroup = GetRadioGroup(aName);
|
nsRadioGroupStruct* radioGroup = nsnull;
|
||||||
|
GetRadioGroup(aName, &radioGroup);
|
||||||
|
|
||||||
if (!radioGroup) {
|
if (!radioGroup) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -754,7 +754,8 @@ public:
|
||||||
virtual void SetValueMissingState(const nsAString& aName, bool aValue);
|
virtual void SetValueMissingState(const nsAString& aName, bool aValue);
|
||||||
|
|
||||||
// for radio group
|
// for radio group
|
||||||
nsRadioGroupStruct* GetRadioGroup(const nsAString& aName);
|
nsresult GetRadioGroup(const nsAString& aName,
|
||||||
|
nsRadioGroupStruct **aRadioGroup);
|
||||||
|
|
||||||
// nsIDOMNode
|
// nsIDOMNode
|
||||||
NS_DECL_NSIDOMNODE
|
NS_DECL_NSIDOMNODE
|
||||||
|
|
|
@ -379,7 +379,7 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
|
||||||
{
|
{
|
||||||
JSContext* ctx = mContext ? mContext : aContext;
|
JSContext* ctx = mContext ? mContext : aContext;
|
||||||
if (!ctx) {
|
if (!ctx) {
|
||||||
ctx = nsContentUtils::ThreadJSContextStack()->GetSafeJSContext();
|
nsContentUtils::ThreadJSContextStack()->GetSafeJSContext(&ctx);
|
||||||
}
|
}
|
||||||
if (mListeners.Length()) {
|
if (mListeners.Length()) {
|
||||||
nsCOMPtr<nsIAtom> name = do_GetAtom(aMessage);
|
nsCOMPtr<nsIAtom> name = do_GetAtom(aMessage);
|
||||||
|
@ -723,7 +723,8 @@ void
|
||||||
nsFrameScriptExecutor::Shutdown()
|
nsFrameScriptExecutor::Shutdown()
|
||||||
{
|
{
|
||||||
if (sCachedScripts) {
|
if (sCachedScripts) {
|
||||||
JSContext* cx = nsContentUtils::ThreadJSContextStack()->GetSafeJSContext();
|
JSContext* cx = nsnull;
|
||||||
|
nsContentUtils::ThreadJSContextStack()->GetSafeJSContext(&cx);
|
||||||
if (cx) {
|
if (cx) {
|
||||||
#ifdef DEBUG_smaug
|
#ifdef DEBUG_smaug
|
||||||
printf("Will clear cached frame manager scripts!\n");
|
printf("Will clear cached frame manager scripts!\n");
|
||||||
|
|
|
@ -949,6 +949,41 @@ nsGenericDOMDataNode::WalkContentStyleRules(nsRuleWalker* aRuleWalker)
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsIDOMCSSStyleDeclaration*
|
||||||
|
nsGenericDOMDataNode::GetSMILOverrideStyle()
|
||||||
|
{
|
||||||
|
return nsnull;
|
||||||
|
}
|
||||||
|
|
||||||
|
css::StyleRule*
|
||||||
|
nsGenericDOMDataNode::GetSMILOverrideStyleRule()
|
||||||
|
{
|
||||||
|
return nsnull;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
nsGenericDOMDataNode::SetSMILOverrideStyleRule(css::StyleRule* aStyleRule,
|
||||||
|
bool aNotify)
|
||||||
|
{
|
||||||
|
NS_NOTREACHED("How come we're setting SMILOverrideStyle on a non-element?");
|
||||||
|
return NS_ERROR_UNEXPECTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
css::StyleRule*
|
||||||
|
nsGenericDOMDataNode::GetInlineStyleRule()
|
||||||
|
{
|
||||||
|
return nsnull;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsGenericDOMDataNode::SetInlineStyleRule(css::StyleRule* aStyleRule,
|
||||||
|
const nsAString* aSerialized,
|
||||||
|
bool aNotify)
|
||||||
|
{
|
||||||
|
NS_NOTREACHED("How come we're setting inline style on a non-element?");
|
||||||
|
return NS_ERROR_UNEXPECTED;
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP_(bool)
|
NS_IMETHODIMP_(bool)
|
||||||
nsGenericDOMDataNode::IsAttributeMapped(const nsIAtom* aAttribute) const
|
nsGenericDOMDataNode::IsAttributeMapped(const nsIAtom* aAttribute) const
|
||||||
{
|
{
|
||||||
|
|
|
@ -226,6 +226,15 @@ public:
|
||||||
virtual void DestroyContent();
|
virtual void DestroyContent();
|
||||||
virtual void SaveSubtreeState();
|
virtual void SaveSubtreeState();
|
||||||
|
|
||||||
|
virtual nsISMILAttr* GetAnimatedAttr(PRInt32 /*aNamespaceID*/, nsIAtom* /*aName*/)
|
||||||
|
{
|
||||||
|
return nsnull;
|
||||||
|
}
|
||||||
|
virtual nsIDOMCSSStyleDeclaration* GetSMILOverrideStyle();
|
||||||
|
virtual mozilla::css::StyleRule* GetSMILOverrideStyleRule();
|
||||||
|
virtual nsresult SetSMILOverrideStyleRule(mozilla::css::StyleRule* aStyleRule,
|
||||||
|
bool aNotify);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
virtual void List(FILE* out, PRInt32 aIndent) const;
|
virtual void List(FILE* out, PRInt32 aIndent) const;
|
||||||
virtual void DumpContent(FILE* out, PRInt32 aIndent, bool aDumpAll) const;
|
virtual void DumpContent(FILE* out, PRInt32 aIndent, bool aDumpAll) const;
|
||||||
|
@ -238,6 +247,9 @@ public:
|
||||||
virtual nsIAtom* DoGetID() const;
|
virtual nsIAtom* DoGetID() const;
|
||||||
virtual const nsAttrValue* DoGetClasses() const;
|
virtual const nsAttrValue* DoGetClasses() const;
|
||||||
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
|
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
|
||||||
|
virtual mozilla::css::StyleRule* GetInlineStyleRule();
|
||||||
|
NS_IMETHOD SetInlineStyleRule(mozilla::css::StyleRule* aStyleRule,
|
||||||
|
const nsAString* aSerialized, bool aNotify);
|
||||||
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
|
NS_IMETHOD_(bool) IsAttributeMapped(const nsIAtom* aAttribute) const;
|
||||||
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
|
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
|
||||||
PRInt32 aModType) const;
|
PRInt32 aModType) const;
|
||||||
|
|
|
@ -3610,7 +3610,7 @@ nsGenericElement::GetInlineStyleRule()
|
||||||
return nsnull;
|
return nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
NS_IMETHODIMP
|
||||||
nsGenericElement::SetInlineStyleRule(css::StyleRule* aStyleRule,
|
nsGenericElement::SetInlineStyleRule(css::StyleRule* aStyleRule,
|
||||||
const nsAString* aSerialized,
|
const nsAString* aSerialized,
|
||||||
bool aNotify)
|
bool aNotify)
|
||||||
|
|
|
@ -368,9 +368,9 @@ public:
|
||||||
virtual const nsAttrValue* DoGetClasses() const;
|
virtual const nsAttrValue* DoGetClasses() const;
|
||||||
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
|
NS_IMETHOD WalkContentStyleRules(nsRuleWalker* aRuleWalker);
|
||||||
virtual mozilla::css::StyleRule* GetInlineStyleRule();
|
virtual mozilla::css::StyleRule* GetInlineStyleRule();
|
||||||
virtual nsresult SetInlineStyleRule(mozilla::css::StyleRule* aStyleRule,
|
NS_IMETHOD SetInlineStyleRule(mozilla::css::StyleRule* aStyleRule,
|
||||||
const nsAString* aSerialized,
|
const nsAString* aSerialized,
|
||||||
bool aNotify);
|
bool aNotify);
|
||||||
NS_IMETHOD_(bool)
|
NS_IMETHOD_(bool)
|
||||||
IsAttributeMapped(const nsIAtom* aAttribute) const;
|
IsAttributeMapped(const nsIAtom* aAttribute) const;
|
||||||
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
|
virtual nsChangeHint GetAttributeChangeHint(const nsIAtom* aAttribute,
|
||||||
|
|
|
@ -161,7 +161,7 @@ nsStyledElementNotElementCSSInlineStyle::AfterSetAttr(PRInt32 aNamespaceID,
|
||||||
aNotify);
|
aNotify);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
NS_IMETHODIMP
|
||||||
nsStyledElementNotElementCSSInlineStyle::SetInlineStyleRule(css::StyleRule* aStyleRule,
|
nsStyledElementNotElementCSSInlineStyle::SetInlineStyleRule(css::StyleRule* aStyleRule,
|
||||||
const nsAString* aSerialized,
|
const nsAString* aSerialized,
|
||||||
bool aNotify)
|
bool aNotify)
|
||||||
|
|
|
@ -74,9 +74,9 @@ public:
|
||||||
virtual const nsAttrValue* DoGetClasses() const;
|
virtual const nsAttrValue* DoGetClasses() const;
|
||||||
|
|
||||||
virtual mozilla::css::StyleRule* GetInlineStyleRule();
|
virtual mozilla::css::StyleRule* GetInlineStyleRule();
|
||||||
virtual nsresult SetInlineStyleRule(mozilla::css::StyleRule* aStyleRule,
|
NS_IMETHOD SetInlineStyleRule(mozilla::css::StyleRule* aStyleRule,
|
||||||
const nsAString* aSerialized,
|
const nsAString* aSerialized,
|
||||||
bool aNotify);
|
bool aNotify);
|
||||||
|
|
||||||
virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
|
virtual nsresult UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
|
||||||
bool aNotify);
|
bool aNotify);
|
||||||
|
|
|
@ -134,7 +134,8 @@ nsEventListenerInfo::ToSource(nsAString& aResult)
|
||||||
nsCOMPtr<nsIThreadJSContextStack> stack =
|
nsCOMPtr<nsIThreadJSContextStack> stack =
|
||||||
nsContentUtils::ThreadJSContextStack();
|
nsContentUtils::ThreadJSContextStack();
|
||||||
if (stack) {
|
if (stack) {
|
||||||
JSContext* cx = stack->GetSafeJSContext();
|
JSContext* cx = nsnull;
|
||||||
|
stack->GetSafeJSContext(&cx);
|
||||||
if (cx && NS_SUCCEEDED(stack->Push(cx))) {
|
if (cx && NS_SUCCEEDED(stack->Push(cx))) {
|
||||||
{
|
{
|
||||||
// Extra block to finish the auto request before calling pop
|
// Extra block to finish the auto request before calling pop
|
||||||
|
@ -176,7 +177,8 @@ nsEventListenerInfo::GetDebugObject(nsISupports** aRetVal)
|
||||||
nsCOMPtr<nsIThreadJSContextStack> stack =
|
nsCOMPtr<nsIThreadJSContextStack> stack =
|
||||||
nsContentUtils::ThreadJSContextStack();
|
nsContentUtils::ThreadJSContextStack();
|
||||||
if (stack) {
|
if (stack) {
|
||||||
JSContext* cx = stack->GetSafeJSContext();
|
JSContext* cx = nsnull;
|
||||||
|
stack->GetSafeJSContext(&cx);
|
||||||
if (cx && NS_SUCCEEDED(stack->Push(cx))) {
|
if (cx && NS_SUCCEEDED(stack->Push(cx))) {
|
||||||
{
|
{
|
||||||
// Extra block to finish the auto request before calling pop
|
// Extra block to finish the auto request before calling pop
|
||||||
|
|
|
@ -124,7 +124,6 @@ public:
|
||||||
NS_FORWARD_NSIDOMNODE(nsDocument::)
|
NS_FORWARD_NSIDOMNODE(nsDocument::)
|
||||||
|
|
||||||
// nsIDOMHTMLDocument interface
|
// nsIDOMHTMLDocument interface
|
||||||
using nsDocument::GetPlugins;
|
|
||||||
NS_DECL_NSIDOMHTMLDOCUMENT
|
NS_DECL_NSIDOMHTMLDOCUMENT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -169,7 +169,6 @@
|
||||||
#include "nsIEditingSession.h"
|
#include "nsIEditingSession.h"
|
||||||
|
|
||||||
#include "nsPIDOMWindow.h"
|
#include "nsPIDOMWindow.h"
|
||||||
#include "nsGlobalWindow.h"
|
|
||||||
#include "nsPIWindowRoot.h"
|
#include "nsPIWindowRoot.h"
|
||||||
#include "nsIDOMDocument.h"
|
#include "nsIDOMDocument.h"
|
||||||
#include "nsICachingChannel.h"
|
#include "nsICachingChannel.h"
|
||||||
|
@ -10856,6 +10855,10 @@ nsDocShell::EnsureScriptEnvironment()
|
||||||
mInEnsureScriptEnv = true;
|
mInEnsureScriptEnv = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
nsCOMPtr<nsIDOMScriptObjectFactory> factory =
|
||||||
|
do_GetService(kDOMScriptObjectFactoryCID);
|
||||||
|
NS_ENSURE_TRUE(factory, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
nsCOMPtr<nsIWebBrowserChrome> browserChrome(do_GetInterface(mTreeOwner));
|
nsCOMPtr<nsIWebBrowserChrome> browserChrome(do_GetInterface(mTreeOwner));
|
||||||
NS_ENSURE_TRUE(browserChrome, NS_ERROR_NOT_AVAILABLE);
|
NS_ENSURE_TRUE(browserChrome, NS_ERROR_NOT_AVAILABLE);
|
||||||
|
|
||||||
|
@ -10868,15 +10871,20 @@ nsDocShell::EnsureScriptEnvironment()
|
||||||
|
|
||||||
// If our window is modal and we're not opened as chrome, make
|
// If our window is modal and we're not opened as chrome, make
|
||||||
// this window a modal content window.
|
// this window a modal content window.
|
||||||
nsRefPtr<nsGlobalWindow> window =
|
factory->NewScriptGlobalObject(mItemType == typeChrome,
|
||||||
NS_NewScriptGlobalObject(mItemType == typeChrome, isModalContentWindow);
|
isModalContentWindow,
|
||||||
MOZ_ASSERT(window);
|
getter_AddRefs(mScriptGlobal));
|
||||||
mScriptGlobal = window;
|
NS_ENSURE_TRUE(mScriptGlobal, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
window->SetDocShell(this);
|
nsCOMPtr<nsPIDOMWindow> win(do_QueryInterface(mScriptGlobal));
|
||||||
|
win->SetDocShell(static_cast<nsIDocShell *>(this));
|
||||||
|
|
||||||
// Ensure the script object is set up to run script.
|
// Ensure the script object is set up to run script.
|
||||||
return mScriptGlobal->EnsureScriptEnvironment();
|
nsresult rv;
|
||||||
|
rv = mScriptGlobal->EnsureScriptEnvironment();
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -105,12 +105,7 @@ DIRS += \
|
||||||
bluetooth \
|
bluetooth \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
endif
|
endif
|
||||||
|
TEST_DIRS += tests
|
||||||
TEST_DIRS += \
|
|
||||||
tests \
|
|
||||||
imported-tests \
|
|
||||||
$(NULL)
|
|
||||||
|
|
||||||
ifneq (,$(filter gtk2 cocoa windows android qt os2,$(MOZ_WIDGET_TOOLKIT)))
|
ifneq (,$(filter gtk2 cocoa windows android qt os2,$(MOZ_WIDGET_TOOLKIT)))
|
||||||
TEST_DIRS += plugins/test
|
TEST_DIRS += plugins/test
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -53,9 +53,7 @@
|
||||||
#include "jsdbgapi.h"
|
#include "jsdbgapi.h"
|
||||||
#include "WrapperFactory.h"
|
#include "WrapperFactory.h"
|
||||||
#include "AccessCheck.h"
|
#include "AccessCheck.h"
|
||||||
#include "XrayWrapper.h"
|
|
||||||
|
|
||||||
#include "xpcpublic.h"
|
|
||||||
#include "xpcprivate.h"
|
#include "xpcprivate.h"
|
||||||
#include "XPCWrapper.h"
|
#include "XPCWrapper.h"
|
||||||
|
|
||||||
|
@ -86,6 +84,8 @@
|
||||||
#include "nsIRunnable.h"
|
#include "nsIRunnable.h"
|
||||||
#include "nsThreadUtils.h"
|
#include "nsThreadUtils.h"
|
||||||
#include "nsDOMEventTargetHelper.h"
|
#include "nsDOMEventTargetHelper.h"
|
||||||
|
#include "xpcprivate.h"
|
||||||
|
#include "XrayWrapper.h"
|
||||||
|
|
||||||
// General helper includes
|
// General helper includes
|
||||||
#include "nsGlobalWindow.h"
|
#include "nsGlobalWindow.h"
|
||||||
|
@ -2418,8 +2418,10 @@ nsDOMClassInfo::Init()
|
||||||
do_GetService("@mozilla.org/js/xpc/ContextStack;1", &rv);
|
do_GetService("@mozilla.org/js/xpc/ContextStack;1", &rv);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
JSContext* cx = stack->GetSafeJSContext();
|
JSContext *cx = nsnull;
|
||||||
NS_ENSURE_TRUE(cx, NS_ERROR_FAILURE);
|
|
||||||
|
rv = stack->GetSafeJSContext(&cx);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
DOM_CLASSINFO_MAP_BEGIN(Window, nsIDOMWindow)
|
DOM_CLASSINFO_MAP_BEGIN(Window, nsIDOMWindow)
|
||||||
DOM_CLASSINFO_WINDOW_MAP_ENTRIES(nsGlobalWindow::HasIndexedDBSupport())
|
DOM_CLASSINFO_WINDOW_MAP_ENTRIES(nsGlobalWindow::HasIndexedDBSupport())
|
||||||
|
@ -4922,7 +4924,8 @@ nsDOMClassInfo::PostCreatePrototype(JSContext * cx, JSObject * proto)
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!xpc::DOM_DefineQuickStubs(cx, proto, flags, count, mData->mInterfaces)) {
|
if (!sXPConnect->DefineDOMQuickStubs(cx, proto, flags,
|
||||||
|
count, mData->mInterfaces)) {
|
||||||
JS_ClearPendingException(cx);
|
JS_ClearPendingException(cx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5823,10 +5826,11 @@ DefineIDBInterfaceConstants(JSContext *cx, JSObject *obj, const nsIID *aIID)
|
||||||
const char* interface;
|
const char* interface;
|
||||||
if (aIID->Equals(NS_GET_IID(nsIIDBCursor))) {
|
if (aIID->Equals(NS_GET_IID(nsIIDBCursor))) {
|
||||||
interface = IDBConstant::IDBCursor;
|
interface = IDBConstant::IDBCursor;
|
||||||
} else if (aIID->Equals(NS_GET_IID(nsIIDBRequest))) {
|
}
|
||||||
|
else if (aIID->Equals(NS_GET_IID(nsIIDBRequest))) {
|
||||||
interface = IDBConstant::IDBRequest;
|
interface = IDBConstant::IDBRequest;
|
||||||
} else {
|
}
|
||||||
MOZ_ASSERT(aIID->Equals(NS_GET_IID(nsIIDBTransaction)));
|
else if (aIID->Equals(NS_GET_IID(nsIIDBTransaction))) {
|
||||||
interface = IDBConstant::IDBTransaction;
|
interface = IDBConstant::IDBTransaction;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8775,9 +8779,9 @@ nsHTMLDocumentSH::DocumentAllGetProperty(JSContext *cx, JSObject *obj,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsHTMLDocument* doc = GetDocument(obj);
|
nsHTMLDocument *doc = GetDocument(obj);
|
||||||
nsISupports* result = nsnull;
|
nsISupports *result;
|
||||||
nsWrapperCache* cache = nsnull;
|
nsWrapperCache *cache;
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
if (JSID_IS_STRING(id)) {
|
if (JSID_IS_STRING(id)) {
|
||||||
|
@ -9586,7 +9590,7 @@ public:
|
||||||
do_GetService("@mozilla.org/js/xpc/ContextStack;1");
|
do_GetService("@mozilla.org/js/xpc/ContextStack;1");
|
||||||
NS_ENSURE_TRUE(stack, NS_OK);
|
NS_ENSURE_TRUE(stack, NS_OK);
|
||||||
|
|
||||||
cx = stack->GetSafeJSContext();
|
stack->GetSafeJSContext(&cx);
|
||||||
NS_ENSURE_TRUE(cx, NS_OK);
|
NS_ENSURE_TRUE(cx, NS_OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,8 @@ static NS_DEFINE_CID(kDOMScriptObjectFactoryCID, NS_DOM_SCRIPT_OBJECT_FACTORY_CI
|
||||||
|
|
||||||
nsIExceptionProvider* gExceptionProvider = nsnull;
|
nsIExceptionProvider* gExceptionProvider = nsnull;
|
||||||
|
|
||||||
nsDOMScriptObjectFactory::nsDOMScriptObjectFactory()
|
nsDOMScriptObjectFactory::nsDOMScriptObjectFactory() :
|
||||||
|
mLoadedAllLanguages(false)
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIObserverService> observerService =
|
nsCOMPtr<nsIObserverService> observerService =
|
||||||
mozilla::services::GetObserverService();
|
mozilla::services::GetObserverService();
|
||||||
|
@ -79,23 +80,26 @@ nsDOMScriptObjectFactory::nsDOMScriptObjectFactory()
|
||||||
observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
|
observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsIExceptionProvider> provider = new nsDOMExceptionProvider();
|
nsCOMPtr<nsIExceptionProvider> provider(new nsDOMExceptionProvider());
|
||||||
nsCOMPtr<nsIExceptionService> xs =
|
if (provider) {
|
||||||
do_GetService(NS_EXCEPTIONSERVICE_CONTRACTID);
|
nsCOMPtr<nsIExceptionService> xs =
|
||||||
|
do_GetService(NS_EXCEPTIONSERVICE_CONTRACTID);
|
||||||
|
|
||||||
if (xs) {
|
if (xs) {
|
||||||
xs->RegisterExceptionProvider(provider, NS_ERROR_MODULE_DOM);
|
xs->RegisterExceptionProvider(provider, NS_ERROR_MODULE_DOM);
|
||||||
xs->RegisterExceptionProvider(provider, NS_ERROR_MODULE_SVG);
|
xs->RegisterExceptionProvider(provider, NS_ERROR_MODULE_SVG);
|
||||||
xs->RegisterExceptionProvider(provider, NS_ERROR_MODULE_DOM_XPATH);
|
xs->RegisterExceptionProvider(provider, NS_ERROR_MODULE_DOM_XPATH);
|
||||||
xs->RegisterExceptionProvider(provider, NS_ERROR_MODULE_DOM_INDEXEDDB);
|
xs->RegisterExceptionProvider(provider, NS_ERROR_MODULE_DOM_INDEXEDDB);
|
||||||
xs->RegisterExceptionProvider(provider, NS_ERROR_MODULE_XPCONNECT);
|
xs->RegisterExceptionProvider(provider, NS_ERROR_MODULE_XPCONNECT);
|
||||||
|
xs->RegisterExceptionProvider(provider, NS_ERROR_MODULE_DOM_EVENTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_ASSERTION(!gExceptionProvider, "Registered twice?!");
|
||||||
|
provider.swap(gExceptionProvider);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_ASSERTION(!gExceptionProvider, "Registered twice?!");
|
|
||||||
provider.swap(gExceptionProvider);
|
|
||||||
|
|
||||||
// And pre-create the javascript language.
|
// And pre-create the javascript language.
|
||||||
NS_CreateJSRuntime(getter_AddRefs(mJSRuntime));
|
NS_CreateJSRuntime(getter_AddRefs(mLanguageArray[NS_STID_INDEX(nsIProgrammingLanguage::JAVASCRIPT)]));
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_INTERFACE_MAP_BEGIN(nsDOMScriptObjectFactory)
|
NS_INTERFACE_MAP_BEGIN(nsDOMScriptObjectFactory)
|
||||||
|
@ -108,6 +112,119 @@ NS_INTERFACE_MAP_END
|
||||||
NS_IMPL_ADDREF(nsDOMScriptObjectFactory)
|
NS_IMPL_ADDREF(nsDOMScriptObjectFactory)
|
||||||
NS_IMPL_RELEASE(nsDOMScriptObjectFactory)
|
NS_IMPL_RELEASE(nsDOMScriptObjectFactory)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Notes about language registration (for language other than js):
|
||||||
|
* - All language are expected to register (at least) 2 contract IDs
|
||||||
|
* @mozilla.org/script-language;1?id=%d
|
||||||
|
* using the language ID as defined in nsIProgrammingLanguage, and
|
||||||
|
* @mozilla.org/script-language;1?script-type=%s
|
||||||
|
* using the "mime-type" of the script language
|
||||||
|
*
|
||||||
|
* Theoretically, a language could register multiple script-type
|
||||||
|
* names, although this is discouraged - each language should have one,
|
||||||
|
* canonical name.
|
||||||
|
*
|
||||||
|
* The most common case is that languages are looked up by ID. For this
|
||||||
|
* reason, we keep an array of languages indexed by this ID - the registry
|
||||||
|
* is only looked the first request for a language ID.
|
||||||
|
*
|
||||||
|
* The registry is looked up and getService called for each query by name.
|
||||||
|
* (As services are cached by CID, multiple contractIDs will still work
|
||||||
|
* correctly)
|
||||||
|
**/
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsDOMScriptObjectFactory::GetScriptRuntime(const nsAString &aLanguageName,
|
||||||
|
nsIScriptRuntime **aLanguage)
|
||||||
|
{
|
||||||
|
// Note that many callers have optimized detection for JS (along with
|
||||||
|
// supporting various alternate names for JS), so don't call this.
|
||||||
|
// One exception is for the new "script-type" attribute on a node - and
|
||||||
|
// there is no need to support backwards compatible names.
|
||||||
|
// As JS is the default language, this is still rarely called for JS -
|
||||||
|
// only when a node explicitly sets JS - so that is done last.
|
||||||
|
nsCAutoString contractid(NS_LITERAL_CSTRING(
|
||||||
|
"@mozilla.org/script-language;1?script-type="));
|
||||||
|
// Arbitrarily use utf8 encoding should the name have extended chars
|
||||||
|
AppendUTF16toUTF8(aLanguageName, contractid);
|
||||||
|
nsresult rv;
|
||||||
|
nsCOMPtr<nsIScriptRuntime> lang =
|
||||||
|
do_GetService(contractid.get(), &rv);
|
||||||
|
|
||||||
|
if (NS_FAILED(rv)) {
|
||||||
|
if (aLanguageName.Equals(NS_LITERAL_STRING("application/javascript")))
|
||||||
|
return GetScriptRuntimeByID(nsIProgrammingLanguage::JAVASCRIPT, aLanguage);
|
||||||
|
// Not JS and nothing else we know about.
|
||||||
|
NS_WARNING("No script language registered for this mime-type");
|
||||||
|
return NS_ERROR_FACTORY_NOT_REGISTERED;
|
||||||
|
}
|
||||||
|
// And stash it away in our array for fast lookup by ID.
|
||||||
|
PRUint32 lang_ndx = NS_STID_INDEX(nsIProgrammingLanguage::JAVASCRIPT);
|
||||||
|
if (mLanguageArray[lang_ndx] == nsnull) {
|
||||||
|
mLanguageArray[lang_ndx] = lang;
|
||||||
|
} else {
|
||||||
|
// All languages are services - we should have an identical object!
|
||||||
|
NS_ASSERTION(mLanguageArray[lang_ndx] == lang,
|
||||||
|
"Got a different language for this ID???");
|
||||||
|
}
|
||||||
|
*aLanguage = lang;
|
||||||
|
NS_IF_ADDREF(*aLanguage);
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsDOMScriptObjectFactory::GetScriptRuntimeByID(PRUint32 aLanguageID,
|
||||||
|
nsIScriptRuntime **aLanguage)
|
||||||
|
{
|
||||||
|
if (!NS_STID_VALID(aLanguageID)) {
|
||||||
|
NS_WARNING("Unknown script language");
|
||||||
|
return NS_ERROR_UNEXPECTED;
|
||||||
|
}
|
||||||
|
*aLanguage = mLanguageArray[NS_STID_INDEX(aLanguageID)];
|
||||||
|
if (!*aLanguage) {
|
||||||
|
nsCAutoString contractid(NS_LITERAL_CSTRING(
|
||||||
|
"@mozilla.org/script-language;1?id="));
|
||||||
|
char langIdStr[25]; // space for an int.
|
||||||
|
sprintf(langIdStr, "%d", aLanguageID);
|
||||||
|
contractid += langIdStr;
|
||||||
|
nsresult rv;
|
||||||
|
nsCOMPtr<nsIScriptRuntime> lang = do_GetService(contractid.get(), &rv);
|
||||||
|
|
||||||
|
if (NS_FAILED(rv)) {
|
||||||
|
NS_ERROR("Failed to get the script language");
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Stash it away in our array for fast lookup by ID.
|
||||||
|
mLanguageArray[NS_STID_INDEX(aLanguageID)] = lang;
|
||||||
|
*aLanguage = lang;
|
||||||
|
}
|
||||||
|
NS_IF_ADDREF(*aLanguage);
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsDOMScriptObjectFactory::GetIDForScriptType(const nsAString &aLanguageName,
|
||||||
|
PRUint32 *aScriptTypeID)
|
||||||
|
{
|
||||||
|
nsCOMPtr<nsIScriptRuntime> languageRuntime;
|
||||||
|
nsresult rv;
|
||||||
|
rv = GetScriptRuntime(aLanguageName, getter_AddRefs(languageRuntime));
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
return rv;
|
||||||
|
|
||||||
|
*aScriptTypeID = nsIProgrammingLanguage::JAVASCRIPT;
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsDOMScriptObjectFactory::NewScriptGlobalObject(bool aIsChrome,
|
||||||
|
bool aIsModalContentWindow,
|
||||||
|
nsIScriptGlobalObject **aGlobal)
|
||||||
|
{
|
||||||
|
return NS_NewScriptGlobalObject(aIsChrome, aIsModalContentWindow, aGlobal);
|
||||||
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP_(nsISupports *)
|
NS_IMETHODIMP_(nsISupports *)
|
||||||
nsDOMScriptObjectFactory::GetClassInfoInstance(nsDOMClassInfoID aID)
|
nsDOMScriptObjectFactory::GetClassInfoInstance(nsDOMClassInfoID aID)
|
||||||
{
|
{
|
||||||
|
@ -174,6 +291,8 @@ nsDOMScriptObjectFactory::Observe(nsISupports *aSubject,
|
||||||
NS_ERROR_MODULE_DOM_XPATH);
|
NS_ERROR_MODULE_DOM_XPATH);
|
||||||
xs->UnregisterExceptionProvider(gExceptionProvider,
|
xs->UnregisterExceptionProvider(gExceptionProvider,
|
||||||
NS_ERROR_MODULE_XPCONNECT);
|
NS_ERROR_MODULE_XPCONNECT);
|
||||||
|
xs->UnregisterExceptionProvider(gExceptionProvider,
|
||||||
|
NS_ERROR_MODULE_DOM_EVENTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_RELEASE(gExceptionProvider);
|
NS_RELEASE(gExceptionProvider);
|
||||||
|
@ -200,7 +319,7 @@ CreateXPConnectException(nsresult aResult, nsIException *aDefaultException,
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
}
|
}
|
||||||
|
|
||||||
exception.forget(_retval);
|
NS_ADDREF(*_retval = exception);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,42 +344,31 @@ nsDOMScriptObjectFactory::RegisterDOMClassInfo(const char *aName,
|
||||||
aConstructorCID);
|
aConstructorCID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Factories
|
// Factories
|
||||||
static nsresult
|
|
||||||
GetJSRuntime(nsIScriptRuntime** aLanguage)
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsIDOMScriptObjectFactory> factory =
|
|
||||||
do_GetService(kDOMScriptObjectFactoryCID);
|
|
||||||
NS_ENSURE_TRUE(factory, NS_ERROR_FAILURE);
|
|
||||||
|
|
||||||
NS_IF_ADDREF(*aLanguage = factory->GetJSRuntime());
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult NS_GetScriptRuntime(const nsAString &aLanguageName,
|
nsresult NS_GetScriptRuntime(const nsAString &aLanguageName,
|
||||||
nsIScriptRuntime **aLanguage)
|
nsIScriptRuntime **aLanguage)
|
||||||
{
|
{
|
||||||
*aLanguage = NULL;
|
nsresult rv;
|
||||||
|
*aLanguage = nsnull;
|
||||||
NS_ENSURE_TRUE(aLanguageName.EqualsLiteral("application/javascript"),
|
nsCOMPtr<nsIDOMScriptObjectFactory> factory = \
|
||||||
NS_ERROR_FAILURE);
|
do_GetService(kDOMScriptObjectFactoryCID, &rv);
|
||||||
|
if (NS_FAILED(rv))
|
||||||
return GetJSRuntime(aLanguage);
|
return rv;
|
||||||
|
return factory->GetScriptRuntime(aLanguageName, aLanguage);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult NS_GetScriptRuntimeByID(PRUint32 aScriptTypeID,
|
nsresult NS_GetScriptRuntimeByID(PRUint32 aScriptTypeID,
|
||||||
nsIScriptRuntime **aLanguage)
|
nsIScriptRuntime **aLanguage)
|
||||||
{
|
{
|
||||||
*aLanguage = NULL;
|
nsresult rv;
|
||||||
|
*aLanguage = nsnull;
|
||||||
NS_ENSURE_TRUE(aScriptTypeID == nsIProgrammingLanguage::JAVASCRIPT,
|
nsCOMPtr<nsIDOMScriptObjectFactory> factory = \
|
||||||
NS_ERROR_FAILURE);
|
do_GetService(kDOMScriptObjectFactoryCID, &rv);
|
||||||
|
if (NS_FAILED(rv))
|
||||||
return GetJSRuntime(aLanguage);
|
return rv;
|
||||||
|
return factory->GetScriptRuntimeByID(aScriptTypeID, aLanguage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NS_IMPL_THREADSAFE_ISUPPORTS1(nsDOMExceptionProvider, nsIExceptionProvider)
|
NS_IMPL_THREADSAFE_ISUPPORTS1(nsDOMExceptionProvider, nsIExceptionProvider)
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
|
|
@ -68,6 +68,19 @@ public:
|
||||||
NS_DECL_NSIOBSERVER
|
NS_DECL_NSIOBSERVER
|
||||||
|
|
||||||
// nsIDOMScriptObjectFactory
|
// nsIDOMScriptObjectFactory
|
||||||
|
NS_IMETHOD GetScriptRuntime(const nsAString &aLanguageName,
|
||||||
|
nsIScriptRuntime **aLanguage);
|
||||||
|
|
||||||
|
NS_IMETHOD GetScriptRuntimeByID(PRUint32 aLanguageID,
|
||||||
|
nsIScriptRuntime **aLanguage);
|
||||||
|
|
||||||
|
NS_IMETHOD GetIDForScriptType(const nsAString &aLanguageName,
|
||||||
|
PRUint32 *aLanguageID);
|
||||||
|
|
||||||
|
NS_IMETHOD NewScriptGlobalObject(bool aIsChrome,
|
||||||
|
bool aIsModalContentWindow,
|
||||||
|
nsIScriptGlobalObject **aGlobal);
|
||||||
|
|
||||||
NS_IMETHOD_(nsISupports *) GetClassInfoInstance(nsDOMClassInfoID aID);
|
NS_IMETHOD_(nsISupports *) GetClassInfoInstance(nsDOMClassInfoID aID);
|
||||||
NS_IMETHOD_(nsISupports *) GetExternalClassInfoInstance(const nsAString& aName);
|
NS_IMETHOD_(nsISupports *) GetExternalClassInfoInstance(const nsAString& aName);
|
||||||
|
|
||||||
|
@ -78,6 +91,10 @@ public:
|
||||||
PRUint32 aScriptableFlags,
|
PRUint32 aScriptableFlags,
|
||||||
bool aHasClassInterface,
|
bool aHasClassInterface,
|
||||||
const nsCID *aConstructorCID);
|
const nsCID *aConstructorCID);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool mLoadedAllLanguages;
|
||||||
|
nsCOMPtr<nsIScriptRuntime> mLanguageArray[NS_STID_ARRAY_UBOUND];
|
||||||
};
|
};
|
||||||
|
|
||||||
class nsDOMExceptionProvider : public nsIExceptionProvider
|
class nsDOMExceptionProvider : public nsIExceptionProvider
|
||||||
|
|
|
@ -886,6 +886,7 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalWindow *aOuterWindow)
|
||||||
mTimeoutPublicIdCounter(1),
|
mTimeoutPublicIdCounter(1),
|
||||||
mTimeoutFiringDepth(0),
|
mTimeoutFiringDepth(0),
|
||||||
mJSObject(nsnull),
|
mJSObject(nsnull),
|
||||||
|
mPendingStorageEventsObsolete(nsnull),
|
||||||
mTimeoutsSuspendDepth(0),
|
mTimeoutsSuspendDepth(0),
|
||||||
mFocusMethod(0),
|
mFocusMethod(0),
|
||||||
mSerial(0),
|
mSerial(0),
|
||||||
|
@ -920,9 +921,10 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalWindow *aOuterWindow)
|
||||||
os->AddObserver(mObserver, NS_IOSERVICE_OFFLINE_STATUS_TOPIC,
|
os->AddObserver(mObserver, NS_IOSERVICE_OFFLINE_STATUS_TOPIC,
|
||||||
false);
|
false);
|
||||||
|
|
||||||
// Watch for dom-storage2-changed so we can fire storage
|
// Watch for dom-storage-changed so we can fire storage
|
||||||
// events. Use a strong reference.
|
// events. Use a strong reference.
|
||||||
os->AddObserver(mObserver, "dom-storage2-changed", false);
|
os->AddObserver(mObserver, "dom-storage2-changed", false);
|
||||||
|
os->AddObserver(mObserver, "dom-storage-changed", false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1201,6 +1203,7 @@ nsGlobalWindow::CleanUp(bool aIgnoreModalDialog)
|
||||||
if (os) {
|
if (os) {
|
||||||
os->RemoveObserver(mObserver, NS_IOSERVICE_OFFLINE_STATUS_TOPIC);
|
os->RemoveObserver(mObserver, NS_IOSERVICE_OFFLINE_STATUS_TOPIC);
|
||||||
os->RemoveObserver(mObserver, "dom-storage2-changed");
|
os->RemoveObserver(mObserver, "dom-storage2-changed");
|
||||||
|
os->RemoveObserver(mObserver, "dom-storage-changed");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Drop its reference to this dying window, in case for some bogus reason
|
// Drop its reference to this dying window, in case for some bogus reason
|
||||||
|
@ -1223,6 +1226,7 @@ nsGlobalWindow::CleanUp(bool aIgnoreModalDialog)
|
||||||
mWindowUtils = nsnull;
|
mWindowUtils = nsnull;
|
||||||
mApplicationCache = nsnull;
|
mApplicationCache = nsnull;
|
||||||
mIndexedDB = nsnull;
|
mIndexedDB = nsnull;
|
||||||
|
mPendingStorageEventsObsolete = nsnull;
|
||||||
|
|
||||||
mPerformance = nsnull;
|
mPerformance = nsnull;
|
||||||
|
|
||||||
|
@ -6195,7 +6199,7 @@ PostMessageEvent::Run()
|
||||||
// we need to find a JSContext.
|
// we need to find a JSContext.
|
||||||
nsIThreadJSContextStack* cxStack = nsContentUtils::ThreadJSContextStack();
|
nsIThreadJSContextStack* cxStack = nsContentUtils::ThreadJSContextStack();
|
||||||
if (cxStack) {
|
if (cxStack) {
|
||||||
cx = cxStack->GetSafeJSContext();
|
cxStack->GetSafeJSContext(&cx);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cx) {
|
if (!cx) {
|
||||||
|
@ -8471,6 +8475,76 @@ nsGlobalWindow::Observe(nsISupports* aSubject, const char* aTopic,
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IsInnerWindow() && !nsCRT::strcmp(aTopic, "dom-storage-changed")) {
|
||||||
|
nsIPrincipal *principal;
|
||||||
|
nsresult rv;
|
||||||
|
|
||||||
|
principal = GetPrincipal();
|
||||||
|
if (principal) {
|
||||||
|
// A global storage object changed, check to see if it's one
|
||||||
|
// this window can access.
|
||||||
|
|
||||||
|
nsCOMPtr<nsIURI> codebase;
|
||||||
|
principal->GetURI(getter_AddRefs(codebase));
|
||||||
|
|
||||||
|
if (!codebase) {
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsCAutoString currentDomain;
|
||||||
|
rv = codebase->GetAsciiHost(currentDomain);
|
||||||
|
if (NS_FAILED(rv)) {
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
nsAutoString domain(aData);
|
||||||
|
|
||||||
|
if (IsFrozen()) {
|
||||||
|
// This window is frozen, rather than firing the events here,
|
||||||
|
// store the domain in which the change happened and fire the
|
||||||
|
// events if we're ever thawed.
|
||||||
|
|
||||||
|
if (!mPendingStorageEventsObsolete) {
|
||||||
|
mPendingStorageEventsObsolete = new nsDataHashtable<nsStringHashKey, bool>;
|
||||||
|
NS_ENSURE_TRUE(mPendingStorageEventsObsolete, NS_ERROR_OUT_OF_MEMORY);
|
||||||
|
|
||||||
|
rv = mPendingStorageEventsObsolete->Init();
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
}
|
||||||
|
|
||||||
|
mPendingStorageEventsObsolete->Put(domain, true);
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsRefPtr<nsDOMStorageEventObsolete> event = new nsDOMStorageEventObsolete();
|
||||||
|
NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);
|
||||||
|
|
||||||
|
rv = event->InitStorageEvent(NS_LITERAL_STRING("storage"), false, false, domain);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
|
nsCOMPtr<nsIDOMHTMLDocument> htmlDoc(do_QueryInterface(mDocument));
|
||||||
|
|
||||||
|
nsCOMPtr<nsIDOMEventTarget> target;
|
||||||
|
|
||||||
|
if (htmlDoc) {
|
||||||
|
nsCOMPtr<nsIDOMHTMLElement> body;
|
||||||
|
htmlDoc->GetBody(getter_AddRefs(body));
|
||||||
|
|
||||||
|
target = do_QueryInterface(body);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!target) {
|
||||||
|
target = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool defaultActionEnabled;
|
||||||
|
target->DispatchEvent((nsIDOMStorageEventObsolete *)event, &defaultActionEnabled);
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
if (IsInnerWindow() && !nsCRT::strcmp(aTopic, "dom-storage2-changed")) {
|
if (IsInnerWindow() && !nsCRT::strcmp(aTopic, "dom-storage2-changed")) {
|
||||||
nsIPrincipal *principal;
|
nsIPrincipal *principal;
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
@ -8624,6 +8698,22 @@ nsGlobalWindow::CloneStorageEvent(const nsAString& aType,
|
||||||
url, storageArea);
|
url, storageArea);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PLDHashOperator
|
||||||
|
FirePendingStorageEvents(const nsAString& aKey, bool aData, void *userArg)
|
||||||
|
{
|
||||||
|
nsGlobalWindow *win = static_cast<nsGlobalWindow *>(userArg);
|
||||||
|
|
||||||
|
nsCOMPtr<nsIDOMStorage> storage;
|
||||||
|
win->GetSessionStorage(getter_AddRefs(storage));
|
||||||
|
|
||||||
|
if (storage) {
|
||||||
|
win->Observe(storage, "dom-storage-changed",
|
||||||
|
aKey.IsEmpty() ? nsnull : PromiseFlatString(aKey).get());
|
||||||
|
}
|
||||||
|
|
||||||
|
return PL_DHASH_NEXT;
|
||||||
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsGlobalWindow::FireDelayedDOMEvents()
|
nsGlobalWindow::FireDelayedDOMEvents()
|
||||||
{
|
{
|
||||||
|
@ -8633,6 +8723,12 @@ nsGlobalWindow::FireDelayedDOMEvents()
|
||||||
Observe(mPendingStorageEvents[i], "dom-storage2-changed", nsnull);
|
Observe(mPendingStorageEvents[i], "dom-storage2-changed", nsnull);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mPendingStorageEventsObsolete) {
|
||||||
|
// Fire pending storage events.
|
||||||
|
mPendingStorageEventsObsolete->EnumerateRead(FirePendingStorageEvents, this);
|
||||||
|
mPendingStorageEventsObsolete = nsnull;
|
||||||
|
}
|
||||||
|
|
||||||
if (mApplicationCache) {
|
if (mApplicationCache) {
|
||||||
static_cast<nsDOMOfflineResourceList*>(mApplicationCache.get())->FirePendingEvents();
|
static_cast<nsDOMOfflineResourceList*>(mApplicationCache.get())->FirePendingEvents();
|
||||||
}
|
}
|
||||||
|
@ -9251,7 +9347,7 @@ nsGlobalWindow::RunTimeout(nsTimeout *aTimeout)
|
||||||
++mTimeoutFiringDepth;
|
++mTimeoutFiringDepth;
|
||||||
|
|
||||||
bool trackNestingLevel = !timeout->mIsInterval;
|
bool trackNestingLevel = !timeout->mIsInterval;
|
||||||
PRUint32 nestingLevel = 0;
|
PRUint32 nestingLevel;
|
||||||
if (trackNestingLevel) {
|
if (trackNestingLevel) {
|
||||||
nestingLevel = sNestingLevel;
|
nestingLevel = sNestingLevel;
|
||||||
sNestingLevel = timeout->mNestingLevel;
|
sNestingLevel = timeout->mNestingLevel;
|
||||||
|
@ -9969,9 +10065,8 @@ nsGlobalWindow::SuspendTimeouts(PRUint32 aIncrease,
|
||||||
if (!suspended) {
|
if (!suspended) {
|
||||||
nsCOMPtr<nsIDeviceSensors> ac = do_GetService(NS_DEVICE_SENSORS_CONTRACTID);
|
nsCOMPtr<nsIDeviceSensors> ac = do_GetService(NS_DEVICE_SENSORS_CONTRACTID);
|
||||||
if (ac) {
|
if (ac) {
|
||||||
for (PRUint32 i = 0; i < mEnabledSensors.Length(); i++) {
|
for (int i = 0; i < mEnabledSensors.Length(); i++)
|
||||||
ac->RemoveWindowListener(mEnabledSensors[i], this);
|
ac->RemoveWindowListener(mEnabledSensors[i], this);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Suspend all of the workers for this window.
|
// Suspend all of the workers for this window.
|
||||||
|
@ -10050,9 +10145,8 @@ nsGlobalWindow::ResumeTimeouts(bool aThawChildren)
|
||||||
if (shouldResume) {
|
if (shouldResume) {
|
||||||
nsCOMPtr<nsIDeviceSensors> ac = do_GetService(NS_DEVICE_SENSORS_CONTRACTID);
|
nsCOMPtr<nsIDeviceSensors> ac = do_GetService(NS_DEVICE_SENSORS_CONTRACTID);
|
||||||
if (ac) {
|
if (ac) {
|
||||||
for (PRUint32 i = 0; i < mEnabledSensors.Length(); i++) {
|
for (int i = 0; i < mEnabledSensors.Length(); i++)
|
||||||
ac->AddWindowListener(mEnabledSensors[i], this);
|
ac->AddWindowListener(mEnabledSensors[i], this);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resume all of the workers for this window.
|
// Resume all of the workers for this window.
|
||||||
|
@ -10159,7 +10253,7 @@ void
|
||||||
nsGlobalWindow::EnableDeviceSensor(PRUint32 aType)
|
nsGlobalWindow::EnableDeviceSensor(PRUint32 aType)
|
||||||
{
|
{
|
||||||
bool alreadyEnabled = false;
|
bool alreadyEnabled = false;
|
||||||
for (PRUint32 i = 0; i < mEnabledSensors.Length(); i++) {
|
for (int i = 0; i < mEnabledSensors.Length(); i++) {
|
||||||
if (mEnabledSensors[i] == aType) {
|
if (mEnabledSensors[i] == aType) {
|
||||||
alreadyEnabled = true;
|
alreadyEnabled = true;
|
||||||
break;
|
break;
|
||||||
|
@ -10179,8 +10273,8 @@ nsGlobalWindow::EnableDeviceSensor(PRUint32 aType)
|
||||||
void
|
void
|
||||||
nsGlobalWindow::DisableDeviceSensor(PRUint32 aType)
|
nsGlobalWindow::DisableDeviceSensor(PRUint32 aType)
|
||||||
{
|
{
|
||||||
PRInt32 doomedElement = -1;
|
PRUint32 doomedElement = -1;
|
||||||
for (PRUint32 i = 0; i < mEnabledSensors.Length(); i++) {
|
for (int i = 0; i < mEnabledSensors.Length(); i++) {
|
||||||
if (mEnabledSensors[i] == aType) {
|
if (mEnabledSensors[i] == aType) {
|
||||||
doomedElement = i;
|
doomedElement = i;
|
||||||
break;
|
break;
|
||||||
|
@ -10646,6 +10740,33 @@ nsGlobalWindow::SetHasAudioAvailableEventListeners()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//*****************************************************************************
|
||||||
|
// nsGlobalWindow: Creator Function (This should go away)
|
||||||
|
//*****************************************************************************
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
NS_NewScriptGlobalObject(bool aIsChrome, bool aIsModalContentWindow,
|
||||||
|
nsIScriptGlobalObject **aResult)
|
||||||
|
{
|
||||||
|
*aResult = nsnull;
|
||||||
|
|
||||||
|
nsGlobalWindow *global;
|
||||||
|
|
||||||
|
if (aIsChrome) {
|
||||||
|
global = new nsGlobalChromeWindow(nsnull);
|
||||||
|
} else if (aIsModalContentWindow) {
|
||||||
|
global = new nsGlobalModalWindow(nsnull);
|
||||||
|
} else {
|
||||||
|
global = new nsGlobalWindow(nsnull);
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_ENSURE_TRUE(global, NS_ERROR_OUT_OF_MEMORY);
|
||||||
|
|
||||||
|
NS_ADDREF(*aResult = global);
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
#define EVENT(name_, id_, type_, struct_) \
|
#define EVENT(name_, id_, type_, struct_) \
|
||||||
NS_IMETHODIMP nsGlobalWindow::GetOn##name_(JSContext *cx, \
|
NS_IMETHODIMP nsGlobalWindow::GetOn##name_(JSContext *cx, \
|
||||||
jsval *vp) { \
|
jsval *vp) { \
|
||||||
|
|
|
@ -939,6 +939,7 @@ protected:
|
||||||
|
|
||||||
typedef nsCOMArray<nsIDOMStorageEvent> nsDOMStorageEventArray;
|
typedef nsCOMArray<nsIDOMStorageEvent> nsDOMStorageEventArray;
|
||||||
nsDOMStorageEventArray mPendingStorageEvents;
|
nsDOMStorageEventArray mPendingStorageEvents;
|
||||||
|
nsAutoPtr< nsDataHashtable<nsStringHashKey, bool> > mPendingStorageEventsObsolete;
|
||||||
|
|
||||||
PRUint32 mTimeoutsSuspendDepth;
|
PRUint32 mTimeoutsSuspendDepth;
|
||||||
|
|
||||||
|
@ -1057,20 +1058,8 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
/* factory function */
|
/* factory function */
|
||||||
inline already_AddRefed<nsGlobalWindow>
|
nsresult
|
||||||
NS_NewScriptGlobalObject(bool aIsChrome, bool aIsModalContentWindow)
|
NS_NewScriptGlobalObject(bool aIsChrome, bool aIsModalContentWindow,
|
||||||
{
|
nsIScriptGlobalObject **aResult);
|
||||||
nsRefPtr<nsGlobalWindow> global;
|
|
||||||
|
|
||||||
if (aIsChrome) {
|
|
||||||
global = new nsGlobalChromeWindow(nsnull);
|
|
||||||
} else if (aIsModalContentWindow) {
|
|
||||||
global = new nsGlobalModalWindow(nsnull);
|
|
||||||
} else {
|
|
||||||
global = new nsGlobalWindow(nsnull);
|
|
||||||
}
|
|
||||||
|
|
||||||
return global.forget();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* nsGlobalWindow_h___ */
|
#endif /* nsGlobalWindow_h___ */
|
||||||
|
|
|
@ -41,14 +41,14 @@
|
||||||
#include "nsISupports.h"
|
#include "nsISupports.h"
|
||||||
#include "nsIDOMClassInfo.h"
|
#include "nsIDOMClassInfo.h"
|
||||||
#include "nsStringGlue.h"
|
#include "nsStringGlue.h"
|
||||||
#include "nsIScriptRuntime.h"
|
|
||||||
|
|
||||||
#define NS_IDOM_SCRIPT_OBJECT_FACTORY_IID \
|
#define NS_IDOM_SCRIPT_OBJECT_FACTORY_IID \
|
||||||
{ 0x2a50e17c, 0x46ff, 0x4150, \
|
{ 0x8c0eb687, 0xa859, 0x4a62, \
|
||||||
{ 0xbb, 0x46, 0xd8, 0x07, 0xb3, 0x36, 0xde, 0xab } }
|
{ 0x99, 0x82, 0xea, 0xbf, 0x9e, 0xf5, 0x59, 0x5f } }
|
||||||
|
|
||||||
class nsIScriptContext;
|
class nsIScriptContext;
|
||||||
class nsIScriptGlobalObject;
|
class nsIScriptGlobalObject;
|
||||||
|
class nsIScriptRuntime;
|
||||||
class nsIDOMEventListener;
|
class nsIDOMEventListener;
|
||||||
|
|
||||||
typedef nsXPCClassInfo* (*nsDOMClassInfoExternalConstructorFnc)
|
typedef nsXPCClassInfo* (*nsDOMClassInfoExternalConstructorFnc)
|
||||||
|
@ -58,6 +58,27 @@ class nsIDOMScriptObjectFactory : public nsISupports {
|
||||||
public:
|
public:
|
||||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOM_SCRIPT_OBJECT_FACTORY_IID)
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOM_SCRIPT_OBJECT_FACTORY_IID)
|
||||||
|
|
||||||
|
// Get a script language given its "name" (ie, the mime-type)
|
||||||
|
// Note that to fetch javascript from this function, you must currently
|
||||||
|
// use the name "application/javascript" (but also note that all existing
|
||||||
|
// callers of this function optimize the detection of JS, so do not
|
||||||
|
// ask this function for JS)
|
||||||
|
NS_IMETHOD GetScriptRuntime(const nsAString &aLanguageName,
|
||||||
|
nsIScriptRuntime **aLanguage) = 0;
|
||||||
|
|
||||||
|
// Get a script language given its nsIProgrammingLanguage ID.
|
||||||
|
NS_IMETHOD GetScriptRuntimeByID(PRUint32 aScriptTypeID,
|
||||||
|
nsIScriptRuntime **aLanguage) = 0;
|
||||||
|
|
||||||
|
// Get the ID for a language given its name - but like GetScriptRuntime,
|
||||||
|
// only "application/javascript" is currently supported for JS.
|
||||||
|
NS_IMETHOD GetIDForScriptType(const nsAString &aLanguageName,
|
||||||
|
PRUint32 *aScriptTypeID) = 0;
|
||||||
|
|
||||||
|
NS_IMETHOD NewScriptGlobalObject(bool aIsChrome,
|
||||||
|
bool aIsModalContentWindow,
|
||||||
|
nsIScriptGlobalObject **aGlobal) = 0;
|
||||||
|
|
||||||
NS_IMETHOD_(nsISupports *) GetClassInfoInstance(nsDOMClassInfoID aID) = 0;
|
NS_IMETHOD_(nsISupports *) GetClassInfoInstance(nsDOMClassInfoID aID) = 0;
|
||||||
NS_IMETHOD_(nsISupports *) GetExternalClassInfoInstance(const nsAString& aName) = 0;
|
NS_IMETHOD_(nsISupports *) GetExternalClassInfoInstance(const nsAString& aName) = 0;
|
||||||
|
|
||||||
|
@ -73,14 +94,6 @@ public:
|
||||||
PRUint32 aScriptableFlags,
|
PRUint32 aScriptableFlags,
|
||||||
bool aHasClassInterface,
|
bool aHasClassInterface,
|
||||||
const nsCID *aConstructorCID) = 0;
|
const nsCID *aConstructorCID) = 0;
|
||||||
|
|
||||||
nsIScriptRuntime* GetJSRuntime()
|
|
||||||
{
|
|
||||||
return mJSRuntime;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
nsCOMPtr<nsIScriptRuntime> mJSRuntime;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMScriptObjectFactory,
|
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMScriptObjectFactory,
|
||||||
|
|
|
@ -1324,13 +1324,13 @@ def getArgumentConversionTemplate(type, descriptor):
|
||||||
elif tag is IDLType.Tags.int64:
|
elif tag is IDLType.Tags.int64:
|
||||||
# XXXbz this may not match what WebIDL says to do in terms of reducing
|
# XXXbz this may not match what WebIDL says to do in terms of reducing
|
||||||
# mod 2^64. Should we check?
|
# mod 2^64. Should we check?
|
||||||
replacements["jstype"] = "int64_t"
|
replacements["jstype"] = "PRInt64"
|
||||||
replacements["converter"] = "xpc::ValueToInt64"
|
replacements["converter"] = "xpc_qsValueToInt64"
|
||||||
elif tag is IDLType.Tags.uint64:
|
elif tag is IDLType.Tags.uint64:
|
||||||
# XXXbz this may not match what WebIDL says to do in terms of reducing
|
# XXXbz this may not match what WebIDL says to do in terms of reducing
|
||||||
# mod 2^64. Should we check?
|
# mod 2^64. Should we check?
|
||||||
replacements["jstype"] = "uint64_t"
|
replacements["jstype"] = "PRUint64"
|
||||||
replacements["converter"] = "xpc::ValueToUint64"
|
replacements["converter"] = "xpc_qsValueToUint64"
|
||||||
elif tag in [IDLType.Tags.float, IDLType.Tags.double]:
|
elif tag in [IDLType.Tags.float, IDLType.Tags.double]:
|
||||||
replacements["jstype"] = "double"
|
replacements["jstype"] = "double"
|
||||||
replacements["converter"] = "JS::ToNumber"
|
replacements["converter"] = "JS::ToNumber"
|
||||||
|
|
|
@ -134,8 +134,7 @@ IDBRequest::NotifyHelperCompleted(HelperBase* aHelper)
|
||||||
nsIThreadJSContextStack* cxStack = nsContentUtils::ThreadJSContextStack();
|
nsIThreadJSContextStack* cxStack = nsContentUtils::ThreadJSContextStack();
|
||||||
NS_ASSERTION(cxStack, "Failed to get thread context stack!");
|
NS_ASSERTION(cxStack, "Failed to get thread context stack!");
|
||||||
|
|
||||||
cx = cxStack->GetSafeJSContext();
|
if (NS_FAILED(cxStack->GetSafeJSContext(&cx))) {
|
||||||
if (!cx) {
|
|
||||||
NS_WARNING("Failed to get safe JSContext!");
|
NS_WARNING("Failed to get safe JSContext!");
|
||||||
rv = NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
rv = NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
|
||||||
mError = DOMError::CreateForNSResult(rv);
|
mError = DOMError::CreateForNSResult(rv);
|
||||||
|
|
|
@ -47,9 +47,10 @@ class nsIDOMStorageObsolete;
|
||||||
class nsIURI;
|
class nsIURI;
|
||||||
class nsIPrincipal;
|
class nsIPrincipal;
|
||||||
|
|
||||||
#define NS_PIDOMSTORAGE_IID \
|
// {BAFFCEB1-FD40-4ea9-8378-3509DD79204A}
|
||||||
{ 0x86dfe3c4, 0x4286, 0x4648, \
|
#define NS_PIDOMSTORAGE_IID \
|
||||||
{ 0xb2, 0x09, 0x55, 0x27, 0x50, 0x59, 0x26, 0xac } }
|
{ 0xbaffceb1, 0xfd40, 0x4ea9, \
|
||||||
|
{ 0x83, 0x78, 0x35, 0x9, 0xdd, 0x79, 0x20, 0x4a } }
|
||||||
|
|
||||||
class nsPIDOMStorage : public nsISupports
|
class nsPIDOMStorage : public nsISupports
|
||||||
{
|
{
|
||||||
|
@ -75,6 +76,10 @@ public:
|
||||||
virtual bool CanAccess(nsIPrincipal *aPrincipal) = 0;
|
virtual bool CanAccess(nsIPrincipal *aPrincipal) = 0;
|
||||||
|
|
||||||
virtual nsDOMStorageType StorageType() = 0;
|
virtual nsDOMStorageType StorageType() = 0;
|
||||||
|
|
||||||
|
virtual void BroadcastChangeNotification(const nsSubstring &aKey,
|
||||||
|
const nsSubstring &aOldValue,
|
||||||
|
const nsSubstring &aNewValue) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsPIDOMStorage, NS_PIDOMSTORAGE_IID)
|
NS_DEFINE_STATIC_IID_ACCESSOR(nsPIDOMStorage, NS_PIDOMSTORAGE_IID)
|
||||||
|
|
|
@ -42,10 +42,6 @@
|
||||||
[scriptable, uuid(E3CD8269-9502-4E70-910C-0D6D71B22253)]
|
[scriptable, uuid(E3CD8269-9502-4E70-910C-0D6D71B22253)]
|
||||||
interface nsIDOMXULMultiSelectControlElement : nsIDOMXULSelectControlElement
|
interface nsIDOMXULMultiSelectControlElement : nsIDOMXULSelectControlElement
|
||||||
{
|
{
|
||||||
%{C++
|
|
||||||
using nsIDOMXULSelectControlElement::GetSelectedItem;
|
|
||||||
%}
|
|
||||||
|
|
||||||
attribute DOMString selType;
|
attribute DOMString selType;
|
||||||
|
|
||||||
attribute nsIDOMXULSelectControlItemElement currentItem;
|
attribute nsIDOMXULSelectControlItemElement currentItem;
|
||||||
|
|
|
@ -432,7 +432,7 @@ ContentParent::ContentParent()
|
||||||
nsCString buildID(gAppData->buildID);
|
nsCString buildID(gAppData->buildID);
|
||||||
|
|
||||||
//Sending all information to content process
|
//Sending all information to content process
|
||||||
unused << SendAppInfo(version, buildID);
|
SendAppInfo(version, buildID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -718,10 +718,10 @@ ContentParent::Observe(nsISupports* aSubject,
|
||||||
unused << SendPMemoryReportRequestConstructor();
|
unused << SendPMemoryReportRequestConstructor();
|
||||||
}
|
}
|
||||||
else if (!strcmp(aTopic, "child-gc-request")){
|
else if (!strcmp(aTopic, "child-gc-request")){
|
||||||
unused << SendGarbageCollect();
|
SendGarbageCollect();
|
||||||
}
|
}
|
||||||
else if (!strcmp(aTopic, "child-cc-request")){
|
else if (!strcmp(aTopic, "child-cc-request")){
|
||||||
unused << SendCycleCollect();
|
SendCycleCollect();
|
||||||
}
|
}
|
||||||
#ifdef ACCESSIBILITY
|
#ifdef ACCESSIBILITY
|
||||||
// Make sure accessibility is running in content process when accessibility
|
// Make sure accessibility is running in content process when accessibility
|
||||||
|
|
|
@ -152,7 +152,7 @@ CrashReporterParent::GenerateChildData(const AnnotationTable* processNotes)
|
||||||
mNotes.Put(NS_LITERAL_CSTRING("ProcessType"), type);
|
mNotes.Put(NS_LITERAL_CSTRING("ProcessType"), type);
|
||||||
|
|
||||||
char startTime[32];
|
char startTime[32];
|
||||||
sprintf(startTime, "%lld", static_cast<long long>(mStartTime));
|
sprintf(startTime, "%lld", static_cast<PRInt64>(mStartTime));
|
||||||
mNotes.Put(NS_LITERAL_CSTRING("StartupTime"), nsDependentCString(startTime));
|
mNotes.Put(NS_LITERAL_CSTRING("StartupTime"), nsDependentCString(startTime));
|
||||||
|
|
||||||
if (!mAppNotes.IsEmpty())
|
if (!mAppNotes.IsEmpty())
|
||||||
|
|
|
@ -1985,7 +1985,8 @@ nsJSNPRuntime::OnPluginDestroy(NPP npp)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
JSContext* cx = stack->GetSafeJSContext();
|
JSContext *cx;
|
||||||
|
stack->GetSafeJSContext(&cx);
|
||||||
if (!cx) {
|
if (!cx) {
|
||||||
NS_ERROR("No safe JS context available!");
|
NS_ERROR("No safe JS context available!");
|
||||||
|
|
||||||
|
|
|
@ -1348,10 +1348,10 @@ _getstringidentifier(const NPUTF8* name)
|
||||||
if (!stack)
|
if (!stack)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
JSContext* cx = stack->GetSafeJSContext();
|
JSContext *cx = nsnull;
|
||||||
if (!cx) {
|
stack->GetSafeJSContext(&cx);
|
||||||
|
if (!cx)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
|
|
||||||
JSAutoRequest ar(cx);
|
JSAutoRequest ar(cx);
|
||||||
return doGetIdentifier(cx, name);
|
return doGetIdentifier(cx, name);
|
||||||
|
@ -1369,10 +1369,10 @@ _getstringidentifiers(const NPUTF8** names, int32_t nameCount,
|
||||||
if (!stack)
|
if (!stack)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
JSContext* cx = stack->GetSafeJSContext();
|
JSContext *cx = nsnull;
|
||||||
if (!cx) {
|
stack->GetSafeJSContext(&cx);
|
||||||
|
if (!cx)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
JSAutoRequest ar(cx);
|
JSAutoRequest ar(cx);
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,8 @@ PluginIdentifierParent::RecvRetain()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
JSContext* cx = stack->GetSafeJSContext();
|
JSContext *cx = nsnull;
|
||||||
|
stack->GetSafeJSContext(&cx);
|
||||||
if (!cx) {
|
if (!cx) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,6 @@
|
||||||
|
|
||||||
#include "mozilla/plugins/PPluginInstanceParent.h"
|
#include "mozilla/plugins/PPluginInstanceParent.h"
|
||||||
#include "mozilla/plugins/PluginScriptableObjectParent.h"
|
#include "mozilla/plugins/PluginScriptableObjectParent.h"
|
||||||
#include "mozilla/unused.h"
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
#include "mozilla/gfx/SharedDIBWin.h"
|
#include "mozilla/gfx/SharedDIBWin.h"
|
||||||
#elif defined(MOZ_WIDGET_COCOA)
|
#elif defined(MOZ_WIDGET_COCOA)
|
||||||
|
@ -306,10 +305,7 @@ public:
|
||||||
nsresult HandleGUIEvent(const nsGUIEvent& anEvent, bool* handled);
|
nsresult HandleGUIEvent(const nsGUIEvent& anEvent, bool* handled);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void DidComposite()
|
void DidComposite() { SendNPP_DidComposite(); }
|
||||||
{
|
|
||||||
unused << SendNPP_DidComposite();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Create an appropriate platform surface for a background of size
|
// Create an appropriate platform surface for a background of size
|
||||||
|
|
|
@ -588,7 +588,7 @@ PluginModuleParent::AnswerNPN_UserAgent(nsCString* userAgent)
|
||||||
PluginIdentifierParent*
|
PluginIdentifierParent*
|
||||||
PluginModuleParent::GetIdentifierForNPIdentifier(NPP npp, NPIdentifier aIdentifier)
|
PluginModuleParent::GetIdentifierForNPIdentifier(NPP npp, NPIdentifier aIdentifier)
|
||||||
{
|
{
|
||||||
PluginIdentifierParent* ident = nsnull;
|
PluginIdentifierParent* ident;
|
||||||
if (mIdentifiers.Get(aIdentifier, &ident)) {
|
if (mIdentifiers.Get(aIdentifier, &ident)) {
|
||||||
if (ident->IsTemporary()) {
|
if (ident->IsTemporary()) {
|
||||||
ident->AddTemporaryRef();
|
ident->AddTemporaryRef();
|
||||||
|
|
|
@ -1742,6 +1742,25 @@ nsDOMStorage::StorageType()
|
||||||
return mStorageType;
|
return mStorageType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsDOMStorage::BroadcastChangeNotification(const nsSubstring &aKey,
|
||||||
|
const nsSubstring &aOldValue,
|
||||||
|
const nsSubstring &aNewValue)
|
||||||
|
{
|
||||||
|
nsCOMPtr<nsIObserverService> observerService =
|
||||||
|
mozilla::services::GetObserverService();
|
||||||
|
if (!observerService) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fire off a notification that a storage object changed. If the
|
||||||
|
// storage object is a session storage object, we don't pass a
|
||||||
|
// domain, but if it's a global storage object we do.
|
||||||
|
observerService->NotifyObservers((nsIDOMStorageObsolete *)this,
|
||||||
|
"dom-storage-changed",
|
||||||
|
NS_ConvertUTF8toUTF16(mStorageImpl->mDomain).get());
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// nsDOMStorage2
|
// nsDOMStorage2
|
||||||
//
|
//
|
||||||
|
@ -1906,8 +1925,8 @@ StorageNotifierRunnable::Run()
|
||||||
|
|
||||||
void
|
void
|
||||||
nsDOMStorage2::BroadcastChangeNotification(const nsSubstring &aKey,
|
nsDOMStorage2::BroadcastChangeNotification(const nsSubstring &aKey,
|
||||||
const nsSubstring &aOldValue,
|
const nsSubstring &aOldValue,
|
||||||
const nsSubstring &aNewValue)
|
const nsSubstring &aNewValue)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsCOMPtr<nsIDOMStorageEvent> event = new nsDOMStorageEvent();
|
nsCOMPtr<nsIDOMStorageEvent> event = new nsDOMStorageEvent();
|
||||||
|
|
|
@ -339,8 +339,6 @@ private:
|
||||||
nsDOMStorage* mOwner;
|
nsDOMStorage* mOwner;
|
||||||
};
|
};
|
||||||
|
|
||||||
class nsDOMStorage2;
|
|
||||||
|
|
||||||
class nsDOMStorage : public nsIDOMStorageObsolete,
|
class nsDOMStorage : public nsIDOMStorageObsolete,
|
||||||
public nsPIDOMStorage
|
public nsPIDOMStorage
|
||||||
{
|
{
|
||||||
|
@ -368,6 +366,9 @@ public:
|
||||||
virtual nsIPrincipal* Principal();
|
virtual nsIPrincipal* Principal();
|
||||||
virtual bool CanAccess(nsIPrincipal *aPrincipal);
|
virtual bool CanAccess(nsIPrincipal *aPrincipal);
|
||||||
virtual nsDOMStorageType StorageType();
|
virtual nsDOMStorageType StorageType();
|
||||||
|
virtual void BroadcastChangeNotification(const nsSubstring &aKey,
|
||||||
|
const nsSubstring &aOldValue,
|
||||||
|
const nsSubstring &aNewValue);
|
||||||
|
|
||||||
// Check whether storage may be used by the caller, and whether it
|
// Check whether storage may be used by the caller, and whether it
|
||||||
// is session only. Returns true if storage may be used.
|
// is session only. Returns true if storage may be used.
|
||||||
|
@ -418,7 +419,7 @@ public:
|
||||||
|
|
||||||
friend class nsIDOMStorage2;
|
friend class nsIDOMStorage2;
|
||||||
nsCOMPtr<nsIPrincipal> mPrincipal;
|
nsCOMPtr<nsIPrincipal> mPrincipal;
|
||||||
nsDOMStorage2* mEventBroadcaster;
|
nsPIDOMStorage* mEventBroadcaster;
|
||||||
};
|
};
|
||||||
|
|
||||||
class nsDOMStorage2 : public nsIDOMStorage,
|
class nsDOMStorage2 : public nsIDOMStorage,
|
||||||
|
@ -444,10 +445,10 @@ public:
|
||||||
virtual nsIPrincipal* Principal();
|
virtual nsIPrincipal* Principal();
|
||||||
virtual bool CanAccess(nsIPrincipal *aPrincipal);
|
virtual bool CanAccess(nsIPrincipal *aPrincipal);
|
||||||
virtual nsDOMStorageType StorageType();
|
virtual nsDOMStorageType StorageType();
|
||||||
|
virtual void BroadcastChangeNotification(const nsSubstring &aKey,
|
||||||
|
const nsSubstring &aOldValue,
|
||||||
|
const nsSubstring &aNewValue);
|
||||||
|
|
||||||
void BroadcastChangeNotification(const nsSubstring &aKey,
|
|
||||||
const nsSubstring &aOldValue,
|
|
||||||
const nsSubstring &aNewValue);
|
|
||||||
nsresult InitAsSessionStorageFork(nsIPrincipal *aPrincipal,
|
nsresult InitAsSessionStorageFork(nsIPrincipal *aPrincipal,
|
||||||
const nsSubstring &aDocumentURI,
|
const nsSubstring &aDocumentURI,
|
||||||
nsIDOMStorageObsolete* aStorage);
|
nsIDOMStorageObsolete* aStorage);
|
||||||
|
|
|
@ -216,15 +216,16 @@ SystemWorkerManager::Init()
|
||||||
NS_ASSERTION(NS_IsMainThread(), "We can only initialize on the main thread");
|
NS_ASSERTION(NS_IsMainThread(), "We can only initialize on the main thread");
|
||||||
NS_ASSERTION(!mShutdown, "Already shutdown!");
|
NS_ASSERTION(!mShutdown, "Already shutdown!");
|
||||||
|
|
||||||
JSContext* cx = nsContentUtils::ThreadJSContextStack()->GetSafeJSContext();
|
JSContext *cx;
|
||||||
NS_ENSURE_TRUE(cx, NS_ERROR_FAILURE);
|
nsresult rv = nsContentUtils::ThreadJSContextStack()->GetSafeJSContext(&cx);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
nsCxPusher pusher;
|
nsCxPusher pusher;
|
||||||
if (!pusher.Push(cx, false)) {
|
if (!cx || !pusher.Push(cx, false)) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult rv = InitRIL(cx);
|
rv = InitRIL(cx);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
rv = InitWifi(cx);
|
rv = InitWifi(cx);
|
||||||
|
|
|
@ -58,6 +58,7 @@ DIRS += \
|
||||||
sessionstorage \
|
sessionstorage \
|
||||||
storageevent \
|
storageevent \
|
||||||
pointerlock \
|
pointerlock \
|
||||||
|
w3c \
|
||||||
browser-frame \
|
browser-frame \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||||
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
|
||||||
DEPTH = ../..
|
DEPTH = ../../../..
|
||||||
topsrcdir = @top_srcdir@
|
topsrcdir = @top_srcdir@
|
||||||
srcdir = @srcdir@
|
srcdir = @srcdir@
|
||||||
VPATH = @srcdir@
|
VPATH = @srcdir@
|
||||||
relativesrcdir = dom/imported-tests
|
relativesrcdir = dom/tests/mochitest/w3c
|
||||||
|
|
||||||
DIRS = \
|
DIRS = \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
@ -24,7 +24,7 @@ _SUPPORT_FILES = \
|
||||||
WebIDLParser.js \
|
WebIDLParser.js \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
testharnessreport.js: testharnessreport.js.in writeReporter.py html.json webapps.json
|
testharnessreport.js: testharnessreport.js.in writeReporter.py
|
||||||
$(PYTHON_PATH) $(srcdir)/writeReporter.py $<
|
$(PYTHON_PATH) $(srcdir)/writeReporter.py $<
|
||||||
|
|
||||||
libs:: $(_SUPPORT_FILES)
|
libs:: $(_SUPPORT_FILES)
|
|
@ -1,11 +1,11 @@
|
||||||
# THIS FILE IS AUTOGENERATED BY importTestsuite.py - DO NOT EDIT
|
# THIS FILE IS AUTOGENERATED - DO NOT EDIT
|
||||||
|
|
||||||
DEPTH = ../../../../../..
|
DEPTH = ../../../../../../../..
|
||||||
|
|
||||||
topsrcdir = @top_srcdir@
|
topsrcdir = @top_srcdir@
|
||||||
srcdir = @srcdir@
|
srcdir = @srcdir@
|
||||||
VPATH = @srcdir@
|
VPATH = @srcdir@
|
||||||
relativesrcdir = dom/imported-tests/html/tests/submission/Mozilla
|
relativesrcdir = dom/tests/mochitest/w3c/html/tests/submission/Mozilla
|
||||||
|
|
||||||
DIRS = \
|
DIRS = \
|
||||||
$(NULL)
|
$(NULL)
|
|
@ -53,12 +53,11 @@ def copy(thissrcdir, dest, directories):
|
||||||
print "Copying %s..." % (directories, )
|
print "Copying %s..." % (directories, )
|
||||||
for d in directories:
|
for d in directories:
|
||||||
dirtocreate = dest
|
dirtocreate = dest
|
||||||
|
os.makedirs(d)
|
||||||
|
|
||||||
subdirs, mochitests, supportfiles = parseManifestFile(dest, d)
|
subdirs, mochitests, supportfiles = parseManifestFile(dest, d)
|
||||||
sourcedir = "hg-%s/%s" % (dest, d)
|
sourcedir = "hg-%s/%s" % (dest, d)
|
||||||
destdir = "%s/%s" % (dest, d)
|
destdir = "%s/%s" % (dest, d)
|
||||||
os.makedirs(destdir)
|
|
||||||
|
|
||||||
for mochitest in mochitests:
|
for mochitest in mochitests:
|
||||||
shutil.copy("%s/%s" % (sourcedir, mochitest), "%s/test_%s" % (destdir, mochitest))
|
shutil.copy("%s/%s" % (sourcedir, mochitest), "%s/test_%s" % (destdir, mochitest))
|
||||||
for support in supportfiles:
|
for support in supportfiles:
|
||||||
|
@ -140,9 +139,9 @@ def printMakefiles(thissrcdir, dest, directories):
|
||||||
|
|
||||||
def hgadd(dest, directories):
|
def hgadd(dest, directories):
|
||||||
"""Inform hg of the files in |directories|."""
|
"""Inform hg of the files in |directories|."""
|
||||||
print "hg addremoving..."
|
print "hg adding..."
|
||||||
for d in directories:
|
for d in directories:
|
||||||
subprocess.check_call(["hg", "addremove", "%s/%s" % (dest, d)])
|
subprocess.check_call(["hg", "add", "%s/%s" % (dest, d)])
|
||||||
|
|
||||||
def importDirs(thissrcdir, dest, directories):
|
def importDirs(thissrcdir, dest, directories):
|
||||||
copy(thissrcdir, dest, directories)
|
copy(thissrcdir, dest, directories)
|
||||||
|
@ -171,7 +170,7 @@ def importRepo(confFile, thissrcdir):
|
||||||
print "Done"
|
print "Done"
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
if len(sys.argv) != 2:
|
if len(sys.argv) == 2:
|
||||||
print "Need one argument."
|
print "Need one argument."
|
||||||
else:
|
else:
|
||||||
importRepo(sys.argv[1], "dom/imported-tests")
|
importRepo(sys.argv[1], "dom/tests/mochitest/w3c")
|
|
@ -38,7 +38,7 @@ var W3CTest = {
|
||||||
* directory. Used as a key into the expectedFailures dictionary.
|
* directory. Used as a key into the expectedFailures dictionary.
|
||||||
*/
|
*/
|
||||||
"getURL": function() {
|
"getURL": function() {
|
||||||
return this.runner.currentTestURL.substring("/tests/dom/imported-tests/".length);
|
return this.runner.currentTestURL.substring("/tests/dom/tests/mochitest/w3c/".length);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
|
@ -1,11 +1,11 @@
|
||||||
# THIS FILE IS AUTOGENERATED BY importTestsuite.py - DO NOT EDIT
|
# THIS FILE IS AUTOGENERATED - DO NOT EDIT
|
||||||
|
|
||||||
DEPTH = ../../../../../../..
|
DEPTH = ../../../../../../../../..
|
||||||
|
|
||||||
topsrcdir = @top_srcdir@
|
topsrcdir = @top_srcdir@
|
||||||
srcdir = @srcdir@
|
srcdir = @srcdir@
|
||||||
VPATH = @srcdir@
|
VPATH = @srcdir@
|
||||||
relativesrcdir = dom/imported-tests/webapps/DOMCore/tests/submissions/Opera
|
relativesrcdir = dom/tests/mochitest/w3c/webapps/DOMCore/tests/submissions/Opera
|
||||||
|
|
||||||
DIRS = \
|
DIRS = \
|
||||||
$(NULL)
|
$(NULL)
|
|
@ -77,6 +77,7 @@ USING_WORKERS_NAMESPACE
|
||||||
using mozilla::MutexAutoLock;
|
using mozilla::MutexAutoLock;
|
||||||
using mozilla::MutexAutoUnlock;
|
using mozilla::MutexAutoUnlock;
|
||||||
using mozilla::Preferences;
|
using mozilla::Preferences;
|
||||||
|
using namespace mozilla::xpconnect::memory;
|
||||||
|
|
||||||
// The size of the worker runtime heaps in bytes. May be changed via pref.
|
// The size of the worker runtime heaps in bytes. May be changed via pref.
|
||||||
#define WORKER_DEFAULT_RUNTIME_HEAPSIZE 32 * 1024 * 1024
|
#define WORKER_DEFAULT_RUNTIME_HEAPSIZE 32 * 1024 * 1024
|
||||||
|
@ -1336,8 +1337,8 @@ RuntimeService::AutoSafeJSContext::GetSafeContext()
|
||||||
nsIThreadJSContextStack* stack = nsContentUtils::ThreadJSContextStack();
|
nsIThreadJSContextStack* stack = nsContentUtils::ThreadJSContextStack();
|
||||||
NS_ASSERTION(stack, "This should never be null!");
|
NS_ASSERTION(stack, "This should never be null!");
|
||||||
|
|
||||||
JSContext* cx = stack->GetSafeJSContext();
|
JSContext* cx;
|
||||||
if (!cx) {
|
if (NS_FAILED(stack->GetSafeJSContext(&cx))) {
|
||||||
NS_ERROR("Couldn't get safe JSContext!");
|
NS_ERROR("Couldn't get safe JSContext!");
|
||||||
return nsnull;
|
return nsnull;
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,6 +100,7 @@ using mozilla::MutexAutoLock;
|
||||||
using mozilla::TimeDuration;
|
using mozilla::TimeDuration;
|
||||||
using mozilla::TimeStamp;
|
using mozilla::TimeStamp;
|
||||||
using mozilla::dom::workers::exceptions::ThrowDOMExceptionForCode;
|
using mozilla::dom::workers::exceptions::ThrowDOMExceptionForCode;
|
||||||
|
using mozilla::xpconnect::memory::ReportJSRuntimeExplicitTreeStats;
|
||||||
|
|
||||||
USING_WORKERS_NAMESPACE
|
USING_WORKERS_NAMESPACE
|
||||||
using namespace mozilla::dom::workers::events;
|
using namespace mozilla::dom::workers::events;
|
||||||
|
@ -262,8 +263,12 @@ public:
|
||||||
|
|
||||||
// Always report, even if we're disabled, so that we at least get an entry
|
// Always report, even if we're disabled, so that we at least get an entry
|
||||||
// in about::memory.
|
// in about::memory.
|
||||||
return xpc::ReportJSRuntimeExplicitTreeStats(rtStats, mPathPrefix,
|
rv = ReportJSRuntimeExplicitTreeStats(rtStats, mPathPrefix, aCallback, aClosure);
|
||||||
aCallback, aClosure);
|
if (NS_FAILED(rv)) {
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHOD
|
NS_IMETHOD
|
||||||
|
|
|
@ -59,10 +59,11 @@
|
||||||
#include "nsCRT.h"
|
#include "nsCRT.h"
|
||||||
|
|
||||||
//prototype
|
//prototype
|
||||||
nsresult GetListState(nsIHTMLEditor* aEditor, bool* aMixed,
|
nsresult GetListState(nsIEditor *aEditor, bool *aMixed, PRUnichar **tagStr);
|
||||||
nsAString& aLocalName);
|
nsresult RemoveOneProperty(nsIHTMLEditor *aEditor,const nsString& aProp,
|
||||||
nsresult RemoveOneProperty(nsIHTMLEditor* aEditor, const nsAString& aProp);
|
const nsString &aAttr);
|
||||||
nsresult RemoveTextProperty(nsIHTMLEditor* aEditor, const nsAString& aProp);
|
nsresult RemoveTextProperty(nsIEditor *aEditor, const PRUnichar *prop,
|
||||||
|
const PRUnichar *attr);
|
||||||
nsresult SetTextProperty(nsIEditor *aEditor, const PRUnichar *prop,
|
nsresult SetTextProperty(nsIEditor *aEditor, const PRUnichar *prop,
|
||||||
const PRUnichar *attr, const PRUnichar *value);
|
const PRUnichar *attr, const PRUnichar *value);
|
||||||
|
|
||||||
|
@ -263,26 +264,34 @@ nsStyleUpdatingCommand::ToggleState(nsIEditor *aEditor, const char* aTagName)
|
||||||
if (doTagRemoval) {
|
if (doTagRemoval) {
|
||||||
// Also remove equivalent properties (bug 317093)
|
// Also remove equivalent properties (bug 317093)
|
||||||
if (tagName.EqualsLiteral("b")) {
|
if (tagName.EqualsLiteral("b")) {
|
||||||
rv = RemoveTextProperty(htmlEditor, NS_LITERAL_STRING("strong"));
|
rv = RemoveTextProperty(aEditor, NS_LITERAL_STRING("strong").get(), nsnull);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
} else if (tagName.EqualsLiteral("i")) {
|
} else if (tagName.EqualsLiteral("i")) {
|
||||||
rv = RemoveTextProperty(htmlEditor, NS_LITERAL_STRING("em"));
|
rv = RemoveTextProperty(aEditor, NS_LITERAL_STRING("em").get(), nsnull);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
} else if (tagName.EqualsLiteral("strike")) {
|
} else if (tagName.EqualsLiteral("strike")) {
|
||||||
rv = RemoveTextProperty(htmlEditor, NS_LITERAL_STRING("s"));
|
rv = RemoveTextProperty(aEditor, NS_LITERAL_STRING("s").get(), nsnull);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = RemoveTextProperty(htmlEditor, tagName);
|
rv = RemoveTextProperty(aEditor, tagName.get(), nsnull);
|
||||||
} else {
|
} else {
|
||||||
// Superscript and Subscript styles are mutually exclusive
|
// Superscript and Subscript styles are mutually exclusive
|
||||||
|
nsAutoString removeName;
|
||||||
aEditor->BeginTransaction();
|
aEditor->BeginTransaction();
|
||||||
|
|
||||||
if (tagName.EqualsLiteral("sub") || tagName.EqualsLiteral("sup")) {
|
if (tagName.EqualsLiteral("sub"))
|
||||||
rv = RemoveTextProperty(htmlEditor, tagName);
|
{
|
||||||
|
removeName.AssignLiteral("sup");
|
||||||
|
rv = RemoveTextProperty(aEditor,tagName.get(), nsnull);
|
||||||
|
}
|
||||||
|
else if (tagName.EqualsLiteral("sup"))
|
||||||
|
{
|
||||||
|
removeName.AssignLiteral("sub");
|
||||||
|
rv = RemoveTextProperty(aEditor, tagName.get(), nsnull);
|
||||||
}
|
}
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
rv = SetTextProperty(aEditor, tagName.get(), nsnull, nsnull);
|
rv = SetTextProperty(aEditor,tagName.get(), nsnull, nsnull);
|
||||||
|
|
||||||
aEditor->EndTransaction();
|
aEditor->EndTransaction();
|
||||||
}
|
}
|
||||||
|
@ -300,19 +309,19 @@ nsListCommand::GetCurrentState(nsIEditor *aEditor, const char* aTagName,
|
||||||
nsICommandParams *aParams)
|
nsICommandParams *aParams)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(aEditor, "Need editor here");
|
NS_ASSERTION(aEditor, "Need editor here");
|
||||||
nsCOMPtr<nsIHTMLEditor> htmlEditor = do_QueryInterface(aEditor);
|
|
||||||
NS_ENSURE_TRUE(htmlEditor, NS_ERROR_NO_INTERFACE);
|
|
||||||
|
|
||||||
bool bMixed;
|
bool bMixed;
|
||||||
nsAutoString localName;
|
PRUnichar *tagStr;
|
||||||
nsresult rv = GetListState(htmlEditor, &bMixed, localName);
|
nsresult rv = GetListState(aEditor,&bMixed, &tagStr);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
// Need to use mTagName????
|
// Need to use mTagName????
|
||||||
bool inList = localName.EqualsASCII(mTagName);
|
bool inList = (0 == nsCRT::strcmp(tagStr,
|
||||||
|
NS_ConvertASCIItoUTF16(mTagName).get()));
|
||||||
aParams->SetBooleanValue(STATE_ALL, !bMixed && inList);
|
aParams->SetBooleanValue(STATE_ALL, !bMixed && inList);
|
||||||
aParams->SetBooleanValue(STATE_MIXED, bMixed);
|
aParams->SetBooleanValue(STATE_MIXED, bMixed);
|
||||||
aParams->SetBooleanValue(STATE_ENABLED, true);
|
aParams->SetBooleanValue(STATE_ENABLED, true);
|
||||||
|
if (tagStr) NS_Free(tagStr);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,24 +404,33 @@ nsListItemCommand::ToggleState(nsIEditor *aEditor, const char* aTagName)
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
if (inList) {
|
if (inList)
|
||||||
|
{
|
||||||
// To remove a list, first get what kind of list we're in
|
// To remove a list, first get what kind of list we're in
|
||||||
bool bMixed;
|
bool bMixed;
|
||||||
nsAutoString localName;
|
PRUnichar *tagStr;
|
||||||
rv = GetListState(htmlEditor, &bMixed, localName);
|
rv = GetListState(aEditor,&bMixed, &tagStr);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
if (localName.IsEmpty() || bMixed) {
|
if (tagStr)
|
||||||
return rv;
|
{
|
||||||
|
if (!bMixed)
|
||||||
|
{
|
||||||
|
rv = htmlEditor->RemoveList(nsDependentString(tagStr));
|
||||||
|
}
|
||||||
|
NS_Free(tagStr);
|
||||||
}
|
}
|
||||||
return htmlEditor->RemoveList(localName);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
nsAutoString itemType; itemType.AssignWithConversion(mTagName);
|
{
|
||||||
// Set to the requested paragraph type
|
nsAutoString itemType; itemType.AssignWithConversion(mTagName);
|
||||||
//XXX Note: This actually doesn't work for "LI",
|
// Set to the requested paragraph type
|
||||||
// but we currently don't use this for non DL lists anyway.
|
//XXX Note: This actually doesn't work for "LI",
|
||||||
// Problem: won't this replace any current block paragraph style?
|
// but we currently don't use this for non DL lists anyway.
|
||||||
return htmlEditor->SetParagraphFormat(itemType);
|
// Problem: won't this replace any current block paragraph style?
|
||||||
|
rv = htmlEditor->SetParagraphFormat(itemType);
|
||||||
|
}
|
||||||
|
|
||||||
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
@ -420,27 +438,28 @@ nsRemoveListCommand::IsCommandEnabled(const char * aCommandName,
|
||||||
nsISupports *refCon,
|
nsISupports *refCon,
|
||||||
bool *outCmdEnabled)
|
bool *outCmdEnabled)
|
||||||
{
|
{
|
||||||
*outCmdEnabled = false;
|
|
||||||
nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
|
nsCOMPtr<nsIEditor> editor = do_QueryInterface(refCon);
|
||||||
NS_ENSURE_TRUE(editor, NS_OK);
|
if (editor)
|
||||||
|
{
|
||||||
|
bool isEditable = false;
|
||||||
|
nsresult rv = editor->GetIsSelectionEditable(&isEditable);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
if (isEditable)
|
||||||
|
{
|
||||||
|
// It is enabled if we are in any list type
|
||||||
|
bool bMixed;
|
||||||
|
PRUnichar *tagStr;
|
||||||
|
nsresult rv = GetListState(editor, &bMixed, &tagStr);
|
||||||
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
bool isEditable = false;
|
*outCmdEnabled = bMixed ? true : (tagStr && *tagStr);
|
||||||
nsresult rv = editor->GetIsSelectionEditable(&isEditable);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
if (tagStr) NS_Free(tagStr);
|
||||||
if (!isEditable) {
|
return NS_OK;
|
||||||
return NS_OK;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// It is enabled if we are in any list type
|
*outCmdEnabled = false;
|
||||||
nsCOMPtr<nsIHTMLEditor> htmlEditor = do_QueryInterface(refCon);
|
|
||||||
NS_ENSURE_TRUE(htmlEditor, NS_ERROR_NO_INTERFACE);
|
|
||||||
|
|
||||||
bool bMixed;
|
|
||||||
nsAutoString localName;
|
|
||||||
rv = GetListState(htmlEditor, &bMixed, localName);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
*outCmdEnabled = bMixed || !localName.IsEmpty();
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1533,57 +1552,79 @@ nsInsertTagCommand::GetCommandStateParams(const char *aCommandName,
|
||||||
/****************************/
|
/****************************/
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
GetListState(nsIHTMLEditor* aEditor, bool* aMixed, nsAString& aLocalName)
|
GetListState(nsIEditor *aEditor, bool *aMixed, PRUnichar **_retval)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aEditor);
|
NS_ENSURE_TRUE(aMixed && _retval && aEditor, NS_ERROR_NULL_POINTER);
|
||||||
MOZ_ASSERT(aMixed);
|
*_retval = nsnull;
|
||||||
|
|
||||||
*aMixed = false;
|
*aMixed = false;
|
||||||
aLocalName.Truncate();
|
|
||||||
|
|
||||||
bool bOL, bUL, bDL;
|
nsCOMPtr<nsIHTMLEditor> htmlEditor = do_QueryInterface(aEditor);
|
||||||
nsresult rv = aEditor->GetListState(aMixed, &bOL, &bUL, &bDL);
|
nsresult err = NS_ERROR_NO_INTERFACE;
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
if (htmlEditor)
|
||||||
|
{
|
||||||
if (*aMixed) {
|
bool bOL, bUL, bDL;
|
||||||
return NS_OK;
|
err = htmlEditor->GetListState(aMixed, &bOL, &bUL, &bDL);
|
||||||
|
if (NS_SUCCEEDED(err))
|
||||||
|
{
|
||||||
|
if (!*aMixed)
|
||||||
|
{
|
||||||
|
nsAutoString tagStr;
|
||||||
|
if (bOL)
|
||||||
|
tagStr.AssignLiteral("ol");
|
||||||
|
else if (bUL)
|
||||||
|
tagStr.AssignLiteral("ul");
|
||||||
|
else if (bDL)
|
||||||
|
tagStr.AssignLiteral("dl");
|
||||||
|
*_retval = ToNewUnicode(tagStr);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return err;
|
||||||
if (bOL) {
|
|
||||||
aLocalName.AssignLiteral("ol");
|
|
||||||
} else if (bUL) {
|
|
||||||
aLocalName.AssignLiteral("ul");
|
|
||||||
} else if (bDL) {
|
|
||||||
aLocalName.AssignLiteral("dl");
|
|
||||||
}
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
RemoveOneProperty(nsIHTMLEditor* aEditor, const nsAString& aProp)
|
RemoveOneProperty(nsIHTMLEditor *aEditor,const nsString& aProp,
|
||||||
|
const nsString &aAttr)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aEditor);
|
NS_ENSURE_TRUE(aEditor, NS_ERROR_NOT_INITIALIZED);
|
||||||
|
|
||||||
/// XXX Hack alert! Look in nsIEditProperty.h for this
|
/// XXX Hack alert! Look in nsIEditProperty.h for this
|
||||||
nsCOMPtr<nsIAtom> styleAtom = do_GetAtom(aProp);
|
nsCOMPtr<nsIAtom> styleAtom = do_GetAtom(aProp);
|
||||||
NS_ENSURE_TRUE(styleAtom, NS_ERROR_OUT_OF_MEMORY);
|
NS_ENSURE_TRUE( styleAtom, NS_ERROR_OUT_OF_MEMORY);
|
||||||
|
|
||||||
return aEditor->RemoveInlineProperty(styleAtom, EmptyString());
|
return aEditor->RemoveInlineProperty(styleAtom, aAttr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// the name of the attribute here should be the contents of the appropriate
|
// the name of the attribute here should be the contents of the appropriate
|
||||||
// tag, e.g. 'b' for bold, 'i' for italics.
|
// tag, e.g. 'b' for bold, 'i' for italics.
|
||||||
nsresult
|
nsresult
|
||||||
RemoveTextProperty(nsIHTMLEditor* aEditor, const nsAString& aProp)
|
RemoveTextProperty(nsIEditor *aEditor, const PRUnichar *prop,
|
||||||
|
const PRUnichar *attr)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aEditor);
|
NS_ENSURE_TRUE(aEditor, NS_ERROR_NOT_INITIALIZED);
|
||||||
|
nsCOMPtr<nsIHTMLEditor> editor = do_QueryInterface(aEditor);
|
||||||
|
NS_ENSURE_TRUE(editor, NS_ERROR_INVALID_ARG);
|
||||||
|
// OK, I'm really hacking now. This is just so that
|
||||||
|
// we can accept 'all' as input.
|
||||||
|
nsAutoString allStr(prop);
|
||||||
|
|
||||||
|
ToLowerCase(allStr);
|
||||||
|
bool doingAll = (allStr.EqualsLiteral("all"));
|
||||||
|
nsresult err = NS_OK;
|
||||||
|
|
||||||
if (aProp.LowerCaseEqualsLiteral("all")) {
|
if (doingAll)
|
||||||
return aEditor->RemoveAllInlineProperties();
|
{
|
||||||
|
err = editor->RemoveAllInlineProperties();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
nsAutoString aProp(prop);
|
||||||
|
nsAutoString aAttr(attr);
|
||||||
|
err = RemoveOneProperty(editor,aProp, aAttr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return RemoveOneProperty(aEditor, aProp);
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
// the name of the attribute here should be the contents of the appropriate
|
// the name of the attribute here should be the contents of the appropriate
|
||||||
|
|
|
@ -685,41 +685,41 @@ nsHTMLEditRules::GetListState(bool *aMixed, bool *aOL, bool *aUL, bool *aDL)
|
||||||
nsresult res = GetListActionNodes(arrayOfNodes, false, true);
|
nsresult res = GetListActionNodes(arrayOfNodes, false, true);
|
||||||
NS_ENSURE_SUCCESS(res, res);
|
NS_ENSURE_SUCCESS(res, res);
|
||||||
|
|
||||||
// Examine list type for nodes in selection.
|
// examine list type for nodes in selection
|
||||||
PRInt32 listCount = arrayOfNodes.Count();
|
PRInt32 listCount = arrayOfNodes.Count();
|
||||||
for (PRInt32 i = listCount - 1; i >= 0; --i) {
|
PRInt32 i;
|
||||||
nsIDOMNode* curDOMNode = arrayOfNodes[i];
|
for (i=listCount-1; i>=0; i--)
|
||||||
nsCOMPtr<dom::Element> curElement = do_QueryInterface(curDOMNode);
|
{
|
||||||
|
nsIDOMNode* curNode = arrayOfNodes[i];
|
||||||
if (!curElement) {
|
|
||||||
bNonList = true;
|
if (nsHTMLEditUtils::IsUnorderedList(curNode))
|
||||||
} else if (curElement->IsHTML(nsGkAtoms::ul)) {
|
|
||||||
*aUL = true;
|
*aUL = true;
|
||||||
} else if (curElement->IsHTML(nsGkAtoms::ol)) {
|
else if (nsHTMLEditUtils::IsOrderedList(curNode))
|
||||||
*aOL = true;
|
*aOL = true;
|
||||||
} else if (curElement->IsHTML(nsGkAtoms::li)) {
|
else if (nsEditor::NodeIsType(curNode, nsEditProperty::li))
|
||||||
if (nsINode* parent = curElement->GetElementParent()) {
|
{
|
||||||
if (parent->AsElement()->IsHTML(nsGkAtoms::ul)) {
|
nsCOMPtr<nsIDOMNode> parent;
|
||||||
*aUL = true;
|
PRInt32 offset;
|
||||||
} else if (parent->AsElement()->IsHTML(nsGkAtoms::ol)) {
|
res = nsEditor::GetNodeLocation(curNode, address_of(parent), &offset);
|
||||||
*aOL = true;
|
NS_ENSURE_SUCCESS(res, res);
|
||||||
}
|
if (nsHTMLEditUtils::IsUnorderedList(parent))
|
||||||
}
|
*aUL = true;
|
||||||
} else if (curElement->IsHTML(nsGkAtoms::dl) ||
|
else if (nsHTMLEditUtils::IsOrderedList(parent))
|
||||||
curElement->IsHTML(nsGkAtoms::dt) ||
|
*aOL = true;
|
||||||
curElement->IsHTML(nsGkAtoms::dd)) {
|
|
||||||
*aDL = true;
|
|
||||||
} else {
|
|
||||||
bNonList = true;
|
|
||||||
}
|
}
|
||||||
|
else if (nsEditor::NodeIsType(curNode, nsEditProperty::dl) ||
|
||||||
|
nsEditor::NodeIsType(curNode, nsEditProperty::dt) ||
|
||||||
|
nsEditor::NodeIsType(curNode, nsEditProperty::dd) )
|
||||||
|
{
|
||||||
|
*aDL = true;
|
||||||
|
}
|
||||||
|
else bNonList = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// hokey arithmetic with booleans
|
// hokey arithmetic with booleans
|
||||||
if ((*aUL + *aOL + *aDL + bNonList) > 1) {
|
if ( (*aUL + *aOL + *aDL + bNonList) > 1) *aMixed = true;
|
||||||
*aMixed = true;
|
|
||||||
}
|
return res;
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
|
|
|
@ -4209,30 +4209,29 @@ nsHTMLEditor::RemoveBlockContainer(nsIDOMNode *inNode)
|
||||||
// GetPriorHTMLSibling: returns the previous editable sibling, if there is
|
// GetPriorHTMLSibling: returns the previous editable sibling, if there is
|
||||||
// one within the parent
|
// one within the parent
|
||||||
//
|
//
|
||||||
nsINode*
|
|
||||||
nsHTMLEditor::GetPriorHTMLSibling(nsINode* aNode)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(aNode);
|
|
||||||
|
|
||||||
nsIContent* node = aNode->GetPreviousSibling();
|
|
||||||
while (node && !IsEditable(node)) {
|
|
||||||
node = node->GetPreviousSibling();
|
|
||||||
}
|
|
||||||
|
|
||||||
return node;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsHTMLEditor::GetPriorHTMLSibling(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode)
|
nsHTMLEditor::GetPriorHTMLSibling(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode)
|
||||||
{
|
{
|
||||||
NS_ENSURE_TRUE(outNode, NS_ERROR_NULL_POINTER);
|
NS_ENSURE_TRUE(outNode && inNode, NS_ERROR_NULL_POINTER);
|
||||||
*outNode = NULL;
|
nsresult res = NS_OK;
|
||||||
|
*outNode = nsnull;
|
||||||
nsCOMPtr<nsINode> node = do_QueryInterface(inNode);
|
nsCOMPtr<nsIDOMNode> temp, node = do_QueryInterface(inNode);
|
||||||
NS_ENSURE_TRUE(node, NS_ERROR_NULL_POINTER);
|
|
||||||
|
while (1)
|
||||||
*outNode = do_QueryInterface(GetPriorHTMLSibling(node));
|
{
|
||||||
return NS_OK;
|
res = node->GetPreviousSibling(getter_AddRefs(temp));
|
||||||
|
NS_ENSURE_SUCCESS(res, res);
|
||||||
|
if (!temp) {
|
||||||
|
// return null sibling
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
// if it's editable, we're done
|
||||||
|
if (IsEditable(temp)) break;
|
||||||
|
// otherwise try again
|
||||||
|
node = temp;
|
||||||
|
}
|
||||||
|
*outNode = temp;
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -4242,30 +4241,23 @@ nsHTMLEditor::GetPriorHTMLSibling(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outN
|
||||||
// one within the parent. just like above routine but
|
// one within the parent. just like above routine but
|
||||||
// takes a parent/offset instead of a node.
|
// takes a parent/offset instead of a node.
|
||||||
//
|
//
|
||||||
nsINode*
|
|
||||||
nsHTMLEditor::GetPriorHTMLSibling(nsINode* aParent, PRInt32 aOffset)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(aParent);
|
|
||||||
|
|
||||||
nsIContent* node = aParent->GetChildAt(aOffset - 1);
|
|
||||||
if (!node || IsEditable(node)) {
|
|
||||||
return node;
|
|
||||||
}
|
|
||||||
|
|
||||||
return GetPriorHTMLSibling(node);
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsHTMLEditor::GetPriorHTMLSibling(nsIDOMNode *inParent, PRInt32 inOffset, nsCOMPtr<nsIDOMNode> *outNode)
|
nsHTMLEditor::GetPriorHTMLSibling(nsIDOMNode *inParent, PRInt32 inOffset, nsCOMPtr<nsIDOMNode> *outNode)
|
||||||
{
|
{
|
||||||
NS_ENSURE_TRUE(outNode, NS_ERROR_NULL_POINTER);
|
NS_ENSURE_TRUE(outNode && inParent, NS_ERROR_NULL_POINTER);
|
||||||
*outNode = NULL;
|
nsresult res = NS_OK;
|
||||||
|
*outNode = nsnull;
|
||||||
nsCOMPtr<nsINode> parent = do_QueryInterface(inParent);
|
if (inOffset <= 0) {
|
||||||
NS_ENSURE_TRUE(parent, NS_ERROR_NULL_POINTER);
|
// return null sibling if at offset zero
|
||||||
|
return NS_OK;
|
||||||
*outNode = do_QueryInterface(GetPriorHTMLSibling(parent, inOffset));
|
}
|
||||||
return NS_OK;
|
nsCOMPtr<nsIDOMNode> node = nsEditor::GetChildAt(inParent,inOffset-1);
|
||||||
|
if (node && IsEditable(node)) {
|
||||||
|
*outNode = node;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
// else
|
||||||
|
return GetPriorHTMLSibling(node, outNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -4274,30 +4266,29 @@ nsHTMLEditor::GetPriorHTMLSibling(nsIDOMNode *inParent, PRInt32 inOffset, nsCOMP
|
||||||
// GetNextHTMLSibling: returns the next editable sibling, if there is
|
// GetNextHTMLSibling: returns the next editable sibling, if there is
|
||||||
// one within the parent
|
// one within the parent
|
||||||
//
|
//
|
||||||
nsINode*
|
|
||||||
nsHTMLEditor::GetNextHTMLSibling(nsINode* aNode)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(aNode);
|
|
||||||
|
|
||||||
nsIContent* node = aNode->GetNextSibling();
|
|
||||||
while (node && !IsEditable(node)) {
|
|
||||||
node = node->GetNextSibling();
|
|
||||||
}
|
|
||||||
|
|
||||||
return node;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsHTMLEditor::GetNextHTMLSibling(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode)
|
nsHTMLEditor::GetNextHTMLSibling(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode)
|
||||||
{
|
{
|
||||||
NS_ENSURE_TRUE(outNode, NS_ERROR_NULL_POINTER);
|
NS_ENSURE_TRUE(outNode, NS_ERROR_NULL_POINTER);
|
||||||
|
nsresult res = NS_OK;
|
||||||
*outNode = nsnull;
|
*outNode = nsnull;
|
||||||
|
nsCOMPtr<nsIDOMNode> temp, node = do_QueryInterface(inNode);
|
||||||
nsCOMPtr<nsINode> node = do_QueryInterface(inNode);
|
|
||||||
NS_ENSURE_TRUE(node, NS_ERROR_NULL_POINTER);
|
|
||||||
|
|
||||||
*outNode = do_QueryInterface(GetNextHTMLSibling(node));
|
while (1)
|
||||||
return NS_OK;
|
{
|
||||||
|
res = node->GetNextSibling(getter_AddRefs(temp));
|
||||||
|
NS_ENSURE_SUCCESS(res, res);
|
||||||
|
if (!temp) {
|
||||||
|
// return null sibling
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
// if it's editable, we're done
|
||||||
|
if (IsEditable(temp)) break;
|
||||||
|
// otherwise try again
|
||||||
|
node = temp;
|
||||||
|
}
|
||||||
|
*outNode = temp;
|
||||||
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -4306,30 +4297,24 @@ nsHTMLEditor::GetNextHTMLSibling(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNo
|
||||||
// GetNextHTMLSibling: returns the next editable sibling, if there is
|
// GetNextHTMLSibling: returns the next editable sibling, if there is
|
||||||
// one within the parent. just like above routine but
|
// one within the parent. just like above routine but
|
||||||
// takes a parent/offset instead of a node.
|
// takes a parent/offset instead of a node.
|
||||||
nsINode*
|
//
|
||||||
nsHTMLEditor::GetNextHTMLSibling(nsINode* aParent, PRInt32 aOffset)
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(aParent);
|
|
||||||
|
|
||||||
nsIContent* node = aParent->GetChildAt(aOffset + 1);
|
|
||||||
if (!node || IsEditable(node)) {
|
|
||||||
return node;
|
|
||||||
}
|
|
||||||
|
|
||||||
return GetNextHTMLSibling(node);
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsHTMLEditor::GetNextHTMLSibling(nsIDOMNode *inParent, PRInt32 inOffset, nsCOMPtr<nsIDOMNode> *outNode)
|
nsHTMLEditor::GetNextHTMLSibling(nsIDOMNode *inParent, PRInt32 inOffset, nsCOMPtr<nsIDOMNode> *outNode)
|
||||||
{
|
{
|
||||||
NS_ENSURE_TRUE(outNode, NS_ERROR_NULL_POINTER);
|
NS_ENSURE_TRUE(outNode && inParent, NS_ERROR_NULL_POINTER);
|
||||||
*outNode = NULL;
|
nsresult res = NS_OK;
|
||||||
|
*outNode = nsnull;
|
||||||
nsCOMPtr<nsINode> parent = do_QueryInterface(inParent);
|
nsCOMPtr<nsIDOMNode> node = nsEditor::GetChildAt(inParent, inOffset + 1);
|
||||||
NS_ENSURE_TRUE(parent, NS_ERROR_NULL_POINTER);
|
if (!node) {
|
||||||
|
// return null sibling if no sibling
|
||||||
*outNode = do_QueryInterface(GetNextHTMLSibling(parent, inOffset));
|
return NS_OK;
|
||||||
return NS_OK;
|
}
|
||||||
|
if (node && IsEditable(node)) {
|
||||||
|
*outNode = node;
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
// else
|
||||||
|
return GetNextHTMLSibling(node, outNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -720,13 +720,9 @@ protected:
|
||||||
bool IsOnlyAttribute(nsIDOMNode *aElement, const nsAString *aAttribute);
|
bool IsOnlyAttribute(nsIDOMNode *aElement, const nsAString *aAttribute);
|
||||||
|
|
||||||
nsresult RemoveBlockContainer(nsIDOMNode *inNode);
|
nsresult RemoveBlockContainer(nsIDOMNode *inNode);
|
||||||
nsINode* GetPriorHTMLSibling(nsINode* aNode);
|
|
||||||
nsresult GetPriorHTMLSibling(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode);
|
nsresult GetPriorHTMLSibling(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode);
|
||||||
nsINode* GetPriorHTMLSibling(nsINode* aParent, PRInt32 aOffset);
|
|
||||||
nsresult GetPriorHTMLSibling(nsIDOMNode *inParent, PRInt32 inOffset, nsCOMPtr<nsIDOMNode> *outNode);
|
nsresult GetPriorHTMLSibling(nsIDOMNode *inParent, PRInt32 inOffset, nsCOMPtr<nsIDOMNode> *outNode);
|
||||||
nsINode* GetNextHTMLSibling(nsINode* aNode);
|
|
||||||
nsresult GetNextHTMLSibling(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode);
|
nsresult GetNextHTMLSibling(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode);
|
||||||
nsINode* GetNextHTMLSibling(nsINode* aParent, PRInt32 aOffset);
|
|
||||||
nsresult GetNextHTMLSibling(nsIDOMNode *inParent, PRInt32 inOffset, nsCOMPtr<nsIDOMNode> *outNode);
|
nsresult GetNextHTMLSibling(nsIDOMNode *inParent, PRInt32 inOffset, nsCOMPtr<nsIDOMNode> *outNode);
|
||||||
nsresult GetPriorHTMLNode(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode, bool bNoBlockCrossing = false);
|
nsresult GetPriorHTMLNode(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode, bool bNoBlockCrossing = false);
|
||||||
nsresult GetPriorHTMLNode(nsIDOMNode *inParent, PRInt32 inOffset, nsCOMPtr<nsIDOMNode> *outNode, bool bNoBlockCrossing = false);
|
nsresult GetPriorHTMLNode(nsIDOMNode *inParent, PRInt32 inOffset, nsCOMPtr<nsIDOMNode> *outNode, bool bNoBlockCrossing = false);
|
||||||
|
|
|
@ -306,10 +306,10 @@ nsresult JSContextAutoPopper::Push(JSContext *cx)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
mService = do_GetService(sJSStackContractID);
|
mService = do_GetService(sJSStackContractID);
|
||||||
if (mService) {
|
if(mService) {
|
||||||
// Get the safe context if we're not provided one.
|
// Get the safe context if we're not provided one.
|
||||||
if (!cx) {
|
if (!cx && NS_FAILED(mService->GetSafeJSContext(&cx))) {
|
||||||
cx = mService->GetSafeJSContext();
|
cx = nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Save cx in mContext to indicate need to pop.
|
// Save cx in mContext to indicate need to pop.
|
||||||
|
|
|
@ -94,7 +94,7 @@ struct ScopedXFreePtrTraits
|
||||||
static T *empty() { return NULL; }
|
static T *empty() { return NULL; }
|
||||||
static void release(T *ptr) { if (ptr!=NULL) XFree(ptr); }
|
static void release(T *ptr) { if (ptr!=NULL) XFree(ptr); }
|
||||||
};
|
};
|
||||||
SCOPED_TEMPLATE(ScopedXFree, ScopedXFreePtrTraits)
|
SCOPED_TEMPLATE(ScopedXFree, ScopedXFreePtrTraits);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* On construction, set a graceful X error handler that doesn't crash the application and records X errors.
|
* On construction, set a graceful X error handler that doesn't crash the application and records X errors.
|
||||||
|
|
|
@ -1015,8 +1015,6 @@ struct JSContext : js::ContextFriendFields
|
||||||
js::LifoAlloc &tempLifoAlloc() { return runtime->tempLifoAlloc; }
|
js::LifoAlloc &tempLifoAlloc() { return runtime->tempLifoAlloc; }
|
||||||
inline js::LifoAlloc &typeLifoAlloc();
|
inline js::LifoAlloc &typeLifoAlloc();
|
||||||
|
|
||||||
inline js::PropertyTree &propertyTree();
|
|
||||||
|
|
||||||
#ifdef JS_THREADSAFE
|
#ifdef JS_THREADSAFE
|
||||||
unsigned outstandingRequests;/* number of JS_BeginRequest calls
|
unsigned outstandingRequests;/* number of JS_BeginRequest calls
|
||||||
without the corresponding
|
without the corresponding
|
||||||
|
|
|
@ -505,12 +505,6 @@ JSContext::ensureParseMapPool()
|
||||||
return parseMapPool_;
|
return parseMapPool_;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline js::PropertyTree&
|
|
||||||
JSContext::propertyTree()
|
|
||||||
{
|
|
||||||
return compartment->propertyTree;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get the current frame, first lazily instantiating stack frames if needed. */
|
/* Get the current frame, first lazily instantiating stack frames if needed. */
|
||||||
static inline js::StackFrame *
|
static inline js::StackFrame *
|
||||||
js_GetTopStackFrame(JSContext *cx, FrameExpandKind expand)
|
js_GetTopStackFrame(JSContext *cx, FrameExpandKind expand)
|
||||||
|
|
|
@ -471,6 +471,8 @@ struct JSCompartment
|
||||||
js::DebugScriptMap *debugScriptMap;
|
js::DebugScriptMap *debugScriptMap;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define JS_PROPERTY_TREE(cx) ((cx)->compartment->propertyTree)
|
||||||
|
|
||||||
namespace js {
|
namespace js {
|
||||||
static inline MathCache *
|
static inline MathCache *
|
||||||
GetMathCache(JSContext *cx)
|
GetMathCache(JSContext *cx)
|
||||||
|
|
|
@ -87,7 +87,6 @@
|
||||||
|
|
||||||
#include "jsarrayinlines.h"
|
#include "jsarrayinlines.h"
|
||||||
#include "jsatominlines.h"
|
#include "jsatominlines.h"
|
||||||
#include "jscntxtinlines.h"
|
|
||||||
#include "jsinterpinlines.h"
|
#include "jsinterpinlines.h"
|
||||||
#include "jsobjinlines.h"
|
#include "jsobjinlines.h"
|
||||||
#include "jsscopeinlines.h"
|
#include "jsscopeinlines.h"
|
||||||
|
@ -2546,9 +2545,9 @@ JSObject::sealOrFreeze(JSContext *cx, ImmutabilityType it)
|
||||||
if (!JSID_IS_EMPTY(child.propid))
|
if (!JSID_IS_EMPTY(child.propid))
|
||||||
MarkTypePropertyConfigured(cx, self, child.propid);
|
MarkTypePropertyConfigured(cx, self, child.propid);
|
||||||
|
|
||||||
last = cx->propertyTree().getChild(cx, last, self->numFixedSlots(), child);
|
last = JS_PROPERTY_TREE(cx).getChild(cx, last, self->numFixedSlots(), child);
|
||||||
if (!last)
|
if (!last)
|
||||||
return false;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
JS_ASSERT(self->lastProperty()->slotSpan() == last->slotSpan());
|
JS_ASSERT(self->lastProperty()->slotSpan() == last->slotSpan());
|
||||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче