Backout volkmar's push for breaking Windows builds

This commit is contained in:
Ehsan Akhgari 2011-07-20 15:49:16 -04:00
Родитель cfde7f3f39
Коммит 10e0951fce
31 изменённых файлов: 220 добавлений и 490 удалений

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

@ -69,7 +69,6 @@
#include "nsIAnimationFrameListener.h"
#include "nsEventStates.h"
#include "nsIStructuredCloneContainer.h"
#include "nsDOMMemoryReporter.h"
class nsIContent;
class nsPresContext;
@ -150,7 +149,6 @@ public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOCUMENT_IID)
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
NS_DECL_DOM_MEMORY_REPORTER_SIZEOF
#ifdef MOZILLA_INTERNAL_API
nsIDocument()
@ -1533,6 +1531,8 @@ public:
#undef DEPRECATED_OPERATION
void WarnOnceAbout(DeprecatedOperations aOperation);
PRInt64 SizeOf() const;
private:
PRUint32 mWarnedAbout;

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

@ -43,7 +43,6 @@
#include "nsGenericDOMDataNode.h"
#include "nsCOMPtr.h"
#include "nsIDocument.h"
#include "nsDOMMemoryReporter.h"
class nsCommentNode : public nsGenericDOMDataNode,
public nsIDOMComment
@ -61,10 +60,6 @@ public:
// nsIDOMCharacterData
NS_FORWARD_NSIDOMCHARACTERDATA(nsGenericDOMDataNode::)
// DOM Memory Reporter participant.
NS_DECL_AND_IMPL_DOM_MEMORY_REPORTER_SIZEOF(nsCommentNode,
nsGenericDOMDataNode)
// nsIDOMComment
// Empty interface

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

@ -8383,11 +8383,3 @@ nsIDocument::SizeOf() const
return size;
}
PRInt64
nsDocument::SizeOf() const
{
PRInt64 size = MemoryReporter::GetBasicSize<nsDocument, nsIDocument>(this);
size += mAttrStyleSheet ? mAttrStyleSheet->SizeOf() : 0;
return size;
}

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

@ -499,7 +499,6 @@ public:
typedef mozilla::dom::Element Element;
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_DOM_MEMORY_REPORTER_SIZEOF
using nsINode::GetScriptTypeID;

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

@ -67,7 +67,7 @@
#include "pldhash.h"
#include "prprf.h"
using namespace mozilla;
namespace css = mozilla::css;
nsGenericDOMDataNode::nsGenericDOMDataNode(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsIContent(aNodeInfo)
@ -1065,13 +1065,3 @@ nsGenericDOMDataNode::GetClassAttributeName() const
{
return nsnull;
}
PRInt64
nsGenericDOMDataNode::SizeOf() const
{
PRInt64 size = dom::MemoryReporter::GetBasicSize<nsGenericDOMDataNode,
nsIContent>(this);
size += mText.SizeOf() - sizeof(mText);
return size;
}

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

@ -51,7 +51,6 @@
#include "nsGenericElement.h"
#include "nsCycleCollectionParticipant.h"
#include "nsContentUtils.h"
#include "nsDOMMemoryReporter.h"
#ifdef MOZ_SMIL
#include "nsISMILAttr.h"
@ -85,8 +84,6 @@ class nsGenericDOMDataNode : public nsIContent
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_DOM_MEMORY_REPORTER_SIZEOF
nsGenericDOMDataNode(already_AddRefed<nsINodeInfo> aNodeInfo);
virtual ~nsGenericDOMDataNode();

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

@ -46,7 +46,6 @@
#define NS_MAPPEDATTRIBUTEELEMENT_H_
#include "nsStyledElement.h"
#include "nsDOMMemoryReporter.h"
class nsMappedAttributes;
struct nsRuleData;
@ -66,9 +65,6 @@ protected:
{}
public:
NS_DECL_AND_IMPL_DOM_MEMORY_REPORTER_SIZEOF(nsMappedAttributeElement,
nsMappedAttributeElementBase)
virtual nsresult BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsIContent* aBindingParent,
PRBool aCompileEventHandlers);

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

