diff --git a/accessible/src/base/nsAccDocManager.h b/accessible/src/base/nsAccDocManager.h index 4fd52365392..1bd5256c554 100644 --- a/accessible/src/base/nsAccDocManager.h +++ b/accessible/src/base/nsAccDocManager.h @@ -199,23 +199,32 @@ private: printf("uri: %s", spec); #define NS_LOG_ACCDOC_TYPE(aDocument) \ - PRBool isContent = nsCoreUtils::IsContentDocument(aDocument); \ - printf("%s document", (isContent ? "content" : "chrome")); + if (aDocument->IsActive()) { \ + PRBool isContent = nsCoreUtils::IsContentDocument(aDocument); \ + printf("%s document", (isContent ? "content" : "chrome")); \ + } else { \ + printf("document type: [failed]"); \ + } #define NS_LOG_ACCDOC_SHELLSTATE(aDocument) \ - nsCOMPtr container = aDocument->GetContainer(); \ - nsCOMPtr docShell = do_QueryInterface(container); \ - PRUint32 busyFlags = nsIDocShell::BUSY_FLAGS_NONE; \ - docShell->GetBusyFlags(&busyFlags); \ nsCAutoString docShellBusy; \ - if (busyFlags == nsIDocShell::BUSY_FLAGS_NONE) \ - docShellBusy.AppendLiteral("'none'"); \ - if (busyFlags & nsIDocShell::BUSY_FLAGS_BUSY) \ - docShellBusy.AppendLiteral("'busy'"); \ - if (busyFlags & nsIDocShell::BUSY_FLAGS_BEFORE_PAGE_LOAD) \ - docShellBusy.AppendLiteral(", 'before page load'"); \ - if (busyFlags & nsIDocShell::BUSY_FLAGS_PAGE_LOADING) \ - docShellBusy.AppendLiteral(", 'page loading'"); \ + nsCOMPtr container = aDocument->GetContainer(); \ + if (container) { \ + nsCOMPtr docShell = do_QueryInterface(container); \ + PRUint32 busyFlags = nsIDocShell::BUSY_FLAGS_NONE; \ + docShell->GetBusyFlags(&busyFlags); \ + if (busyFlags == nsIDocShell::BUSY_FLAGS_NONE) \ + docShellBusy.AppendLiteral("'none'"); \ + if (busyFlags & nsIDocShell::BUSY_FLAGS_BUSY) \ + docShellBusy.AppendLiteral("'busy'"); \ + if (busyFlags & nsIDocShell::BUSY_FLAGS_BEFORE_PAGE_LOAD) \ + docShellBusy.AppendLiteral(", 'before page load'"); \ + if (busyFlags & nsIDocShell::BUSY_FLAGS_PAGE_LOADING) \ + docShellBusy.AppendLiteral(", 'page loading'"); \ + } \ + else { \ + docShellBusy.AppendLiteral("[failed]"); \ + } \ printf("docshell busy: %s", docShellBusy.get()); #define NS_LOG_ACCDOC_DOCSTATES(aDocument) \ @@ -336,20 +345,22 @@ private: printf(" "); \ NS_LOG_ACCDOC_ADDRESS(aDocument, aDocAcc) \ printf("\n "); \ - NS_LOG_ACCDOC_URI(aDocument) \ - printf("\n "); \ - NS_LOG_ACCDOC_SHELLSTATE(aDocument) \ - printf("; "); \ - NS_LOG_ACCDOC_TYPE(aDocument) \ - printf("\n "); \ - NS_LOG_ACCDOC_DOCSTATES(aDocument) \ - printf("\n "); \ - NS_LOG_ACCDOC_DOCPRESSHELL(aDocument) \ - printf("\n "); \ - NS_LOG_ACCDOC_DOCLOADGROUP(aDocument) \ - printf(", "); \ - NS_LOG_ACCDOC_DOCPARENT(aDocument) \ - printf("\n"); \ + if (aDocument) { \ + NS_LOG_ACCDOC_URI(aDocument) \ + printf("\n "); \ + NS_LOG_ACCDOC_SHELLSTATE(aDocument) \ + printf("; "); \ + NS_LOG_ACCDOC_TYPE(aDocument) \ + printf("\n "); \ + NS_LOG_ACCDOC_DOCSTATES(aDocument) \ + printf("\n "); \ + NS_LOG_ACCDOC_DOCPRESSHELL(aDocument) \ + printf("\n "); \ + NS_LOG_ACCDOC_DOCLOADGROUP(aDocument) \ + printf(", "); \ + NS_LOG_ACCDOC_DOCPARENT(aDocument) \ + printf("\n"); \ + } \ } #define NS_LOG_ACCDOC_DOCINFO_END \ printf(" }\n"); diff --git a/accessible/src/base/nsAccUtils.cpp b/accessible/src/base/nsAccUtils.cpp index fbb4e1d491c..e588945b0cd 100644 --- a/accessible/src/base/nsAccUtils.cpp +++ b/accessible/src/base/nsAccUtils.cpp @@ -160,7 +160,8 @@ nsAccUtils::GetPositionAndSizeForXULSelectControlItem(nsIContent *aContent, control->GetItemAtIndex(index, getter_AddRefs(currItem)); nsCOMPtr currNode(do_QueryInterface(currItem)); - nsAccessible* itemAcc = GetAccService()->GetAccessible(currNode); + nsAccessible* itemAcc = currNode ? + GetAccService()->GetAccessible(currNode) : nsnull; if (!itemAcc || itemAcc->State() & states::INVISIBLE) { (*aSetSize)--; @@ -201,7 +202,8 @@ nsAccUtils::GetPositionAndSizeForXULContainerItem(nsIContent *aContent, container->GetItemAtIndex(index, getter_AddRefs(item)); nsCOMPtr itemNode(do_QueryInterface(item)); - nsAccessible* itemAcc = GetAccService()->GetAccessible(itemNode); + nsAccessible* itemAcc = itemNode ? + GetAccService()->GetAccessible(itemNode) : nsnull; if (itemAcc) { PRUint32 itemRole = Role(itemAcc); @@ -220,8 +222,9 @@ nsAccUtils::GetPositionAndSizeForXULContainerItem(nsIContent *aContent, nsCOMPtr item; container->GetItemAtIndex(index, getter_AddRefs(item)); nsCOMPtr itemNode(do_QueryInterface(item)); - - nsAccessible* itemAcc = GetAccService()->GetAccessible(itemNode); + + nsAccessible* itemAcc = + itemNode ? GetAccService()->GetAccessible(itemNode) : nsnull; if (itemAcc) { PRUint32 itemRole = Role(itemAcc); diff --git a/accessible/src/base/nsAccessibilityService.cpp b/accessible/src/base/nsAccessibilityService.cpp index f34ccbf482a..92d9083a638 100644 --- a/accessible/src/base/nsAccessibilityService.cpp +++ b/accessible/src/base/nsAccessibilityService.cpp @@ -842,6 +842,8 @@ nsAccessibilityService::GetAccessibleInShell(nsINode* aNode, nsAccessible* nsAccessibilityService::GetAccessible(nsINode* aNode) { + NS_PRECONDITION(aNode, "Getting an accessible for null node! Crash."); + nsDocAccessible* document = GetDocAccessible(aNode->GetOwnerDoc()); return document ? document->GetAccessible(aNode) : nsnull; } diff --git a/accessible/src/base/nsBaseWidgetAccessible.cpp b/accessible/src/base/nsBaseWidgetAccessible.cpp index ab66e903d52..b4b9ba8867d 100644 --- a/accessible/src/base/nsBaseWidgetAccessible.cpp +++ b/accessible/src/base/nsBaseWidgetAccessible.cpp @@ -93,7 +93,7 @@ nsLeafAccessible::CacheChildren() nsLinkableAccessible:: nsLinkableAccessible(nsIContent *aContent, nsIWeakReference *aShell) : nsAccessibleWrap(aContent, aShell), - mActionContent(nsnull), + mActionAcc(nsnull), mIsLink(PR_FALSE), mIsOnclick(PR_FALSE) { @@ -107,11 +107,7 @@ NS_IMPL_ISUPPORTS_INHERITED0(nsLinkableAccessible, nsAccessibleWrap) NS_IMETHODIMP nsLinkableAccessible::TakeFocus() { - nsAccessible *actionAcc = GetActionAccessible(); - if (actionAcc) - return actionAcc->TakeFocus(); - - return nsAccessibleWrap::TakeFocus(); + return mActionAcc ? mActionAcc->TakeFocus() : nsAccessibleWrap::TakeFocus(); } PRUint64 @@ -120,8 +116,7 @@ nsLinkableAccessible::NativeState() PRUint64 states = nsAccessibleWrap::NativeState(); if (mIsLink) { states |= states::LINKED; - nsAccessible* actionAcc = GetActionAccessible(); - if (actionAcc->State() & states::TRAVERSED) + if (mActionAcc->State() & states::TRAVERSED) states |= states::TRAVERSED; } @@ -137,13 +132,7 @@ nsLinkableAccessible::GetValue(nsAString& aValue) if (!aValue.IsEmpty()) return NS_OK; - if (mIsLink) { - nsAccessible *actionAcc = GetActionAccessible(); - if (actionAcc) - return actionAcc->GetValue(aValue); - } - - return NS_ERROR_NOT_IMPLEMENTED; + return mIsLink ? mActionAcc->GetValue(aValue) : NS_ERROR_NOT_IMPLEMENTED; } @@ -152,7 +141,7 @@ nsLinkableAccessible::GetNumActions(PRUint8 *aNumActions) { NS_ENSURE_ARG_POINTER(aNumActions); - *aNumActions = mActionContent ? 1 : 0; + *aNumActions = mActionAcc ? 1 : 0; return NS_OK; } @@ -182,11 +171,8 @@ nsLinkableAccessible::DoAction(PRUint8 aIndex) if (aIndex != eAction_Jump) return NS_ERROR_INVALID_ARG; - nsAccessible *actionAcc = GetActionAccessible(); - if (actionAcc) - return actionAcc->DoAction(aIndex); - - return nsAccessibleWrap::DoAction(aIndex); + return mActionAcc ? mActionAcc->DoAction(aIndex) : + nsAccessibleWrap::DoAction(aIndex); } NS_IMETHODIMP @@ -194,11 +180,8 @@ nsLinkableAccessible::GetKeyboardShortcut(nsAString& aKeyboardShortcut) { aKeyboardShortcut.Truncate(); - nsAccessible *actionAcc = GetActionAccessible(); - if (actionAcc) - return actionAcc->GetKeyboardShortcut(aKeyboardShortcut); - - return nsAccessible::GetKeyboardShortcut(aKeyboardShortcut); + return mActionAcc ? mActionAcc->GetKeyboardShortcut(aKeyboardShortcut) : + nsAccessible::GetKeyboardShortcut(aKeyboardShortcut); } //////////////////////////////////////////////////////////////////////////////// @@ -207,7 +190,9 @@ nsLinkableAccessible::GetKeyboardShortcut(nsAString& aKeyboardShortcut) void nsLinkableAccessible::Shutdown() { - mActionContent = nsnull; + mIsLink = PR_FALSE; + mIsOnclick = PR_FALSE; + mActionAcc = nsnull; nsAccessibleWrap::Shutdown(); } @@ -218,14 +203,11 @@ already_AddRefed nsLinkableAccessible::GetAnchorURI(PRUint32 aAnchorIndex) { if (mIsLink) { - nsAccessible* link = GetActionAccessible(); - if (link) { - NS_ASSERTION(link->IsHyperLink(), - "nsIAccessibleHyperLink isn't implemented."); + NS_ASSERTION(mActionAcc->IsHyperLink(), + "nsIAccessibleHyperLink isn't implemented."); - if (link->IsHyperLink()) - return link->GetAnchorURI(aAnchorIndex); - } + if (mActionAcc->IsHyperLink()) + return mActionAcc->GetAnchorURI(aAnchorIndex); } return nsnull; @@ -241,55 +223,36 @@ nsLinkableAccessible::BindToParent(nsAccessible* aParent, nsAccessibleWrap::BindToParent(aParent, aIndexInParent); // Cache action content. - mActionContent = nsnull; + mActionAcc = nsnull; mIsLink = PR_FALSE; mIsOnclick = PR_FALSE; - nsIContent* walkUpContent = mContent; - PRBool isOnclick = nsCoreUtils::HasClickListener(walkUpContent); - - if (isOnclick) { - mActionContent = walkUpContent; + if (nsCoreUtils::HasClickListener(mContent)) { + mActionAcc = this; mIsOnclick = PR_TRUE; return; } - while ((walkUpContent = walkUpContent->GetParent())) { - nsAccessible* walkUpAcc = - GetAccService()->GetAccessibleInWeakShell(walkUpContent, mWeakShell); - + // XXX: The logic looks broken since the click listener may be registered + // on non accessible node in parent chain but this node is skipped when tree + // is traversed. + nsAccessible* walkUpAcc = this; + while ((walkUpAcc = walkUpAcc->GetParent()) && !walkUpAcc->IsDoc()) { if (walkUpAcc && walkUpAcc->Role() == nsIAccessibleRole::ROLE_LINK && walkUpAcc->State() & states::LINKED) { mIsLink = PR_TRUE; - mActionContent = walkUpContent; + mActionAcc = walkUpAcc; return; } - isOnclick = nsCoreUtils::HasClickListener(walkUpContent); - if (isOnclick) { - mActionContent = walkUpContent; + if (nsCoreUtils::HasClickListener(walkUpAcc->GetContent())) { + mActionAcc = walkUpAcc; mIsOnclick = PR_TRUE; return; } } } -//////////////////////////////////////////////////////////////////////////////// -// nsLinkableAccessible: protected - -nsAccessible * -nsLinkableAccessible::GetActionAccessible() const -{ - // Return accessible for the action content if it's different from node of - // this accessible. If the action accessible is not null then it is used to - // redirect methods calls otherwise we use method implementation from the - // base class. - if (!mActionContent || mContent == mActionContent) - return nsnull; - - return GetAccService()->GetAccessibleInWeakShell(mActionContent, mWeakShell); -} - //////////////////////////////////////////////////////////////////////////////// // nsEnumRoleAccessible //////////////////////////////////////////////////////////////////////////////// diff --git a/accessible/src/base/nsBaseWidgetAccessible.h b/accessible/src/base/nsBaseWidgetAccessible.h index 8a776da91f1..d8b0866ce57 100644 --- a/accessible/src/base/nsBaseWidgetAccessible.h +++ b/accessible/src/base/nsBaseWidgetAccessible.h @@ -108,14 +108,10 @@ protected: // nsAccessible virtual void BindToParent(nsAccessible* aParent, PRUint32 aIndexInParent); - // nsLinkableAccessible - /** - * Return an accessible for cached action node. + * Parent accessible that provides an action for this linkable accessible. */ - nsAccessible *GetActionAccessible() const; - - nsCOMPtr mActionContent; + nsAccessible* mActionAcc; PRPackedBool mIsLink; PRPackedBool mIsOnclick; }; diff --git a/accessible/src/base/nsCoreUtils.cpp b/accessible/src/base/nsCoreUtils.cpp index 081888febad..ea573966406 100644 --- a/accessible/src/base/nsCoreUtils.cpp +++ b/accessible/src/base/nsCoreUtils.cpp @@ -493,12 +493,10 @@ nsCoreUtils::IsErrorPage(nsIDocument *aDocument) nsCAutoString path; uri->GetPath(path); - nsCAutoString::const_iterator start, end; - path.BeginReading(start); - path.EndReading(end); - NS_NAMED_LITERAL_CSTRING(neterror, "neterror"); - return FindInReadable(neterror, start, end); + NS_NAMED_LITERAL_CSTRING(certerror, "certerror"); + + return StringBeginsWith(path, neterror) || StringBeginsWith(path, certerror); } PRBool diff --git a/accessible/src/base/nsOuterDocAccessible.cpp b/accessible/src/base/nsOuterDocAccessible.cpp index 1a13dd9d900..239c6407a3b 100644 --- a/accessible/src/base/nsOuterDocAccessible.cpp +++ b/accessible/src/base/nsOuterDocAccessible.cpp @@ -213,8 +213,8 @@ nsOuterDocAccessible::RemoveChild(nsAccessible *aAccessible) return PR_FALSE; } - NS_LOG_ACCDOCDESTROY("remove document from outerdoc", - child->GetDocumentNode()) + NS_LOG_ACCDOCDESTROY_FOR("remove document from outerdoc", + child->GetDocumentNode(), child) NS_LOG_ACCDOCDESTROY_ACCADDRESS("outerdoc", this) PRBool wasRemoved = nsAccessible::RemoveChild(child); diff --git a/accessible/src/html/nsHyperTextAccessible.cpp b/accessible/src/html/nsHyperTextAccessible.cpp index b4dcf5a5b1d..bcafdce71ea 100644 --- a/accessible/src/html/nsHyperTextAccessible.cpp +++ b/accessible/src/html/nsHyperTextAccessible.cpp @@ -1014,7 +1014,7 @@ nsresult nsHyperTextAccessible::GetTextHelper(EGetTextType aType, nsAccessibleTe } if (aType == eGetBefore) { - endOffset = aOffset; + finalEndOffset = aOffset; } else { // Start moving forward from the start so that we don't get diff --git a/accessible/tests/mochitest/events/docload_wnd.xul b/accessible/tests/mochitest/events/docload_wnd.xul index 06402e8e987..808f1d69808 100644 --- a/accessible/tests/mochitest/events/docload_wnd.xul +++ b/accessible/tests/mochitest/events/docload_wnd.xul @@ -192,11 +192,11 @@ /** * Load wrong URI what results in error page loading. */ - function loadErrorPageInvoker() + function loadErrorPageInvoker(aURL, aURLDescr) { this.invoke = function loadErrorPageInvoker_invoke() { - gTabBrowser.loadURI("www.wronguri.wronguri"); + gTabBrowser.loadURI(aURL); } this.eventSeq = [ @@ -209,7 +209,7 @@ this.getID = function loadErrorPageInvoker_getID() { - return "load error page"; + return "load error page: '" + aURLDescr + "'"; } } @@ -230,7 +230,11 @@ gQueue.push(new clickReloadBtnInvoker()); gQueue.push(new loadURIInvoker("about:mozilla")); gQueue.push(new reloadInvoker()); - gQueue.push(new loadErrorPageInvoker()); + gQueue.push(new loadErrorPageInvoker("www.wronguri.wronguri", + "Server not found")); + gQueue.push(new loadErrorPageInvoker("https://nocert.example.com:443", + "Untrusted Connection")); + gQueue.onFinish = function() { window.close(); } gQueue.invoke(); } diff --git a/accessible/tests/mochitest/text/Makefile.in b/accessible/tests/mochitest/text/Makefile.in index 75d5ed98f7d..15b33314a2c 100644 --- a/accessible/tests/mochitest/text/Makefile.in +++ b/accessible/tests/mochitest/text/Makefile.in @@ -50,8 +50,8 @@ _TEST_FILES = \ test_doc.html \ test_hypertext.html \ test_passwords.html \ - $(warning test_singleline.html disabled due to bug 652459) \ - $(warning test_whitespaces.html disabled due to bug 652459) \ + test_singleline.html \ + test_whitespaces.html \ test_words.html \ $(NULL) diff --git a/accessible/tests/mochitest/text/test_singleline.html b/accessible/tests/mochitest/text/test_singleline.html index 6c10b6fa4d7..61f1b45366c 100644 --- a/accessible/tests/mochitest/text/test_singleline.html +++ b/accessible/tests/mochitest/text/test_singleline.html @@ -216,10 +216,10 @@ // BOUNDARY_WORD_START testTextBeforeOffset(0, BOUNDARY_WORD_START, "", 0, 0, - "input", kTodo, kOk, kTodo, - "div", kTodo, kOk, kTodo, - "editable", kTodo, kOk, kTodo, - "textarea", kTodo, kOk, kTodo); + "input", kOk, kOk, kOk, + "div", kOk, kOk, kOk, + "editable", kOk, kOk, kOk, + "textarea", kOk, kOk, kOk); testTextBeforeOffset(1, BOUNDARY_WORD_START, "", 0, 0, "input", kTodo, kOk, kTodo, "div", kTodo, kOk, kTodo, @@ -231,10 +231,10 @@ "editable", kTodo, kOk, kTodo, "textarea", kTodo, kOk, kTodo); testTextBeforeOffset(6, BOUNDARY_WORD_START, "hello ", 0, 6, - "input", kTodo, kOk, kTodo, - "div", kTodo, kOk, kTodo, - "editable", kTodo, kOk, kTodo, - "textarea", kTodo, kOk, kTodo); + "input", kOk, kOk, kOk, + "div", kOk, kOk, kOk, + "editable", kOk, kOk, kOk, + "textarea", kOk, kOk, kOk); testTextBeforeOffset(7, BOUNDARY_WORD_START, "hello ", 0, 6, "input", kTodo, kTodo, kTodo, "div", kTodo, kTodo, kTodo, @@ -246,10 +246,10 @@ "editable", kTodo, kTodo, kTodo, "textarea", kTodo, kTodo, kTodo); testTextBeforeOffset(9, BOUNDARY_WORD_START, "my ", 6, 9, - "input", kTodo, kOk, kTodo, - "div", kTodo, kOk, kTodo, - "editable", kTodo, kOk, kTodo, - "textarea", kTodo, kOk, kTodo); + "input", kOk, kOk, kOk, + "div", kOk, kOk, kOk, + "editable", kOk, kOk, kOk, + "textarea", kOk, kOk, kOk); testTextBeforeOffset(10, BOUNDARY_WORD_START, "my ", 6, 9, "input", kTodo, kTodo, kTodo, "div", kTodo, kTodo, kTodo, @@ -268,10 +268,10 @@ // BOUNDARY_WORD_END testTextBeforeOffset(0, BOUNDARY_WORD_END, "", 0, 0, - "input", kTodo, kOk, kTodo, - "div", kTodo, kOk, kTodo, - "editable", kTodo, kOk, kTodo, - "textarea", kTodo, kOk, kTodo); + "input", kOk, kOk, kOk, + "div", kOk, kOk, kOk, + "editable", kOk, kOk, kOk, + "textarea", kOk, kOk, kOk); testTextBeforeOffset(1, BOUNDARY_WORD_END, "", 0, 0, "input", kTodo, kOk, kTodo, "div", kTodo, kOk, kTodo, @@ -283,10 +283,10 @@ "editable", kTodo, kOk, kTodo, "textarea", kTodo, kOk, kTodo); testTextBeforeOffset(6, BOUNDARY_WORD_END, "hello ", 0, 6, - "input", kTodo, kTodo, kTodo, - "div", kTodo, kTodo, kTodo, - "editable", kTodo, kTodo, kTodo, - "textarea", kTodo, kTodo, kTodo); + "input", kTodo, kTodo, kOk, + "div", kTodo, kTodo, kOk, + "editable", kTodo, kTodo, kOk, + "textarea", kTodo, kTodo, kOk); testTextBeforeOffset(7, BOUNDARY_WORD_END, "hello ", 0, 6, "input", kTodo, kTodo, kTodo, "div", kTodo, kTodo, kTodo, @@ -320,10 +320,10 @@ // BOUNDARY_LINE_START testTextBeforeOffset(0, BOUNDARY_LINE_START, "", 0, 0, - "input", kTodo, kOk, kTodo, - "div", kTodo, kOk, kTodo, - "editable", kTodo, kOk, kTodo, - "textarea", kTodo, kOk, kTodo); + "input", kOk, kOk, kOk, + "div", kOk, kOk, kOk, + "editable", kOk, kOk, kOk, + "textarea", kOk, kOk, kOk); testTextBeforeOffset(1, BOUNDARY_LINE_START, "", 0, 0, "input", kTodo, kOk, kTodo, "div", kTodo, kOk, kTodo, @@ -342,10 +342,10 @@ // BOUNDARY_LINE_END testTextBeforeOffset(0, BOUNDARY_LINE_END, "", 0, 0, - "input", kTodo, kOk, kTodo, - "div", kTodo, kOk, kTodo, - "editable", kTodo, kOk, kTodo, - "textarea", kTodo, kOk, kTodo); + "input", kOk, kOk, kOk, + "div", kOk, kOk, kOk, + "editable", kOk, kOk, kOk, + "textarea", kOk, kOk, kOk); testTextBeforeOffset(1, BOUNDARY_LINE_END, "", 0, 0, "input", kTodo, kOk, kTodo, "div", kTodo, kOk, kTodo, diff --git a/accessible/tests/mochitest/text/test_whitespaces.html b/accessible/tests/mochitest/text/test_whitespaces.html index e6fa5b6110e..28ec7f4d321 100644 --- a/accessible/tests/mochitest/text/test_whitespaces.html +++ b/accessible/tests/mochitest/text/test_whitespaces.html @@ -196,10 +196,10 @@ // BOUNDARY_WORD_START testTextBeforeOffset(0, BOUNDARY_WORD_START, "", 0, 0, - "input", kTodo, kOk, kTodo, - "div", kTodo, kOk, kTodo, - "editable", kTodo, kOk, kTodo, - "textarea", kTodo, kOk, kTodo); + "input", kOk, kOk, kOk, + "div", kOk, kOk, kOk, + "editable", kOk, kOk, kOk, + "textarea", kOk, kOk, kOk); testTextBeforeOffset(1, BOUNDARY_WORD_START, "", 0, 0, "input", kTodo, kOk, kTodo, "div", kTodo, kOk, kTodo, @@ -211,10 +211,10 @@ "editable", kTodo, kOk, kTodo, "textarea", kTodo, kOk, kTodo); testTextBeforeOffset(6, BOUNDARY_WORD_START, "Brave ", 0, 6, - "input", kTodo, kOk, kTodo, - "div", kTodo, kOk, kTodo, - "editable", kTodo, kOk, kTodo, - "textarea", kTodo, kOk, kTodo); + "input", kOk, kOk, kOk, + "div", kOk, kOk, kOk, + "editable", kOk, kOk, kOk, + "textarea", kOk, kOk, kOk); testTextBeforeOffset(9, BOUNDARY_WORD_START, "Brave ", 0, 6, "input", kTodo, kTodo, kTodo, "div", kTodo, kTodo, kTodo, @@ -226,10 +226,10 @@ "editable", kTodo, kTodo, kTodo, "textarea", kTodo, kTodo, kTodo); testTextBeforeOffset(11, BOUNDARY_WORD_START, "Sir ", 6, 11, - "input", kTodo, kOk, kTodo, - "div", kTodo, kOk, kTodo, - "editable", kTodo, kOk, kTodo, - "textarea", kTodo, kOk, kTodo); + "input", kOk, kOk, kOk, + "div", kOk, kOk, kOk, + "editable", kOk, kOk, kOk, + "textarea", kOk, kOk, kOk); testTextBeforeOffset(15, BOUNDARY_WORD_START, "Sir ", 6, 11, "input", kTodo, kTodo, kTodo, "div", kTodo, kTodo, kTodo, @@ -251,10 +251,10 @@ "editable", kTodo, kTodo, kTodo, "textarea", kTodo, kTodo, kTodo); testTextBeforeOffset(19, BOUNDARY_WORD_START, "Robin ", 11, 19, - "input", kTodo, kOk, kTodo, - "div", kTodo, kOk, kTodo, - "editable", kTodo, kOk, kTodo, - "textarea", kTodo, kOk, kTodo); + "input", kOk, kOk, kOk, + "div", kOk, kOk, kOk, + "editable", kOk, kOk, kOk, + "textarea", kOk, kOk, kOk); testTextBeforeOffset(20, BOUNDARY_WORD_START, "Robin ", 11, 19, "input", kTodo, kTodo, kTodo, "div", kTodo, kTodo, kTodo, @@ -268,10 +268,10 @@ // BOUNDARY_WORD_END testTextBeforeOffset(0, BOUNDARY_WORD_END, "", 0, 0, - "input", kTodo, kOk, kTodo, - "div", kTodo, kOk, kTodo, - "editable", kTodo, kOk, kTodo, - "textarea", kTodo, kOk, kTodo); + "input", kOk, kOk, kOk, + "div", kOk, kOk, kOk, + "editable", kOk, kOk, kOk, + "textarea", kOk, kOk, kOk); testTextBeforeOffset(1, BOUNDARY_WORD_END, "", 0, 0, "input", kTodo, kOk, kTodo, "div", kTodo, kOk, kTodo, diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index e5edc632210..612107707bc 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -1005,6 +1005,19 @@ pref("devtools.chrome.enabled", false); // Change to -1 if you do not want the Web Console to remember its last height. pref("devtools.hud.height", 0); +// Remember the Web Console position. Possible values: +// above - above the web page, +// below - below the web page, +// window - in a separate window/popup panel. +pref("devtools.webconsole.position", "above"); + +// The number of lines that are displayed in the web console for the Net, +// CSS, JS and Web Developer categories. +pref("devtools.hud.loglimit.network", 200); +pref("devtools.hud.loglimit.cssparser", 200); +pref("devtools.hud.loglimit.exception", 200); +pref("devtools.hud.loglimit.console", 200); + // Whether the character encoding menu is under the main Firefox button. This // preference is a string so that localizers can alter it. pref("browser.menu.showCharacterEncoding", "chrome://browser/locale/browser.properties"); diff --git a/browser/base/content/browser.css b/browser/base/content/browser.css index bda8505d326..b661aa228b4 100644 --- a/browser/base/content/browser.css +++ b/browser/base/content/browser.css @@ -462,7 +462,6 @@ statuspanel { margin-top: -3em; left: 0; max-width: 50%; - -moz-transition: opacity 100ms ease-out; } statuspanel:-moz-locale-dir(ltr)[mirror], @@ -482,6 +481,7 @@ statuspanel[type=status] { } statuspanel[type=overLink] { + -moz-transition: opacity 100ms ease-out; direction: ltr; } diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 9281c70d70d..5d71bf8170e 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -1385,7 +1385,7 @@ function prepareForStartup() { gBrowser.addEventListener("NewPluginInstalled", gPluginHandler.newPluginInstalled, true); #ifdef XP_MACOSX gBrowser.addEventListener("npapi-carbon-event-model-failure", gPluginHandler, true); -#endif +#endif Services.obs.addObserver(gPluginHandler.pluginCrashed, "plugin-crashed", false); @@ -6698,12 +6698,15 @@ var gPluginHandler = { handleEvent : function(event) { let self = gPluginHandler; let plugin = event.target; - let hideBarPrefName; + let doc = plugin.ownerDocument; // We're expecting the target to be a plugin. if (!(plugin instanceof Ci.nsIObjectLoadingContent)) return; + // Force a style flush, so that we ensure our binding is attached. + plugin.clientTop; + switch (event.type) { case "PluginCrashed": self.pluginInstanceCrashed(plugin, event); @@ -6713,32 +6716,38 @@ var gPluginHandler = { // For non-object plugin tags, register a click handler to install the // plugin. Object tags can, and often do, deal with that themselves, // so don't stomp on the page developers toes. - if (!(plugin instanceof HTMLObjectElement)) - self.addLinkClickCallback(plugin, "installSinglePlugin"); + if (!(plugin instanceof HTMLObjectElement)) { + // We don't yet check to see if there's actually an installer available. + let installStatus = doc.getAnonymousElementByAttribute(plugin, "class", "installStatus"); + installStatus.setAttribute("status", "ready"); + let iconStatus = doc.getAnonymousElementByAttribute(plugin, "class", "icon"); + iconStatus.setAttribute("status", "ready"); + + let installLink = doc.getAnonymousElementByAttribute(plugin, "class", "installPluginLink"); + self.addLinkClickCallback(installLink, "installSinglePlugin", plugin); + } /* FALLTHRU */ + case "PluginBlocklisted": case "PluginOutdated": - hideBarPrefName = event.type == "PluginOutdated" ? - "plugins.hide_infobar_for_outdated_plugin" : - "plugins.hide_infobar_for_missing_plugin"; - if (gPrefService.getBoolPref(hideBarPrefName)) - return; - - self.pluginUnavailable(plugin, event.type); - break; #ifdef XP_MACOSX case "npapi-carbon-event-model-failure": - hideBarPrefName = "plugins.hide_infobar_for_carbon_failure_plugin"; - if (gPrefService.getBoolPref(hideBarPrefName)) - return; - +#endif self.pluginUnavailable(plugin, event.type); break; -#endif + case "PluginDisabled": - self.addLinkClickCallback(plugin, "managePlugins"); + let manageLink = doc.getAnonymousElementByAttribute(plugin, "class", "managePluginsLink"); + self.addLinkClickCallback(manageLink, "managePlugins"); break; } + + // Hide the in-content UI if it's too big. The crashed plugin handler already did this. + if (event.type != "PluginCrashed") { + let overlay = doc.getAnonymousElementByAttribute(plugin, "class", "mainBox"); + if (self.isTooSmall(plugin, overlay)) + overlay.style.visibility = "hidden"; + } }, newPluginInstalled : function(event) { @@ -6757,10 +6766,10 @@ var gPluginHandler = { }, // Callback for user clicking on a missing (unsupported) plugin. - installSinglePlugin: function (aEvent) { + installSinglePlugin: function (plugin) { var missingPluginsArray = {}; - var pluginInfo = getPluginInfo(aEvent.target); + var pluginInfo = getPluginInfo(plugin); missingPluginsArray[pluginInfo.mimetype] = pluginInfo; openDialog("chrome://mozapps/content/plugins/pluginInstallerWizard.xul", @@ -6810,9 +6819,6 @@ var gPluginHandler = { let blockedNotification = notificationBox.getNotificationWithValue("blocked-plugins"); let missingNotification = notificationBox.getNotificationWithValue("missing-plugins"); - // If there is already an outdated plugin notification then do nothing - if (outdatedNotification) - return; function showBlocklistInfo() { var url = formatURL("extensions.blocklist.detailsURL", true); @@ -6844,7 +6850,7 @@ var gPluginHandler = { let cancelQuit = Cc["@mozilla.org/supports-PRBool;1"]. createInstance(Ci.nsISupportsPRBool); Services.obs.notifyObservers(cancelQuit, "quit-application-requested", null); - + // Something aborted the quit process. if (cancelQuit.data) return; @@ -6908,10 +6914,17 @@ var gPluginHandler = { } #endif }; + + // If there is already an outdated plugin notification then do nothing + if (outdatedNotification) + return; + #ifdef XP_MACOSX if (eventType == "npapi-carbon-event-model-failure") { + if (gPrefService.getBoolPref("plugins.hide_infobar_for_carbon_failure_plugin")) + return; - let carbonFailureNotification = + let carbonFailureNotification = notificationBox.getNotificationWithValue("carbon-failure-plugins"); if (carbonFailureNotification) @@ -6923,11 +6936,18 @@ var gPluginHandler = { eventType = "PluginNotFound"; } #endif + if (eventType == "PluginBlocklisted") { + if (gPrefService.getBoolPref("plugins.hide_infobar_for_missing_plugin")) // XXX add a new pref? + return; + if (blockedNotification || missingNotification) return; } else if (eventType == "PluginOutdated") { + if (gPrefService.getBoolPref("plugins.hide_infobar_for_outdated_plugin")) + return; + // Cancel any notification about blocklisting/missing plugins if (blockedNotification) blockedNotification.close(); @@ -6935,6 +6955,9 @@ var gPluginHandler = { missingNotification.close(); } else if (eventType == "PluginNotFound") { + if (gPrefService.getBoolPref("plugins.hide_infobar_for_missing_plugin")) + return; + if (missingNotification) return; @@ -6990,9 +7013,6 @@ var gPluginHandler = { // Remap the plugin name to a more user-presentable form. pluginName = this.makeNicePluginName(pluginName, pluginFilename); - // Force a style flush, so that we ensure our binding is attached. - plugin.clientTop; - let messageString = gNavigatorBundle.getFormattedString("crashedpluginsMessage.title", [pluginName]); // @@ -7000,12 +7020,6 @@ var gPluginHandler = { // let doc = plugin.ownerDocument; let overlay = doc.getAnonymousElementByAttribute(plugin, "class", "mainBox"); - - // The binding has role="link" here, since missing/disabled/blocked - // plugin UI has a onclick handler on the whole thing. This isn't needed - // for the plugin-crashed UI, because we use actual HTML links in the text. - overlay.removeAttribute("role"); - let statusDiv = doc.getAnonymousElementByAttribute(plugin, "class", "submitStatus"); #ifdef MOZ_CRASHREPORTER let status; diff --git a/browser/base/content/scratchpad.js b/browser/base/content/scratchpad.js index 054317b00c0..6781d02c052 100644 --- a/browser/base/content/scratchpad.js +++ b/browser/base/content/scratchpad.js @@ -58,7 +58,7 @@ Cu.import("resource://gre/modules/NetUtil.jsm"); Cu.import("resource:///modules/PropertyPanel.jsm"); const SCRATCHPAD_CONTEXT_CONTENT = 1; -const SCRATCHPAD_CONTEXT_CHROME = 2; +const SCRATCHPAD_CONTEXT_BROWSER = 2; const SCRATCHPAD_WINDOW_URL = "chrome://browser/content/scratchpad.xul"; const SCRATCHPAD_L10N = "chrome://browser/locale/scratchpad.properties"; const SCRATCHPAD_WINDOW_FEATURES = "chrome,titlebar,toolbar,centerscreen,resizable,dialog=no"; @@ -75,7 +75,7 @@ var Scratchpad = { * Possible values: * - SCRATCHPAD_CONTEXT_CONTENT to execute code in the context of the current * tab content window object. - * - SCRATCHPAD_CONTEXT_CHROME to execute code in the context of the + * - SCRATCHPAD_CONTEXT_BROWSER to execute code in the context of the * currently active chrome window object. */ executionContext: SCRATCHPAD_CONTEXT_CONTENT, @@ -121,6 +121,11 @@ var Scratchpad = { return recentWin ? recentWin.gBrowser : null; }, + insertIntro: function SP_insertIntro() + { + this.textbox.value = this.strings.GetStringFromName("scratchpadIntro"); + }, + /** * Cached Cu.Sandbox object for the active tab content window object. */ @@ -129,8 +134,9 @@ var Scratchpad = { /** * Get the Cu.Sandbox object for the active tab content window object. Note * that the returned object is cached for later reuse. The cached object is - * kept only for the current browser window and it is reset for each context - * switch or navigator:browser window switch. + * kept only for the current location in the current tab of the current + * browser window and it is reset for each context switch, + * navigator:browser window switch, tab switch or navigation. */ get contentSandbox() { @@ -141,12 +147,16 @@ var Scratchpad = { } if (!this._contentSandbox || - this.browserWindow != this._previousBrowserWindow) { + this.browserWindow != this._previousBrowserWindow || + this._previousBrowser != this.gBrowser.selectedBrowser || + this._previousLocation != this.gBrowser.contentWindow.location.href) { let contentWindow = this.gBrowser.selectedBrowser.contentWindow; this._contentSandbox = new Cu.Sandbox(contentWindow, { sandboxPrototype: contentWindow, wantXrays: false }); this._previousBrowserWindow = this.browserWindow; + this._previousBrowser = this.gBrowser.selectedBrowser; + this._previousLocation = contentWindow.location.href; } return this._contentSandbox; @@ -283,7 +293,7 @@ var Scratchpad = { * Execute the selected text (if any) or the entire textbox content in the * current context. */ - execute: function SP_execute() + run: function SP_run() { let selection = this.selectedText || this.textbox.value; let result = this.evalForContext(selection); @@ -298,7 +308,7 @@ var Scratchpad = { */ inspect: function SP_inspect() { - let [selection, result] = this.execute(); + let [selection, result] = this.run(); if (result) { this.openPropertyPanel(selection, result); @@ -307,11 +317,11 @@ var Scratchpad = { /** * Execute the selected text (if any) or the entire textbox content in the - * current context. The evaluation result is "printed" in the textbox after + * current context. The evaluation result is inserted into the textbox after * the selected text, or at the end of the textbox value if there is no * selected text. */ - print: function SP_print() + display: function SP_display() { let selectionStart = this.textbox.selectionStart; let selectionEnd = this.textbox.selectionEnd; @@ -319,7 +329,7 @@ var Scratchpad = { selectionEnd = this.textbox.value.length; } - let [selection, result] = this.execute(); + let [selection, result] = this.run(); if (!result) { return; } @@ -556,23 +566,23 @@ var Scratchpad = { setContentContext: function SP_setContentContext() { let content = document.getElementById("sp-menu-content"); - document.getElementById("sp-menu-chrome").removeAttribute("checked"); + document.getElementById("sp-menu-browser").removeAttribute("checked"); content.setAttribute("checked", true); - this.statusbarStatus.label = content.getAttribute("label"); this.executionContext = SCRATCHPAD_CONTEXT_CONTENT; + this.statusbarStatus.label = content.getAttribute("label"); this.resetContext(); }, /** * Set the current execution context to be the most recent chrome window. */ - setChromeContext: function SP_setChromeContext() + setBrowserContext: function SP_setBrowserContext() { - let chrome = document.getElementById("sp-menu-chrome"); + let browser = document.getElementById("sp-menu-browser"); document.getElementById("sp-menu-content").removeAttribute("checked"); - chrome.setAttribute("checked", true); - this.statusbarStatus.label = chrome.getAttribute("label"); - this.executionContext = SCRATCHPAD_CONTEXT_CHROME; + browser.setAttribute("checked", true); + this.executionContext = SCRATCHPAD_CONTEXT_BROWSER; + this.statusbarStatus.label = browser.getAttribute("label"); this.resetContext(); }, @@ -584,6 +594,8 @@ var Scratchpad = { this._chromeSandbox = null; this._contentSandbox = null; this._previousWindow = null; + this._previousBrowser = null; + this._previousLocation = null; }, /** @@ -604,10 +616,10 @@ var Scratchpad = { */ onLoad: function SP_onLoad() { - let chromeContextMenu = document.getElementById("sp-menu-chrome"); + let chromeContextMenu = document.getElementById("sp-menu-browser"); let errorConsoleMenu = document.getElementById("sp-menu-errorConsole"); let errorConsoleCommand = document.getElementById("sp-cmd-errorConsole"); - let chromeContextCommand = document.getElementById("sp-cmd-chromeContext"); + let chromeContextCommand = document.getElementById("sp-cmd-browserContext"); let chrome = Services.prefs.getBoolPref(DEVTOOLS_CHROME_ENABLED); if (chrome) { @@ -616,6 +628,7 @@ var Scratchpad = { errorConsoleCommand.removeAttribute("disabled"); chromeContextCommand.removeAttribute("disabled"); } + this.insertIntro(); }, }; diff --git a/browser/base/content/scratchpad.xul b/browser/base/content/scratchpad.xul index 656954756e9..6271b692794 100644 --- a/browser/base/content/scratchpad.xul +++ b/browser/base/content/scratchpad.xul @@ -70,11 +70,11 @@ --> - + - + - + @@ -118,17 +118,17 @@ - - - - + + + + + + - + - - + + - @@ -328,7 +333,7 @@ multiline="true" flex="1" context="scratchpad-text-popup" - placeholder="&textbox.placeholder;" /> + placeholder="&textbox.placeholder1;" /> - + diff --git a/browser/components/preferences/aboutPermissions.js b/browser/components/preferences/aboutPermissions.js index dbee208a67e..745be4c0968 100644 --- a/browser/components/preferences/aboutPermissions.js +++ b/browser/components/preferences/aboutPermissions.js @@ -587,12 +587,10 @@ let AboutPermissions = { for each (let site in this._sites) { if (site.host.hasRootDomain(aHost)) { if (site == this._selectedSite) { - // Clear site data from the DOM to maximize privacy. - document.getElementById("site-label").value = ""; - document.getElementById("permissions-box").hidden = true; - this._selectedSite = null; + // Replace site-specific interface with "All Sites" interface. + this.sitesList.selectedItem = document.getElementById("all-sites-item"); } - + this.sitesList.removeChild(site.listitem); delete this._sites[site.host]; } @@ -604,6 +602,8 @@ let AboutPermissions = { */ onSitesListSelect: function(event) { if (event.target.selectedItem.id == "all-sites-item") { + // Clear the header label value from the previously selected site. + document.getElementById("site-label").value = ""; this.manageDefaultPermissions(); return; } @@ -641,8 +641,6 @@ let AboutPermissions = { this.updatePasswordsCount(); this.updateCookiesCount(); - - document.getElementById("permissions-box").hidden = false; }, /** diff --git a/browser/components/preferences/aboutPermissions.xul b/browser/components/preferences/aboutPermissions.xul index 310dd778755..2a5786951d9 100644 --- a/browser/components/preferences/aboutPermissions.xul +++ b/browser/components/preferences/aboutPermissions.xul @@ -74,7 +74,7 @@ -