mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Backed out changeset 7fdbccdc1e94
This commit is contained in:
parent
1061e15478
commit
2a9195ee3c
@ -1503,16 +1503,23 @@ function loadOneOrMoreURIs(aURIString)
|
||||
}
|
||||
}
|
||||
|
||||
function openLocation() {
|
||||
if (window.fullScreen)
|
||||
FullScreen.mouseoverToggle(true);
|
||||
|
||||
function focusAndSelectUrlBar()
|
||||
{
|
||||
if (gURLBar && isElementVisible(gURLBar) && !gURLBar.readOnly) {
|
||||
gURLBar.focus();
|
||||
gURLBar.select();
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function openLocation()
|
||||
{
|
||||
if (window.fullScreen)
|
||||
FullScreen.mouseoverToggle(true);
|
||||
|
||||
if (focusAndSelectUrlBar())
|
||||
return;
|
||||
#ifdef XP_MACOSX
|
||||
if (window.location.href != getBrowserURL()) {
|
||||
var win = getTopWin();
|
||||
|
@ -197,6 +197,7 @@
|
||||
<!-- Popup for site identity information -->
|
||||
<panel id="identity-popup" position="after_start" hidden="true" noautofocus="true"
|
||||
onpopupshown="document.getElementById('identity-popup-more-info-button').focus();"
|
||||
onpopuphidden="focusAndSelectUrlBar();" norestorefocus="true"
|
||||
chromedir="&locale.dir;">
|
||||
<hbox id="identity-popup-container" align="top">
|
||||
<image id="identity-popup-icon"/>
|
||||
|
@ -146,11 +146,8 @@ function openUILink( url, e, ignoreButton, ignoreAlt, allowKeywordFixup, postDat
|
||||
*/
|
||||
function whereToOpenLink( e, ignoreButton, ignoreAlt )
|
||||
{
|
||||
// This method must treat a null event like a left click without modifier keys (i.e.
|
||||
// e = { shiftKey:false, ctrlKey:false, metaKey:false, altKey:false, button:0 })
|
||||
// for compatibility purposes.
|
||||
if (!e)
|
||||
return "current";
|
||||
e = { shiftKey:false, ctrlKey:false, metaKey:false, altKey:false, button:0 };
|
||||
|
||||
var shift = e.shiftKey;
|
||||
var ctrl = e.ctrlKey;
|
||||
|
@ -241,7 +241,6 @@ bin/components/nsHandlerService.js
|
||||
bin/components/nsWebHandlerApp.js
|
||||
bin/components/libdbusservice.so
|
||||
bin/components/aboutRobots.js
|
||||
bin/components/nsBadCertHandler.js
|
||||
|
||||
; Modules
|
||||
bin/modules/*
|
||||
|
@ -247,7 +247,6 @@ bin\components\nsContentDispatchChooser.js
|
||||
bin\components\nsHandlerService.js
|
||||
bin\components\nsWebHandlerApp.js
|
||||
bin\components\aboutRobots.js
|
||||
bin\components\nsBadCertHandler.js
|
||||
|
||||
; Modules
|
||||
bin\modules\*
|
||||
|
@ -372,7 +372,6 @@ nsHTMLScriptElement::nsHTMLScriptElement(nsINodeInfo *aNodeInfo,
|
||||
PRBool aFromParser)
|
||||
: nsGenericHTMLElement(aNodeInfo)
|
||||
{
|
||||
printf("New script element\n");
|
||||
mDoneAddingChildren = !aFromParser;
|
||||
AddMutationObserver(this);
|
||||
}
|
||||
@ -511,7 +510,6 @@ nsHTMLScriptElement::GetScriptURI()
|
||||
GetSrc(src);
|
||||
if (!src.IsEmpty())
|
||||
NS_NewURI(&uri, src);
|
||||
printf("spec: %s\n", NS_ConvertUTF16toUTF8(src).get());
|
||||
return uri;
|
||||
}
|
||||
|
||||
|
@ -423,7 +423,7 @@ nsXULElement::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
}
|
||||
|
||||
NS_ADDREF(inst);
|
||||
|
||||
|
||||
*aInstancePtr = inst;
|
||||
return NS_OK;
|
||||
}
|
||||
@ -482,7 +482,7 @@ nsXULElement::GetElementsByAttribute(const nsAString& aAttribute,
|
||||
NS_ENSURE_TRUE(attrAtom, NS_ERROR_OUT_OF_MEMORY);
|
||||
void* attrValue = new nsString(aValue);
|
||||
NS_ENSURE_TRUE(attrValue, NS_ERROR_OUT_OF_MEMORY);
|
||||
nsContentList *list =
|
||||
nsContentList *list =
|
||||
new nsContentList(this,
|
||||
nsXULDocument::MatchAttribute,
|
||||
nsContentUtils::DestroyMatchString,
|
||||
@ -515,8 +515,8 @@ nsXULElement::GetElementsByAttributeNS(const nsAString& aNamespaceURI,
|
||||
|
||||
void* attrValue = new nsString(aValue);
|
||||
NS_ENSURE_TRUE(attrValue, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
nsContentList *list =
|
||||
|
||||
nsContentList *list =
|
||||
new nsContentList(this,
|
||||
nsXULDocument::MatchAttribute,
|
||||
nsContentUtils::DestroyMatchString,
|
||||
@ -567,7 +567,7 @@ nsXULElement::GetEventListenerManagerForAttr(nsIEventListenerManager** aManager,
|
||||
PRBool
|
||||
nsXULElement::IsFocusable(PRInt32 *aTabIndex)
|
||||
{
|
||||
/*
|
||||
/*
|
||||
* Returns true if an element may be focused, and false otherwise. The inout
|
||||
* argument aTabIndex will be set to the tab order index to be used; -1 for
|
||||
* elements that should not be part of the tab order and a greater value to
|
||||
@ -598,7 +598,7 @@ nsXULElement::IsFocusable(PRInt32 *aTabIndex)
|
||||
// elements are not focusable by default
|
||||
PRBool shouldFocus = PR_FALSE;
|
||||
|
||||
nsCOMPtr<nsIDOMXULControlElement> xulControl =
|
||||
nsCOMPtr<nsIDOMXULControlElement> xulControl =
|
||||
do_QueryInterface(static_cast<nsIContent*>(this));
|
||||
if (xulControl) {
|
||||
// a disabled element cannot be focused and is not part of the tab order
|
||||
@ -1037,7 +1037,7 @@ nsXULElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify)
|
||||
}
|
||||
|
||||
rv = nsGenericElement::RemoveChildAt(aIndex, aNotify);
|
||||
|
||||
|
||||
if (newCurrentIndex == -2)
|
||||
controlElement->SetCurrentItem(nsnull);
|
||||
else if (newCurrentIndex > -1) {
|
||||
@ -1108,7 +1108,7 @@ nsXULElement::BeforeSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
||||
attrVal->ToString(oldValue);
|
||||
UnregisterAccessKey(oldValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (aNamespaceID == kNameSpaceID_None && (aName ==
|
||||
nsGkAtoms::command || aName == nsGkAtoms::observes) && IsInDoc()) {
|
||||
// XXX sXBL/XBL2 issue! Owner or current document?
|
||||
@ -1313,7 +1313,7 @@ nsXULElement::FindAttrValueIn(PRInt32 aNameSpaceID,
|
||||
NS_ASSERTION(aName, "Must have attr name");
|
||||
NS_ASSERTION(aNameSpaceID != kNameSpaceID_Unknown, "Must have namespace");
|
||||
NS_ASSERTION(aValues, "Null value array");
|
||||
|
||||
|
||||
const nsAttrValue* val = FindLocalOrProtoAttr(aNameSpaceID, aName);
|
||||
if (val) {
|
||||
for (PRInt32 i = 0; aValues[i]; ++i) {
|
||||
@ -1330,7 +1330,7 @@ nsresult
|
||||
nsXULElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName, PRBool aNotify)
|
||||
{
|
||||
// This doesn't call BeforeSetAttr/AfterSetAttr for now.
|
||||
|
||||
|
||||
NS_ASSERTION(nsnull != aName, "must have attribute name");
|
||||
nsresult rv;
|
||||
|
||||
@ -2292,9 +2292,9 @@ nsXULElement::SetFocus(nsPresContext* aPresContext)
|
||||
void
|
||||
nsXULElement::RemoveFocus(nsPresContext* aPresContext)
|
||||
{
|
||||
if (!aPresContext)
|
||||
if (!aPresContext)
|
||||
return;
|
||||
|
||||
|
||||
if (IsInDoc()) {
|
||||
aPresContext->EventStateManager()->SetContentState(nsnull,
|
||||
NS_EVENT_STATE_FOCUS);
|
||||
@ -2461,7 +2461,7 @@ nsresult nsXULElement::MakeHeavyweight()
|
||||
|
||||
// XXX we might wanna have a SetAndTakeAttr that takes an nsAttrName
|
||||
nsAttrValue attrValue(protoattr->mValue);
|
||||
|
||||
|
||||
// Style rules need to be cloned.
|
||||
if (attrValue.Type() == nsAttrValue::eCSSStyleRule) {
|
||||
nsCOMPtr<nsICSSRule> ruleClone;
|
||||
@ -2926,7 +2926,7 @@ nsXULPrototypeElement::SetAttrAt(PRUint32 aPos, const nsAString& aValue,
|
||||
mHasClassAttribute = PR_TRUE;
|
||||
// Compute the element's class list
|
||||
mAttributes[aPos].mValue.ParseAtomArray(aValue);
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
else if (mAttributes[aPos].mName.Equals(nsGkAtoms::style)) {
|
||||
|
@ -595,15 +595,14 @@ NS_IMETHODIMP
|
||||
nsJSChannel::AsyncOpen(nsIStreamListener *aListener, nsISupports *aContext)
|
||||
{
|
||||
NS_ENSURE_ARG(aListener);
|
||||
printf("AsyncOpen\n");
|
||||
|
||||
// First make sure that we have a usable inner window; we'll want to make
|
||||
// sure that we execute against that inner and no other.
|
||||
nsIScriptGlobalObject* global = GetGlobalObject(this);
|
||||
if (!global) {
|
||||
printf("no global object!\n");
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
printf("got global object\n");
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> win(do_QueryInterface(global));
|
||||
NS_ASSERTION(win, "Our global is not a window??");
|
||||
|
||||
|
@ -399,19 +399,11 @@ nsFormFillController::GetTextValue(nsAString & aTextValue)
|
||||
NS_IMETHODIMP
|
||||
nsFormFillController::SetTextValue(const nsAString & aTextValue)
|
||||
{
|
||||
nsAutoString value(aTextValue);
|
||||
nsCOMPtr<nsIDOMNSEditableElement> editable = do_QueryInterface(mFocusedInput);
|
||||
if (editable) {
|
||||
// Don't fill in more than maxLength
|
||||
PRInt32 maxLength;
|
||||
if (NS_SUCCEEDED(mFocusedInput->GetMaxLength(&maxLength)) && maxLength) {
|
||||
nsAutoString trimmedValue;
|
||||
value.Left(trimmedValue, maxLength);
|
||||
|
||||
mSuppressOnInput = PR_TRUE;
|
||||
editable->SetUserInput(trimmedValue);
|
||||
mSuppressOnInput = PR_FALSE;
|
||||
}
|
||||
mSuppressOnInput = PR_TRUE;
|
||||
editable->SetUserInput(aTextValue);
|
||||
mSuppressOnInput = PR_FALSE;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -40,7 +40,6 @@ DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
relativesrcdir = toolkit/components/satchel/test
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
@ -50,12 +49,5 @@ XPCSHELL_TESTS = \
|
||||
unit \
|
||||
$(NULL)
|
||||
|
||||
# Mochitest tests
|
||||
MOCHI_TESTS = \
|
||||
test_basic_form.html \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
libs:: $(MOCHI_TESTS)
|
||||
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
|
||||
|
@ -1,91 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for satchel</title>
|
||||
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
Satchel test: simple form fill
|
||||
<p id="display"></p>
|
||||
|
||||
<iframe id="iframe"></iframe>
|
||||
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
/** Test for Satchel **/
|
||||
function startTest() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
|
||||
// Get the formHistory service
|
||||
var formHistory = Components.classes["@mozilla.org/satchel/form-history;1"].
|
||||
getService(Components.interfaces.nsIFormHistory2);
|
||||
|
||||
// Make sure it's not already initialized somehow
|
||||
ok(!formHistory.hasEntries, "no existing entries");
|
||||
|
||||
// add some test entries
|
||||
var testData = [{name: "text", value: "data-basic", expect: "data-basic"},
|
||||
{name: "text-max", value: "data-maxlength01234567890", expect: "data"}
|
||||
];
|
||||
|
||||
testData.forEach(function (entry) formHistory.addEntry(entry.name, entry.value));
|
||||
|
||||
// Simple check to see if everything was added fine.
|
||||
ok(formHistory.hasEntries, "entries exist");
|
||||
|
||||
// Now load a document and check that the form was filled out correctly.
|
||||
var iframe = $("iframe");
|
||||
iframe.addEventListener("load", doTest, false);
|
||||
|
||||
var formDocURL = 'data:text/html,<form><input type="text" id="text" name="text"><input type="text" id="text-max" name="text-max" maxlength="4"></form>'
|
||||
iframe.setAttribute("src", formDocURL);
|
||||
|
||||
function doTest() {
|
||||
iframe.removeEventListener("load", doTest, false);
|
||||
|
||||
var text = iframe.contentWindow.document.getElementById("text");
|
||||
var text_max = iframe.contentWindow.document.getElementById("text-max");
|
||||
ok(text, "got text element");
|
||||
ok(text_max, "got text-max element");
|
||||
|
||||
function triggerFormFill(aTarget) {
|
||||
aTarget.focus();
|
||||
synthesizeKey("VK_DOWN", {}, window);
|
||||
synthesizeKey("VK_DOWN", {}, window);
|
||||
synthesizeKey("VK_ENTER", {}, window);
|
||||
}
|
||||
|
||||
triggerFormFill(text);
|
||||
triggerFormFill(text_max);
|
||||
|
||||
is(text.value, testData[0].value, "text filled in correctly");
|
||||
is(text_max.value, testData[1].value, "text_max filled in correctly");
|
||||
|
||||
// clean up
|
||||
cleanUp();
|
||||
}
|
||||
|
||||
function cleanUp() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
|
||||
// Remove the added entries
|
||||
formHistory.removeAllEntries();
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
|
||||
window.onload = startTest;
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user