@ -108,12 +108,6 @@ public:
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
PRInt64 SizeOf() const {
NS_ASSERTION(mAttrCount == mBufferSize,
"mBufferSize and mAttrCount are expected to be the same.");
return sizeof(*this) - sizeof(void*) + mAttrCount * sizeof(InternalAttr);
}
private:
nsMappedAttributes(const nsMappedAttributes& aCopy);
~nsMappedAttributes();

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

@ -48,7 +48,6 @@
#include "nsString.h"
#include "nsGenericElement.h"
#include "nsDOMMemoryReporter.h"
namespace mozilla {
namespace css {
@ -69,9 +68,6 @@ protected:
public:
NS_DECL_AND_IMPL_DOM_MEMORY_REPORTER_SIZEOF(nsStyledElementNotElementCSSInlineStyle,
nsStyledElementBase)
// nsIContent interface methods
virtual nsIAtom* GetClassAttributeName() const;
virtual nsIAtom* GetIDAttributeName() const;
@ -119,10 +115,6 @@ protected:
};
class nsStyledElement : public nsStyledElementNotElementCSSInlineStyle {
public:
NS_DECL_AND_IMPL_DOM_MEMORY_REPORTER_SIZEOF(nsStyledElement,
nsStyledElementNotElementCSSInlineStyle)
protected:
inline nsStyledElement(already_AddRefed<nsINodeInfo> aNodeInfo)
: nsStyledElementNotElementCSSInlineStyle(aNodeInfo)

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

@ -47,8 +47,6 @@
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsTraceRefcnt.h"
#include "nsDOMMemoryReporter.h"
class nsString;
class nsCString;
@ -81,7 +79,7 @@ class nsCString;
* This class does not have a virtual destructor therefore it is not
* meant to be subclassed.
*/
class NS_FINAL_CLASS nsTextFragment {
class nsTextFragment {
public:
static nsresult Init();
static void Shutdown();
@ -226,17 +224,6 @@ public:
PRUint32 mLength : 29;
};
/**
* Returns the size taken in memory by this text fragment.
* @return the size taken in memory by this text fragment.
*/
PRInt64 SizeOf() const
{
PRInt64 size = sizeof(*this);
size += GetLength() * Is2b() ? sizeof(*m2b) : sizeof(*m1b);
return size;
}
private:
void ReleaseText();

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

@ -47,7 +47,6 @@
#include "nsIAttribute.h"
#include "nsIDocument.h"
#include "nsThreadUtils.h"
#include "nsDOMMemoryReporter.h"
/**
* Class used to implement DOM text nodes
@ -71,9 +70,6 @@ public:
// nsIDOMText
NS_FORWARD_NSIDOMTEXT(nsGenericDOMDataNode::)
// DOM Memory Reporter participant.
NS_DECL_AND_IMPL_DOM_MEMORY_REPORTER_SIZEOF(nsTextNode, nsGenericDOMDataNode)
// nsINode
virtual PRBool IsNodeOfType(PRUint32 aFlags) const;

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

@ -3228,16 +3228,6 @@ nsGenericHTMLFrameElement::CopyInnerTo(nsGenericElement* aDest) const
return rv;
}
PRInt64
nsGenericHTMLFrameElement::SizeOf() const
{
PRInt64 size = MemoryReporter::GetBasicSize<nsGenericHTMLFrameElement,
nsGenericHTMLElement>(this);
// TODO: need to implement SizeOf() in nsFrameLoader, bug 672539.
size += mFrameLoader ? sizeof(*mFrameLoader.get()) : 0;
return size;
}
//----------------------------------------------------------------------
nsresult

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

@ -46,7 +46,6 @@
#include "nsFrameLoader.h"
#include "nsGkAtoms.h"
#include "nsContentCreatorFunctions.h"
#include "nsDOMMemoryReporter.h"
class nsIDOMAttr;
class nsIDOMEventListener;
@ -82,9 +81,6 @@ public:
"Unexpected namespace");
}
NS_DECL_AND_IMPL_DOM_MEMORY_REPORTER_SIZEOF(nsGenericHTMLElement,
nsGenericHTMLElementBase)
/** Typesafe, non-refcounting cast from nsIContent. Cheaper than QI. **/
static nsGenericHTMLElement* FromContent(nsIContent *aContent)
{
@ -824,9 +820,6 @@ public:
nsGenericHTMLFormElement(already_AddRefed<nsINodeInfo> aNodeInfo);
virtual ~nsGenericHTMLFormElement();
NS_DECL_AND_IMPL_DOM_MEMORY_REPORTER_SIZEOF(nsGenericHTMLFormElement,
nsGenericHTMLElement)
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
virtual PRBool IsNodeOfType(PRUint32 aFlags) const;
@ -1013,8 +1006,6 @@ public:
}
virtual ~nsGenericHTMLFrameElement();
NS_DECL_DOM_MEMORY_REPORTER_SIZEOF
// nsISupports
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);

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

@ -72,6 +72,7 @@ _TEST_FILES = \
test_bug3348.html \
test_bug6296.html \
test_bug24958.html \
test_bug41464.html \
bug100533_load.html \
bug100533_iframe.html \
test_bug100533.html \
@ -178,6 +179,7 @@ _TEST_FILES = \
test_bug529859.html \
test_bug535043.html \
test_bug547850.html \
test_bug457800.html \
test_bug536891.html \
test_bug536895.html \
test_bug458037.xhtml \

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

@ -75,6 +75,7 @@ function checkFormNoValidateAttribute(aElementName)
"formnovalidate attribute should be disabled");
}
checkFormNoValidateAttribute('input');
checkFormNoValidateAttribute('button');
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');

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

@ -40,30 +40,11 @@ reflectLimitedEnumerated({
invalidValues: [ "", "default", "foo", "tulip" ],
});
// .autofocus
reflectBoolean({
element: document.createElement("input"),
attribute: "autofocus",
});
// .defaultChecked
reflectBoolean({
element: document.createElement("input"),
attribute: { idl: "defaultChecked", content: "checked" },
});
// .checked doesn't reflect a content attribute.
// .dirName
todo("dirName" in document.createElement("input"),
"dirName isn't implemented yet");
// .disabled
reflectBoolean({
element: document.createElement("input"),
attribute: "disabled",
});
// TODO: autofocus (boolean)
// TODO: defaultChecked (boolean)
// TODO: checked (boolean)
// TODO: dirName (not implemented)
// TODO: disabled (boolean)
// TODO: form (HTMLFormElement)
// TODO: files (FileList)
// TODO: formAction (URL)
@ -87,11 +68,7 @@ reflectLimitedEnumerated({
defaultValue: "get"
});
// .formNoValidate
reflectBoolean({
element: document.createElement("input"),
attribute: "formNoValidate",
});
// TODO: formNoValidate (boolean)
// .formTarget
reflectString({
@ -101,24 +78,12 @@ reflectString({
});
// TODO: height (non-negative integer)
// .indeterminate doesn't reflect a content attribute.
// TODO: indeterminate (boolean)
// TODO: list (HTMLElement)
// .max
todo("max" in document.createElement("input"), "max isn't implemented yet");
// TODO: max (not implemented)
// TODO: maxLength (long)
// .min
todo("min" in document.createElement("input"), "min isn't implemented yet");
// .multiple
reflectBoolean({
element: document.createElement("input"),
attribute: "multiple",
});
// TODO: min (not implemented)
// TODO: multiple (boolean)
// .name
reflectString({
@ -141,17 +106,8 @@ reflectString({
otherValues: [ "foo\nbar", "foo\rbar", "foo\r\nbar" ],
});
// .readOnly
reflectBoolean({
element: document.createElement("input"),
attribute: "readOnly",
});
// .required
reflectBoolean({
element: document.createElement("input"),
attribute: "required",
});
// TODO: readOnly (boolean)
// TODO: required (boolean)
// .size
reflectUnsignedInt({
@ -162,9 +118,7 @@ reflectUnsignedInt({
});
// TODO: src (URL)
// .step
todo("step" in document.createElement("input"), "step isn't implemented yet");
// TODO: step (not implemented)
// .type
reflectLimitedEnumerated({
@ -187,21 +141,10 @@ reflectString({
});
// .value doesn't reflect a content attribute.
// .valueAsDate
todo("valueAsDate" in document.createElement("input"),
"valueAsDate isn't implemented yet");
// .valueAsNumber
todo("valueAsNumber" in document.createElement("input"),
"valueAsNumber isn't implemented yet");
// .selectedOption
todo("selectedOption" in document.createElement("input"),
"selectedOption isn't implemented yet");
// TODO: valueAsDate (not implemented)
// TODO: valueAsNumber (not implemented)
// TODO: selectedOption (not implemented)
// TODO: width (non-negative integer)
// .willValidate doesn't reflect a content attribute.
// .validity doesn't reflect a content attribute.
// .validationMessage doesn't reflect a content attribute.

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

@ -26,6 +26,31 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=345822
/** Test for Bug 345822 **/
function checkRequiredAttribute(element)
{
ok('required' in element, "Element should have the required attribute");
ok(!element.required, "Element required attribute should be disabled");
is(element.getAttribute('required'), null,
"Element required attribute should be disabled");
element.required = true;
ok(element.required, "Element required attribute should be enabled");
isnot(element.getAttribute('required'), null,
"Element required attribute should be enabled");
element.removeAttribute('required');
element.setAttribute('required', '');
ok(element.required, "Element required attribute should be enabled");
isnot(element.getAttribute('required'), null,
"Element required attribute should be enabled");
element.removeAttribute('required');
ok(!element.required, "Element required attribute should be disabled");
is(element.getAttribute('required'), null,
"Element required attribute should be disabled");
}
function checkNotSufferingFromBeingMissing(element, doNotApply)
{
ok(!element.validity.valueMissing,
@ -299,8 +324,12 @@ function checkInputRequiredValidityForFile()
document.forms[0].removeChild(element);
}
checkRequiredAttribute(document.createElement('textarea'));
checkTextareaRequiredValidity();
// Every input element should have the required attribute.
checkRequiredAttribute(document.createElement('input'));
// The require attribute behavior depend of the input type.
// First of all, checks for types that make the element barred from
// constraint validation.

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

@ -14,83 +14,22 @@
/** Test for HTMLTextAreaElement attributes reflection **/
// .autofocus
reflectBoolean({
element: document.createElement("textarea"),
attribute: "autofocus",
});
var textarea = document.createElement("textarea");
//.cols
reflectUnsignedInt({
element: document.createElement("textarea"),
attribute: "cols",
nonZero: true,
defaultValue: 20,
});
todo("dirName" in document.createElement("textarea"),
"dirName isn't implemented yet");
// .disabled
reflectBoolean({
element: document.createElement("textarea"),
attribute: "disabled",
});
// TODO: form (HTMLFormElement)
// TODO: maxLength (long)
// .name
reflectString({
element: document.createElement("textarea"),
attribute: "name",
otherValues: [ "isindex", "_charset_" ],
});
// .placeholder
reflectString({
element: document.createElement("textarea"),
attribute: "placeholder",
otherValues: [ "foo\nbar", "foo\rbar", "foo\r\nbar" ],
});
// .readOnly
reflectBoolean({
element: document.createElement("textarea"),
attribute: "readOnly",
});
// .required
reflectBoolean({
element: document.createElement("textarea"),
attribute: "required",
});
// .rows
reflectUnsignedInt({
element: document.createElement("textarea"),
element: textarea,
attribute: "rows",
nonZero: true,
defaultValue: 2,
});
// .wrap
// TODO: make it an enumerated attributes limited to only known values, bug 670869.
reflectString({
element: document.createElement("textarea"),
attribute: "wrap",
otherValues: [ "soft", "hard" ],
reflectUnsignedInt({
element: textarea,
attribute: "cols",
nonZero: true,
defaultValue: 20,
});
// .type doesn't reflect a content attribute.
// .defaultValue doesn't reflect a content attribute.
// .value doesn't reflect a content attribute.
// .textLength doesn't reflect a content attribute.
// .willValidate doesn't reflect a content attribute.
// .validity doesn't reflect a content attribute.
// .validationMessage doesn't reflect a content attribute.
// .labels doesn't reflect a content attribute.
</script>
</pre>
</body>

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

@ -55,19 +55,11 @@ function reflectString(aParameters)
element.removeAttribute(contentAttr);
element[idlAttr] = null;
// TODO: remove this ugly hack when null stringification will work as expected.
if (element.localName == "textarea" && idlAttr == "wrap") {
is(element.getAttribute(contentAttr), "null",
"null should have been stringified to 'null'");
is(element[idlAttr], "null", "null should have been stringified to 'null'");
element.removeAttribute(contentAttr);
} else {
todo_is(element.getAttribute(contentAttr), "null",
"null should have been stringified to 'null'");
todo_is(element[idlAttr], "null",
"null should have been stringified to 'null'");
element.removeAttribute(contentAttr);
}
todo_is(element.getAttribute(contentAttr), "null",
"null should have been stringified to 'null'");
todo_is(element[idlAttr], "null",
"null should have been stringified to 'null'");
element.removeAttribute(contentAttr);
// Tests various strings.
var stringsToTest = [
@ -342,105 +334,3 @@ function reflectLimitedEnumerated(aParameters)
});
}
/**
* Checks that a given attribute is correctly reflected as a boolean.
*
* @param aParameters Object object containing the parameters, which are:
* - element Element node to test on
* - attribute String name of the attribute
* OR
* attribute Object object containing two attributes, 'content' and 'idl'
*/
function reflectBoolean(aParameters)
{
var element = aParameters.element;
var contentAttr = typeof aParameters.attribute === "string"
? aParameters.attribute : aParameters.attribute.content;
var idlAttr = typeof aParameters.attribute === "string"
? aParameters.attribute : aParameters.attribute.idl;
ok(idlAttr in element,
idlAttr + " should be an IDL attribute of this element");
is(typeof element[idlAttr], "boolean",
idlAttr + " IDL attribute should be a boolean");
// Tests when the attribute isn't set.
is(element.getAttribute(contentAttr), null,
"When not set, the content attribute should be null.");
is(element[idlAttr], false,
"When not set, the IDL attribute should return false");
/**
* Test various values.
* Each value to test is actually an object containing a 'value' property
* containing the value to actually test, a 'stringified' property containing
* the stringified value and a 'result' property containing the expected
* result when the value is set to the IDL attribute.
*/
var valuesToTest = [
{ value: true, stringified: "true", result: true },
{ value: false, stringified: "false", result: false },
{ value: "true", stringified: "true", result: true },
{ value: "false", stringified: "false", result: true },
{ value: "foo", stringified: "foo", result: true },
{ value: idlAttr, stringified: idlAttr, result: true },
{ value: contentAttr, stringified: contentAttr, result: true },
{ value: "null", stringified: "null", result: true },
{ value: "undefined", stringified: "undefined", result: true },
{ value: "", stringified: "", result: false },
{ value: undefined, stringified: "undefined", result: false },
{ value: null, stringified: "null", result: false },
{ value: +0, stringified: "0", result: false },
{ value: -0, stringified: "0", result: false },
{ value: NaN, stringified: "NaN", result: false },
{ value: 42, stringified: "42", result: true },
{ value: Infinity, stringified: "Infinity", result: true },
{ value: -Infinity, stringified: "-Infinity", result: true },
// ES5, verse 9.2.
{ value: { toString: function() { return "foo" } }, stringified: "foo",
result: true },
{ value: { valueOf: function() { return "foo" } },
stringified: "[object Object]", result: true },
{ value: { valueOf: function() { return "quux" }, toString: undefined },
stringified: "quux", result: true },
{ value: { valueOf: function() { return "foo" },
toString: function() { return "bar" } }, stringified: "bar",
result: true },
{ value: { valueOf: function() { return false } },
stringified: "[object Object]", result: true },
{ value: { foo: false, bar: false }, stringified: "[object Object]",
result: true },
{ value: { }, stringified: "[object Object]", result: true },
];
valuesToTest.forEach(function(v) {
element.setAttribute(contentAttr, v.value);
is(element[idlAttr], true,
"IDL attribute should return always return 'true' if the content attribute has been set");
if (v.value === null) {
// bug 667856
todo(element.getAttribute(contentAttr), v.stringified,
"Content attribute should return the stringified value it has been set to.");
} else {
is(element.getAttribute(contentAttr), v.stringified,
"Content attribute should return the stringified value it has been set to.");
}
element.removeAttribute(contentAttr);
element[idlAttr] = v.value;
is(element[idlAttr], v.result, "IDL attribute should return " + v.result);
is(element.getAttribute(contentAttr), v.result ? "" : null,
v.result ? "Content attribute should return the empty string."
: "Content attribute should return null.");
is(element.hasAttribute(contentAttr), v.result,
v.result ? contentAttr + " should not be present"
: contentAttr + " should be present");
element.removeAttribute(contentAttr);
});
// Tests after removeAttribute() is called. Should be equivalent with not set.
is(element.getAttribute(contentAttr), null,
"When not set, the content attribute should be null.");
is(element[contentAttr], false,
"When not set, the IDL attribute should return false");
}

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

@ -0,0 +1,52 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=41464
-->
<head>
<title>Test for Bug 41464</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=41464">Mozilla Bug 41464</a>
<p id="display"></p>
<div id="content" style="display: none">
<textarea wrap=cheesecake></textarea>
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 41464 **/
var textarea = document.getElementById("content").getElementsByTagName("textarea")[0];
is(textarea.wrap, "cheesecake");
is(textarea.hasAttribute("wrap"), true);
is(textarea.getAttribute("wrap"), "cheesecake");
textarea.setAttribute("wrap", "off");
is(textarea.wrap, "off");
is(textarea.hasAttribute("wrap"), true);
is(textarea.getAttribute("wrap"), "off");
textarea.wrap = "soft";
is(textarea.wrap, "soft");
is(textarea.hasAttribute("wrap"), true);
is(textarea.getAttribute("wrap"), "soft");
textarea.wrap = undefined;
is(textarea.wrap, "undefined");
is(textarea.hasAttribute("wrap"), true);
is(textarea.getAttribute("wrap"), "undefined");
textarea.wrap = null;
is(textarea.wrap, "null");
is(textarea.hasAttribute("wrap"), true);
is(textarea.getAttribute("wrap"), "null");
textarea.removeAttribute("wrap");
is(textarea.wrap, "");
is(textarea.hasAttribute("wrap"), false);
</script>
</pre>
</body>
</html>

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

@ -0,0 +1,57 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=457800
-->
<head>
<title>Test for Bug 457800</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=457800">Mozilla Bug 457800</a>
<p id="display"></p>
<div id="content" style="display: none">
<textarea id="textarea"></textarea>
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 457800 **/
function testPlaceholderForElement(element)
{
// init
element.value = ''
// check if {g,s}etAttribute are working
element.setAttribute('placeholder', 'placeholder');
is(element.getAttribute('placeholder'), 'placeholder', "element has no placeholder attribute");
// check if placeholder is working through DOM interface
is(element.placeholder, 'placeholder', "can't read placeholder in DOM interface");
element.placeholder = 'ph';
is(element.placeholder, 'ph', "can't write placeholder in DOM interface");
// check placeholder and value are not interfering
is(element.value, '', "value has changed when placeholder has changed");
element.value = 'value';
is(element.placeholder, 'ph', "placeholder in DOM interface has changed when value has changed");
is(element.getAttribute('placeholder'), 'ph', "placeholder attribute has changed when value has changed");
// check new lines are managed correctly (shouldn't be shown but kept in the DOM)
element.placeholder = 'place\nholder';
is(element.placeholder, 'place\nholder', "\\n shouldn't be stripped");
is(element.getAttribute('placeholder'), 'place\nholder', "\\n shouldn't be stripped");
element.placeholder = 'place\rholder';
is(element.placeholder, 'place\rholder', "\\r shouldn't be stripped");
is(element.getAttribute('placeholder'), 'place\rholder', "\\r shouldn't be stripped");
}
testPlaceholderForElement(document.getElementById('textarea'));
</script>
</pre>
</body>
</html>

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

@ -13,6 +13,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=546995
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=546995">Mozilla Bug 546995</a>
<p id="display"></p>
<div id="content" style="display: none">
<input id='i'>
<textarea id='t'></textarea>
<select id='s'></select>
<button id='b'></button>
</div>
@ -34,6 +36,8 @@ function checkAutofocusIDLAttribute(element)
}
// TODO: keygen should be added when correctly implemented, see bug 101019.
checkAutofocusIDLAttribute(document.getElementById('i'));
checkAutofocusIDLAttribute(document.getElementById('t'));
checkAutofocusIDLAttribute(document.getElementById('s'));
checkAutofocusIDLAttribute(document.getElementById('b'));

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

@ -40,7 +40,6 @@
#include "nsGkAtoms.h"
#include "nsIDocument.h"
#include "nsContentUtils.h"
#include "nsDOMMemoryReporter.h"
class nsXMLCDATASection : public nsGenericDOMDataNode,
@ -62,10 +61,6 @@ public:
// nsIDOMText
NS_FORWARD_NSIDOMTEXT(nsGenericDOMDataNode::)
// DOM Memory Reporter participant.
NS_DECL_AND_IMPL_DOM_MEMORY_REPORTER_SIZEOF(nsXMLCDATASection,
nsGenericDOMDataNode)
// nsIDOMCDATASection
// Empty interface

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

@ -62,10 +62,6 @@ public:
// nsIDOMProcessingInstruction
NS_DECL_NSIDOMPROCESSINGINSTRUCTION
// DOM Memory Reporter participant.
NS_DECL_AND_IMPL_DOM_MEMORY_REPORTER_SIZEOF(nsXMLProcessingInstruction,
nsGenericDOMDataNode)
// nsINode
virtual PRBool IsNodeOfType(PRUint32 aFlags) const;

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

@ -94,7 +94,6 @@
#include "nsDOMWindowUtils.h"
#include "nsIDOMGlobalPropertyInitializer.h"
#include "mozilla/Preferences.h"
#include "nsLocation.h"
// Window scriptable helper includes
#include "nsIDocShell.h"

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

@ -242,7 +242,6 @@
#include "mozAutoDocUpdate.h"
#include "mozilla/Telemetry.h"
#include "nsLocation.h"
#ifdef PR_LOGGING
static PRLogModuleInfo* gDOMLeakPRLog;

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

@ -66,6 +66,7 @@
#include "nsIDOMNavigator.h"
#include "nsIDOMNavigatorGeolocation.h"
#include "nsIDOMNavigatorDesktopNotification.h"
#include "nsIDOMLocation.h"
#include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsIDOMJSWindow.h"
@ -1089,6 +1090,47 @@ nsresult NS_GetNavigatorPlatform(nsAString& aPlatform);
nsresult NS_GetNavigatorAppVersion(nsAString& aAppVersion);
nsresult NS_GetNavigatorAppName(nsAString& aAppName);
class nsIURI;
//*****************************************************************************
// nsLocation: Script "location" object
//*****************************************************************************
class nsLocation : public nsIDOMLocation
{
public:
nsLocation(nsIDocShell *aDocShell);
virtual ~nsLocation();
NS_DECL_ISUPPORTS
void SetDocShell(nsIDocShell *aDocShell);
nsIDocShell *GetDocShell();
// nsIDOMLocation
NS_DECL_NSIDOMLOCATION
protected:
// In the case of jar: uris, we sometimes want the place the jar was
// fetched from as the URI instead of the jar: uri itself. Pass in
// PR_TRUE for aGetInnermostURI when that's the case.
nsresult GetURI(nsIURI** aURL, PRBool aGetInnermostURI = PR_FALSE);
nsresult GetWritableURI(nsIURI** aURL);
nsresult SetURI(nsIURI* aURL, PRBool aReplace = PR_FALSE);
nsresult SetHrefWithBase(const nsAString& aHref, nsIURI* aBase,
PRBool aReplace);
nsresult SetHrefWithContext(JSContext* cx, const nsAString& aHref,
PRBool aReplace);
nsresult GetSourceBaseURL(JSContext* cx, nsIURI** sourceURL);
nsresult GetSourceDocument(JSContext* cx, nsIDocument** aDocument);
nsresult CheckURL(nsIURI *url, nsIDocShellLoadInfo** aLoadInfo);
nsString mCachedHash;
nsWeakPtr mDocShell;
};
/* factory function */
nsresult
NS_NewScriptGlobalObject(PRBool aIsChrome, PRBool aIsModalContentWindow,

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

@ -38,7 +38,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsLocation.h"
#include "nsGlobalWindow.h"
#include "nsIScriptSecurityManager.h"
#include "nsIScriptContext.h"
#include "nsIDocShell.h"
@ -72,7 +72,6 @@
#include "nsITextToSubURI.h"
#include "nsContentUtils.h"
#include "nsJSUtils.h"
#include "jsdbgapi.h"
static nsresult
GetContextFromStack(nsIJSContextStack *aStack, JSContext **aContext)

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

@ -1,97 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 sw=2 et tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Travis Bogard <travis@netscape.com>
* Dan Rosen <dr@netscape.com>
* Vidur Apparao <vidur@netscape.com>
* Johnny Stenback <jst@netscape.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsLocation_h__
#define nsLocation_h__
#include "nsIDOMLocation.h"
#include "nsString.h"
#include "nsWeakReference.h"
class nsIURI;
class nsIDocShell;
class JSContext;
class nsIDocument;
class nsIDocShellLoadInfo;
//*****************************************************************************
// nsLocation: Script "location" object
//*****************************************************************************
class nsLocation : public nsIDOMLocation
{
public:
nsLocation(nsIDocShell *aDocShell);
virtual ~nsLocation();
NS_DECL_ISUPPORTS
void SetDocShell(nsIDocShell *aDocShell);
nsIDocShell *GetDocShell();
// nsIDOMLocation
NS_DECL_NSIDOMLOCATION
protected:
// In the case of jar: uris, we sometimes want the place the jar was
// fetched from as the URI instead of the jar: uri itself. Pass in
// PR_TRUE for aGetInnermostURI when that's the case.
nsresult GetURI(nsIURI** aURL, PRBool aGetInnermostURI = PR_FALSE);
nsresult GetWritableURI(nsIURI** aURL);
nsresult SetURI(nsIURI* aURL, PRBool aReplace = PR_FALSE);
nsresult SetHrefWithBase(const nsAString& aHref, nsIURI* aBase,
PRBool aReplace);
nsresult SetHrefWithContext(JSContext* cx, const nsAString& aHref,
PRBool aReplace);
nsresult GetSourceBaseURL(JSContext* cx, nsIURI** sourceURL);
nsresult GetSourceDocument(JSContext* cx, nsIDocument** aDocument);
nsresult CheckURL(nsIURI *url, nsIDocShellLoadInfo** aLoadInfo);
nsString mCachedHash;
nsWeakPtr mDocShell;
};
#endif // nsLocation_h__

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

@ -528,43 +528,6 @@ nsHTMLStyleSheet::List(FILE* out, PRInt32 aIndent) const
}
#endif
static
PLDHashOperator
GetHashEntryAttributesSize(PLDHashTable* aTable, PLDHashEntryHdr* aEntry,
PRUint32 number, void* aArg)
{
NS_PRECONDITION(aEntry, "The entry should not be null!");
NS_PRECONDITION(aArg, "The passed argument should not be null!");
MappedAttrTableEntry* entry = static_cast<MappedAttrTableEntry*>(aEntry);
PRInt64 size = *static_cast<PRInt64*>(aArg);
NS_ASSERTION(entry->mAttributes, "entry->mAttributes should not be null!");
size += entry->mAttributes->SizeOf();
return PL_DHASH_NEXT;
}
PRInt64
nsHTMLStyleSheet::SizeOf() const
{
PRInt64 size = sizeof(*this);
size += mLinkRule ? sizeof(*mLinkRule.get()) : 0;
size += mVisitedRule ? sizeof(*mVisitedRule.get()) : 0;
size += mActiveRule ? sizeof(*mActiveRule.get()) : 0;
size += mTableQuirkColorRule ? sizeof(*mTableQuirkColorRule.get()) : 0;
size += mTableTHRule ? sizeof(*mTableTHRule.get()) : 0;
if (mMappedAttrTable.ops) {
size += PL_DHASH_TABLE_SIZE(&mMappedAttrTable) * sizeof(MappedAttrTableEntry);
PL_DHashTableEnumerate(const_cast<PLDHashTable*>(&mMappedAttrTable),
GetHashEntryAttributesSize, &size);
}
return size;
}
// XXX For convenience and backwards compatibility
nsresult
NS_NewHTMLStyleSheet(nsHTMLStyleSheet** aInstancePtrResult, nsIURI* aURL,
@ -604,4 +567,3 @@ NS_NewHTMLStyleSheet(nsHTMLStyleSheet** aInstancePtrResult)
*aInstancePtrResult = it; // NS_ADDREF above, or set to null by NS_RELEASE
return rv;
}

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

@ -101,7 +101,6 @@ public:
UniqueMappedAttributes(nsMappedAttributes* aMapped);
void DropMappedAttributes(nsMappedAttributes* aMapped);
PRInt64 SizeOf() const;
private:
// These are not supported and are not implemented!