This commit is contained in:
Richard Newman 2012-02-14 12:55:18 -08:00
Родитель 6719151237 bff488c47e
Коммит 95d57dfb66
443 изменённых файлов: 9858 добавлений и 7880 удалений

6
.gitignore поставляемый
Просмотреть файл

@ -41,7 +41,7 @@ parser/html/java/htmlparser/
parser/html/java/javaparser/
# Ignore the files and directory that Eclipse IDE creates
/.project
/.cproject
/.settings/
.project
.cproject
.settings/

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

@ -41,7 +41,7 @@ _OPT\.OBJ/
\.svn/
# Ignore the files and directory that Eclipse IDE creates
^\.project$
^\.cproject$
^\.settings$
\.project$
\.cproject$
\.settings/

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

@ -49,7 +49,6 @@ DEFFILE = $(win_srcdir)/AccessibleMarshal.def
include $(DEPTH)/config/autoconf.mk
XPIDLSRCS = \
nsIAccessibleWin32Object.idl \
nsIWinAccessNode.idl \
$(NULL)

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

@ -529,6 +529,25 @@ interface nsIAccessibleTextChangeEvent : nsISupports
readonly attribute DOMString modifiedText;
};
[scriptable, uuid(a2bd2eca-3afa-489b-afb2-f93ef32ad99c)]
interface nsIAccessibleHideEvent: nsISupports
{
/**
* Return an accessible that was a parent of the target.
*/
readonly attribute nsIAccessible targetParent;
/**
* Return an accessible that was a next sibling of the target
*/
readonly attribute nsIAccessible targetNextSibling;
/**
* Return an accessible that was a parent of the target
*/
readonly attribute nsIAccessible targetPrevSibling;
};
[scriptable, uuid(5675c486-a230-4d85-a4bd-33670826d5ff)]
interface nsIAccessibleCaretMoveEvent: nsISupports
{

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

@ -291,6 +291,14 @@ AccHideEvent::
mPrevSibling = mAccessible->PrevSibling();
}
already_AddRefed<nsAccEvent>
AccHideEvent::CreateXPCOMObject()
{
nsAccEvent* event = new nsAccHideEvent(this);
NS_ADDREF(event);
return event;
}
////////////////////////////////////////////////////////////////////////////////
// AccShowEvent

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

@ -270,12 +270,19 @@ public:
AccHideEvent(nsAccessible* aTarget, nsINode* aTargetNode);
// Event
virtual already_AddRefed<nsAccEvent> CreateXPCOMObject();
static const EventGroup kEventGroup = eHideEvent;
virtual unsigned int GetEventGroups() const
{
return AccMutationEvent::GetEventGroups() | (1U << eHideEvent);
}
// AccHideEvent
nsAccessible* TargetParent() const { return mParent; }
nsAccessible* TargetNextSibling() const { return mNextSibling; }
nsAccessible* TargetPrevSibling() const { return mPrevSibling; }
protected:
nsRefPtr<nsAccessible> mParent;
nsRefPtr<nsAccessible> mNextSibling;

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

@ -287,11 +287,12 @@ FocusManager::ProcessFocusEvent(AccEvent* aEvent)
// if it's still focused and then update active item and emit focus event.
nsAccessible* target = aEvent->GetAccessible();
if (target != mActiveItem) {
// Check if still focused. Otherwise we can end up with storing the active
// item for control that isn't focused anymore.
nsAccessible* DOMFocus =
GetAccService()->GetAccessibleOrContainer(FocusedDOMNode(),
aEvent->GetDocAccessible());
nsDocAccessible* document = aEvent->GetDocAccessible();
nsAccessible* DOMFocus = document->GetAccessibleOrContainer(FocusedDOMNode());
if (target != DOMFocus)
return;

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

@ -669,9 +669,8 @@ NotificationController::CoalesceTextChangeEventsFor(AccShowEvent* aTailEvent,
void
NotificationController::CreateTextChangeEventFor(AccMutationEvent* aEvent)
{
nsAccessible* container =
GetAccService()->GetContainerAccessible(aEvent->mNode,
aEvent->GetDocAccessible());
nsDocAccessible* document = aEvent->GetDocAccessible();
nsAccessible* container = document->GetContainerAccessible(aEvent->mNode);
if (!container)
return;

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

@ -235,8 +235,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] =
eNoValue,
eNoAction,
eNoLiveAttr,
states::READONLY,
eARIAMultiSelectable
states::READONLY
},
{
"listbox",
@ -256,9 +255,7 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] =
eNoValue,
eNoAction, // XXX: should depend on state, parent accessible
eNoLiveAttr,
states::READONLY,
eARIASelectable,
eARIACheckedMixed
states::READONLY
},
{
"log",

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

@ -283,38 +283,6 @@ nsAccessNode::ScrollTo(PRUint32 aScrollType)
nsIPresShell::SCROLL_OVERFLOW_HIDDEN);
}
// nsAccessNode public
already_AddRefed<nsINode>
nsAccessNode::GetCurrentFocus()
{
// XXX: consider to use nsFocusManager directly, it allows us to avoid
// unnecessary query interface calls.
nsIDocument* doc = GetDocumentNode();
NS_ENSURE_TRUE(doc, nsnull);
nsIDOMWindow* win = doc->GetWindow();
nsCOMPtr<nsIDOMWindow> focusedWindow;
nsCOMPtr<nsIDOMElement> focusedElement;
nsCOMPtr<nsIFocusManager> fm = do_GetService(FOCUSMANAGER_CONTRACTID);
if (fm)
fm->GetFocusedElementForWindow(win, true, getter_AddRefs(focusedWindow),
getter_AddRefs(focusedElement));
nsINode *focusedNode = nsnull;
if (focusedElement) {
CallQueryInterface(focusedElement, &focusedNode);
}
else if (focusedWindow) {
nsCOMPtr<nsIDOMDocument> doc;
focusedWindow->GetDocument(getter_AddRefs(doc));
if (doc)
CallQueryInterface(doc, &focusedNode);
}
return focusedNode;
}
void
nsAccessNode::Language(nsAString& aLanguage)
{

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

@ -95,14 +95,6 @@ public:
*/
nsRootAccessible* RootAccessible() const;
/**
* Return focused node within accessible window.
*
* XXX: it shouldn't break us if we return focused node not depending on
* window so that we can turn this method into util method.
*/
already_AddRefed<nsINode> GetCurrentFocus();
/**
* Initialize the access node object, add it to the cache.
*/
@ -161,12 +153,6 @@ public:
*/
virtual bool IsPrimaryForNode() const;
/**
* Return the string bundle
*/
static nsIStringBundle* GetStringBundle()
{ return gStringBundle; }
/**
* Interface methods on nsIAccessible shared with ISimpleDOM.
*/

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

@ -919,17 +919,6 @@ nsAccessibilityService::GetAccessible(nsINode* aNode, nsIPresShell* aPresShell)
return document ? document->GetAccessible(aNode) : nsnull;
}
nsAccessible*
nsAccessibilityService::GetAccessibleOrContainer(nsINode* aNode, nsDocAccessible* aDoc)
{
if (!aNode)
return nsnull;
NS_PRECONDITION(aDoc, "Must pass a document accessible.");
return aDoc ? aDoc->GetAccessibleOrContainer(aNode) : nsnull;
}
static bool HasRelatedContent(nsIContent *aContent)
{
nsAutoString id;

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

@ -197,24 +197,6 @@ public:
*/
nsAccessible* GetAccessible(nsINode* aNode, nsIPresShell* aPresShell);
/**
* Return an accessible for the given DOM node or container accessible if
* the node is not accessible.
*
* @param aNode [in] the given node
* @param aDoc [in] the document accessible. Can't be null.
*/
nsAccessible* GetAccessibleOrContainer(nsINode* aNode, nsDocAccessible* aDoc);
/**
* Return a container accessible for the given DOM node.
*/
nsAccessible* GetContainerAccessible(nsINode* aNode, nsDocAccessible* aDoc)
{
return aNode ?
GetAccessibleOrContainer(aNode->GetNodeParent(), aDoc) : nsnull;
}
private:
// nsAccessibilityService creation is controlled by friend
// NS_GetAccessibilityService, keep constructors private.

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

@ -852,8 +852,7 @@ nsAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY,
// Get accessible for the node with the point or the first accessible in
// the DOM parent chain.
nsAccessible* accessible =
GetAccService()->GetAccessibleOrContainer(content, accDocument);
nsAccessible* accessible = accDocument->GetAccessibleOrContainer(content);
if (!accessible)
return fallbackAnswer;
@ -1147,7 +1146,7 @@ nsAccessible::TakeFocus()
}
nsCOMPtr<nsIDOMElement> element(do_QueryInterface(focusContent));
nsCOMPtr<nsIFocusManager> fm = do_GetService(FOCUSMANAGER_CONTRACTID);
nsFocusManager* fm = nsFocusManager::GetFocusManager();
if (fm)
fm->SetFocus(element, 0);

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

@ -378,7 +378,7 @@ NS_IMETHODIMP nsDocAccessible::TakeFocus()
return NS_ERROR_FAILURE;
// Focus the document.
nsCOMPtr<nsIFocusManager> fm = do_GetService(FOCUSMANAGER_CONTRACTID);
nsFocusManager* fm = nsFocusManager::GetFocusManager();
NS_ENSURE_STATE(fm);
nsCOMPtr<nsIDOMElement> newFocus;

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

@ -203,7 +203,7 @@ nsRootAccessible::NativeState()
states |= states::MODAL;
#endif
nsCOMPtr<nsIFocusManager> fm = do_GetService(FOCUSMANAGER_CONTRACTID);
nsFocusManager* fm = nsFocusManager::GetFocusManager();
if (fm) {
nsCOMPtr<nsIDOMWindow> rootWindow;
GetWindow(getter_AddRefs(rootWindow));

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

@ -1628,8 +1628,16 @@ nsHyperTextAccessible::SetCaretOffset(PRInt32 aCaretOffset)
NS_IMETHODIMP
nsHyperTextAccessible::GetCaretOffset(PRInt32 *aCaretOffset)
{
NS_ENSURE_ARG_POINTER(aCaretOffset);
*aCaretOffset = -1;
// Not focused focusable accessible except document accessible doesn't have
// a caret.
if (!IsDoc() && !FocusMgr()->IsFocused(this) &&
(State() & states::FOCUSABLE)) {
return NS_OK;
}
// No caret if the focused node is not inside this DOM node and this DOM node
// is not inside of focused node.
FocusManager::FocusDisposition focusDisp =

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

@ -50,7 +50,6 @@
#include "nsIAccessibleEvent.h"
#include "nsIAccessibleRelation.h"
#include "nsIAccessibleWin32Object.h"
#include "Accessible2_i.c"
#include "AccessibleStates.h"
@ -1684,29 +1683,16 @@ nsAccessibleWrap::ConvertToIA2Attributes(nsIPersistentProperties *aAttributes,
return *aIA2Attributes ? S_OK : E_OUTOFMEMORY;
}
IDispatch *nsAccessibleWrap::NativeAccessible(nsIAccessible *aXPAccessible)
IDispatch*
nsAccessibleWrap::NativeAccessible(nsIAccessible* aAccessible)
{
if (!aXPAccessible) {
NS_WARNING("Not passing in an aXPAccessible");
if (!aAccessible) {
NS_WARNING("Not passing in an aAccessible");
return NULL;
}
nsCOMPtr<nsIAccessibleWin32Object> accObject(do_QueryInterface(aXPAccessible));
if (accObject) {
void* hwnd = nsnull;
accObject->GetHwnd(&hwnd);
if (hwnd) {
IDispatch *retval = nsnull;
::AccessibleObjectFromWindow(reinterpret_cast<HWND>(hwnd),
OBJID_WINDOW, IID_IAccessible,
(void **) &retval);
return retval;
}
}
IAccessible *msaaAccessible;
aXPAccessible->GetNativeInterface((void**)&msaaAccessible);
IAccessible* msaaAccessible = nsnull;
aAccessible->GetNativeInterface(reinterpret_cast<void**>(&msaaAccessible));
return static_cast<IDispatch*>(msaaAccessible);
}

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

@ -114,11 +114,16 @@ nsLeafAccessible(nsnull, nsnull)
}
}
NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLWin32ObjectAccessible, nsAccessible, nsIAccessibleWin32Object)
NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLWin32ObjectAccessible, nsAccessible)
NS_IMETHODIMP nsHTMLWin32ObjectAccessible::GetHwnd(void **aHwnd)
NS_IMETHODIMP
nsHTMLWin32ObjectAccessible::GetNativeInterface(void** aNativeAccessible)
{
*aHwnd = mHwnd;
if (mHwnd) {
::AccessibleObjectFromWindow(static_cast<HWND>(mHwnd),
OBJID_WINDOW, IID_IAccessible,
aNativeAccessible);
}
return NS_OK;
}

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

@ -39,7 +39,6 @@
#ifndef _nsHTMLWin32ObjectAccessible_H_
#define _nsHTMLWin32ObjectAccessible_H_
#include "nsIAccessibleWin32Object.h"
#include "nsBaseWidgetAccessible.h"
struct IAccessible;
@ -82,8 +81,7 @@ protected:
* object returned by us in Accessible::NewAccessible() that gets the IAccessible
* from the windows system from the window handle.
*/
class nsHTMLWin32ObjectAccessible : public nsLeafAccessible,
public nsIAccessibleWin32Object
class nsHTMLWin32ObjectAccessible : public nsLeafAccessible
{
public:
@ -91,7 +89,8 @@ public:
virtual ~nsHTMLWin32ObjectAccessible() {}
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLEWIN32OBJECT
NS_IMETHOD GetNativeInterface(void** aNativeAccessible) MOZ_OVERRIDE;
protected:
void* mHwnd;

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

@ -173,6 +173,44 @@ nsAccTextChangeEvent::GetModifiedText(nsAString& aModifiedText)
}
////////////////////////////////////////////////////////////////////////////////
// nsAccHideEvent
////////////////////////////////////////////////////////////////////////////////
NS_IMPL_ISUPPORTS_INHERITED1(nsAccHideEvent, nsAccEvent,
nsIAccessibleHideEvent)
NS_IMETHODIMP
nsAccHideEvent::GetTargetParent(nsIAccessible** aAccessible)
{
NS_ENSURE_ARG_POINTER(aAccessible);
NS_IF_ADDREF(*aAccessible =
static_cast<AccHideEvent*>(mEvent.get())->TargetParent());
return NS_OK;
}
NS_IMETHODIMP
nsAccHideEvent::GetTargetNextSibling(nsIAccessible** aAccessible)
{
NS_ENSURE_ARG_POINTER(aAccessible);
NS_IF_ADDREF(*aAccessible =
static_cast<AccHideEvent*>(mEvent.get())->TargetNextSibling());
return NS_OK;
}
NS_IMETHODIMP
nsAccHideEvent::GetTargetPrevSibling(nsIAccessible** aAccessible)
{
NS_ENSURE_ARG_POINTER(aAccessible);
NS_IF_ADDREF(*aAccessible =
static_cast<AccHideEvent*>(mEvent.get())->TargetPrevSibling());
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
// nsAccCaretMoveEvent
////////////////////////////////////////////////////////////////////////////////

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

@ -105,6 +105,26 @@ private:
};
/**
* Accessible hide event.
*/
class nsAccHideEvent : public nsAccEvent,
public nsIAccessibleHideEvent
{
public:
nsAccHideEvent(AccHideEvent* aEvent) : nsAccEvent(aEvent) { }
virtual ~nsAccHideEvent() { }
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLEHIDEEVENT
private:
nsAccHideEvent() MOZ_DELETE;
nsAccHideEvent(const nsAccHideEvent&) MOZ_DELETE;
nsAccHideEvent& operator =(const nsAccHideEvent&) MOZ_DELETE;
};
/**
* Accessible caret move event.
*/

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

@ -282,27 +282,6 @@ function getApplicationAccessible()
QueryInterface(nsIAccessibleApplication);
}
/**
* Run through accessible tree of the given identifier so that we ensure
* accessible tree is created.
*/
function ensureAccessibleTree(aAccOrElmOrID)
{
var acc = getAccessible(aAccOrElmOrID);
if (!acc)
return;
var child = acc.firstChild;
while (child) {
ensureAccessibleTree(child);
try {
child = child.nextSibling;
} catch (e) {
child = null;
}
}
}
/**
* Compare expected and actual accessibles trees.
*

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

@ -46,21 +46,8 @@
// gA11yEventDumpID = "eventdump"; // debug stuff
//gA11yEventDumpToConsole = true;
function testCaretOffset(aAccOrElmOrID, aCaretOffset)
{
var acc = getAccessible(aAccOrElmOrID, [nsIAccessibleText]);
is(acc.caretOffset, aCaretOffset,
"Wrong caret offset for " + aAccOrElmOrID);
}
function doTests()
{
todo(false, "enable commented tests Bug 510128 is fixed");
// test no focused accessibles
//testCaretOffset("textbox", -1);
//testCaretOffset("textarea", -1);
testCaretOffset("p", -1);
// test caret move events and caret offsets
gQueue = new eventQueue();

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

@ -51,7 +51,6 @@
this.invoke = function removeChildSpan_invoke()
{
// remove HTML span, a first child of the node
ensureAccessibleTree(this.DOMNode);
this.DOMNode.removeChild(this.DOMNode.firstChild);
}
@ -158,8 +157,6 @@
this.invoke = function removeChildren_invoke()
{
ensureAccessibleTree(this.DOMNode);
if (aLastToFirst) {
while (this.DOMNode.firstChild)
this.DOMNode.removeChild(this.DOMNode.lastChild);

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

@ -129,11 +129,6 @@
gTreeBox.view = gView;
}
this.finalCheck = function setTreeView_finalCheck(aEvent)
{
ensureAccessibleTree(gTree);
}
this.getID = function setTreeView_getID() { return "set tree view"; }
this.eventSeq = [
@ -174,11 +169,30 @@
{
this.invoke = function invalidateColumn_invoke()
{
// Make sure accessibles for the tree is created because it makes
// sure accessible events will be fired.
// Make sure tree children accessibles are created otherwise they won't
// be a cause of name changed events.
ensureAccessibleTree(gTree);
// Make sure accessible subtree of XUL tree is created otherwise no
// name change events for cell accessibles are emitted.
var tree = getAccessible(gTree);
var child = tree.firstChild;
var walkDown = true;
while (child != tree) {
if (walkDown) {
var grandChild = child.firstChild;
if (grandChild) {
child = grandChild;
continue;
}
}
var sibling = child.nextSibling;
if (sibling) {
child = sibling;
walkDown = true;
continue;
}
child = child.parent;
walkDown = false;
}
// Fire 'TreeInvalidated' event by InvalidateColumn()
var firstCol = gTree.columns.getFirstColumn();

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

@ -96,9 +96,9 @@
<a id="link" href="">link</span>
<div role="listbox" aria-activedescendant="item1" id="container" tabindex="1">
<div role="listitem" id="item1">item1</div>
<div role="listitem" id="item2">item2</div>
<div role="listitem" id="item3">item3</div>
<div role="option" id="item1">item1</div>
<div role="option" id="item2">item2</div>
<div role="option" id="item3">item3</div>
</div>
<embed id="plugin" type="application/x-test" width="200" height="200" wmode="window"></embed>

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

@ -122,8 +122,6 @@ function testNamesForMarkupRules(aMarkupElm, aContainer)
if (gDumpToConsole)
dump("\nProcessing markup rules '" + aMarkupElm.getAttribute("id") + "'\n");
ensureAccessibleTree(aContainer);
var serializer = new XMLSerializer();
var expr = "//html/body/div[@id='test']/" + aMarkupElm.getAttribute("ref");

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

@ -21,27 +21,11 @@
src="../events.js"></script>
<script type="application/javascript"
src="../relations.js"></script>
<script type="application/javascript"
src="../browser.js"></script>
<script type="application/javascript">
<![CDATA[
////////////////////////////////////////////////////////////////////////////
// Helpers
function tabBrowser()
{
return gBrowserWnd.gBrowser;
}
function currentBrowser()
{
return tabBrowser().selectedBrowser;
}
function currentTabDocument()
{
return currentBrowser().contentDocument;
}
////////////////////////////////////////////////////////////////////////////
// Invokers
@ -58,7 +42,7 @@
this.finalCheck = function loadURI_finalCheck()
{
testRelation(gBrowserWnd.document, RELATION_EMBEDS,
testRelation(browserDocument(), RELATION_EMBEDS,
getAccessible(currentTabDocument()));
}
@ -81,7 +65,7 @@
this.finalCheck = function loadURI_finalCheck()
{
testRelation(gBrowserWnd.document, RELATION_EMBEDS,
testRelation(browserDocument(), RELATION_EMBEDS,
getAccessible(currentTabDocument()));
}
@ -94,28 +78,12 @@
////////////////////////////////////////////////////////////////////////////
// Testing
var gBrowserWnd = null;
function loadBrowser()
{
gBrowserWnd = window.openDialog("chrome://browser/content/", "_blank",
"chrome,all,dialog=no", "about:");
addA11yLoadEvent(startTests, gBrowserWnd);
}
function startTests()
{
// Wait for tab load.
var browser = currentBrowser();
addA11yLoadEvent(doTests, browser.contentWindow);
}
//gA11yEventDumpToConsole = true; // debug
var gQueue = null;
function doTests()
{
testRelation(gBrowserWnd.document, RELATION_EMBEDS,
testRelation(browserDocument(), RELATION_EMBEDS,
getAccessible(currentTabDocument()));
gQueue = new eventQueue();
@ -125,13 +93,13 @@
gQueue.onFinish = function()
{
gBrowserWnd.close();
closeBrowserWindow();
}
gQueue.invoke();
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(loadBrowser);
openBrowserWindow(doTests, "about:");
]]>
</script>

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

@ -36,25 +36,6 @@
function doTest()
{
//////////////////////////////////////////////////////////////////////////
// role="list"
var id = "list1";
ok(isAccessible(id, [nsIAccessibleSelectable]),
"No selectable accessible for " + id);
testSelectableSelection(id, [ ]);
var select = getAccessible(id, [nsIAccessibleSelectable]);
select.addChildToSelection(0);
testSelectableSelection(id, [ ]);
select.removeChildFromSelection(0);
testSelectableSelection(id, [ ]);
select.selectAllSelection();
testSelectableSelection(id, [ ]);
select.clearSelection();
testSelectableSelection(id, [ ]);
//////////////////////////////////////////////////////////////////////////
// role="listbox"
@ -82,7 +63,7 @@
testSelectableSelection(id, [ "listbox2_item1", "listbox2_item2" ]);
select.clearSelection();
testSelectableSelection(id, [ ]);
//////////////////////////////////////////////////////////////////////////
// role="grid"
@ -152,19 +133,14 @@
<pre id="test">
</pre>
<div role="list" id="list1">
<div role="listitem">item1</div>
<div role="listitem">item2</div>
</div>
<div role="listbox" id="listbox1">
<div role="listitem">item1</div>
<div role="listitem">item2</div>
<div role="option">item1</div>
<div role="option">item2</div>
</div>
<div role="listbox" id="listbox2" aria-multiselectable="true">
<div role="listitem" id="listbox2_item1">item1</div>
<div role="listitem" id="listbox2_item2">item2</div>
<div role="option" id="listbox2_item1">item1</div>
<div role="option" id="listbox2_item2">item2</div>
</div>
<div role="grid" id="grid1">

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

@ -89,12 +89,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=452388
testStates("listbox_multiselectable_undefined", 0, 0, STATE_MULTISELECTABLE | STATE_EXTSELECTABLE);
testStates("listbox_multiselectable_absent", 0, 0, STATE_MULTISELECTABLE | STATE_EXTSELECTABLE);
// test (listitem) checkable and checked states
testStates("listitem_checked_true", (STATE_CHECKABLE | STATE_CHECKED));
testStates("listitem_checked_false", STATE_CHECKABLE, 0, STATE_CHECKED);
testStates("listitem_checked_empty", 0 , 0, STATE_CHECKABLE | STATE_CHECKED);
testStates("listitem_checked_undefined", 0, 0, STATE_CHECKABLE | STATE_CHECKED);
testStates("listitem_checked_absent", 0, 0, STATE_CHECKABLE | STATE_CHECKED);
// test (option) checkable and checked states
testStates("option_checked_true", (STATE_CHECKABLE | STATE_CHECKED));
testStates("option_checked_false", STATE_CHECKABLE, 0, STATE_CHECKED);
testStates("option_checked_empty", 0 , 0, STATE_CHECKABLE | STATE_CHECKED);
testStates("option_checked_undefined", 0, 0, STATE_CHECKABLE | STATE_CHECKED);
testStates("option_checked_absent", 0, 0, STATE_CHECKABLE | STATE_CHECKED);
// test (menuitem) checkable and checked states
testStates("menuitem_checked_true", (STATE_CHECKABLE | STATE_CHECKED));
@ -239,19 +239,19 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=452388
<div id="checkbox_disabled_absent" role="checkbox">This checkbox has <emph>no</emph> aria-disabled attribute and should <emph>not</emph> get STATE_DISABLED.</div>
<div id="listbox_multiselectable_true" role="listbox" aria-multiselectable="true">
<div id="listitem_checked_true" role="listitem" aria-checked="true">item</div>
<div id="option_checked_true" role="option" aria-checked="true">item</div>
</div>
<div id="listbox_multiselectable_false" role="listbox" aria-multiselectable="false">
<div id="listitem_checked_false" role="listitem" aria-checked="false">item</div>
<div id="option_checked_false" role="option" aria-checked="false">item</div>
</div>
<div id="listbox_multiselectable_empty" role="listbox" aria-multiselectable="">
<div id="listitem_checked_empty" role="listitem" aria-checked="">item</div>
<div id="option_checked_empty" role="option" aria-checked="">item</div>
</div>
<div id="listbox_multiselectable_undefined" role="listbox" aria-multiselectable="undefined">
<div id="listitem_checked_undefined" role="listitem" aria-checked="undefined">item</div>
<div id="option_checked_undefined" role="option" aria-checked="undefined">item</div>
</div>
<div id="listbox_multiselectable_absent" role="listbox">
<div id="listitem_checked_absent" role="listitem">item</div>
<div id="option_checked_absent" role="option">item</div>
</div>
<div role="menu">

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

@ -25,6 +25,16 @@
prefs.setBoolPref("accessibility.browsewithcaret", aIsOn);
}
/**
* Test caret offset for the given accessible.
*/
function testCaretOffset(aID, aCaretOffset)
{
var acc = getAccessible(aID, [nsIAccessibleText]);
is(acc.caretOffset, aCaretOffset,
"Wrong caret offset for " + aID);
}
/**
* Do tests.
*/
@ -37,6 +47,12 @@
{
turnCaretBrowsing(true);
// test caret offsets
testCaretOffset(document, 14);
testCaretOffset("textbox", -1);
testCaretOffset("textarea", -1);
testCaretOffset("p", -1);
// test caret move events and caret offsets
gQueue = new eventQueue();
@ -58,6 +74,11 @@
<body>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=448744"
title="caretOffset should return -1 if the system caret is not currently with in that particular object">
Mozilla Bug 448744
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=524115"
title="HyperText accessible should get focus when the caret is positioned inside of it, text is changed or copied into clipboard by ATs">
@ -68,12 +89,19 @@
title="Position is not being updated when atk_text_set_caret_offset is used">
Mozilla Bug 546068
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=725581"
title="caretOffset for textarea should be -1 when textarea doesn't have a focus">
Mozilla Bug 725581
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<input id="textbox" value="hello"/>
<textarea id="textarea">text<br>text</textarea>
<p id="p" contentEditable="true"><span>text</span><br/>text</p>
<a id="link" href="about:">about mozilla</a>
<h5 id="heading">heading</h5>

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

@ -68,6 +68,7 @@ config/nspr/Makefile
config/doxygen.cfg
config/expandlibs_config.py
config/tests/src-simple/Makefile
mfbt/Makefile
probes/Makefile
extensions/Makefile
"
@ -125,6 +126,11 @@ if [ "$ENABLE_TESTS" ]; then
add_makefiles "
build/autoconf/test/Makefile
"
if [ ! "$LIBXUL_SDK" ]; then
add_makefiles "
mozglue/tests/Makefile
"
fi
if [ "$_MSC_VER" -a "$OS_TEST" != "x86_64" ]; then
add_makefiles "
build/win32/vmwarerecordinghelper/Makefile
@ -137,6 +143,7 @@ if [ "$ENABLE_TESTS" ]; then
fi
if [ "$MOZ_WIDGET_TOOLKIT" = "android" ]; then
add_makefiles "
build/mobile/robocop/Makefile
build/mobile/sutagent/android/Makefile
build/mobile/sutagent/android/fencp/Makefile
build/mobile/sutagent/android/ffxcp/Makefile

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

@ -428,3 +428,5 @@ pref("layout.frame_rate.precise", true);
// Screen timeout in minutes
pref("power.screen.timeout", 60);
pref("full-screen-api.enabled", true);

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -35,21 +35,13 @@
# ***** END LICENSE BLOCK *****
add_makefiles "
netwerk/locales/Makefile
dom/locales/Makefile
toolkit/locales/Makefile
security/manager/locales/Makefile
b2g/app/Makefile
$MOZ_BRANDING_DIRECTORY/Makefile
$MOZ_BRANDING_DIRECTORY/content/Makefile
$MOZ_BRANDING_DIRECTORY/locales/Makefile
b2g/chrome/Makefile
b2g/components/Makefile
b2g/installer/Makefile
b2g/locales/Makefile
b2g/Makefile
"
if test -n "$MOZ_UPDATE_PACKAGING"; then
add_makefiles "
tools/update-packaging/Makefile
"
fi

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

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1328289666000">
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1328822681000">
<emItems>
<emItem blockID="i58" id="webmaster@buzzzzvideos.info">
<versionRange minVersion="0" maxVersion="*">
@ -67,12 +67,20 @@
</targetApplication>
</versionRange>
</emItem>
<emItem blockID="i63" id="youtube@youtuber.com">
<versionRange minVersion="0" maxVersion="*">
</versionRange>
</emItem>
<emItem blockID="i18" id="msntoolbar@msn.com">
<versionRange minVersion=" " maxVersion="6.*">
</versionRange>
</emItem>
<emItem blockID="i13" id="{E8E88AB0-7182-11DF-904E-6045E0D72085}">
</emItem>
<emItem blockID="i64" id="royal@facebook.com">
<versionRange minVersion="0" maxVersion="*">
</versionRange>
</emItem>
<emItem blockID="i4" id="{4B3803EA-5230-4DC3-A7FC-33638F3D3542}">
<versionRange minVersion="1.2" maxVersion="1.2">
<targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
@ -162,6 +170,10 @@
</emItem>
<emItem blockID="i47" id="youtube@youtube2.com">
</emItem>
<emItem blockID="i62" id="jid0-EcdqvFOgWLKHNJPuqAnawlykCGZ@jetpack">
<versionRange minVersion="0" maxVersion="*">
</versionRange>
</emItem>
<emItem blockID="i17" id="{3252b9ae-c69a-4eaf-9502-dc9c1f6c009e}">
<versionRange minVersion="2.2" maxVersion="2.2">
</versionRange>

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

@ -407,7 +407,7 @@ function clearAllPrefsForStudy(studyId) {
dump("Looking for prefs to delete...\n");
let prefService = Cc["@mozilla.org/preferences-service;1"]
.getService(Ci.nsIPrefService)
.QueryInterface(Ci.nsIPrefBranch2);
.QueryInterface(Ci.nsIPrefBranch);
let prefStem = "extensions.testpilot";
let prefNames = prefService.getChildList(prefStem);
for each (let prefName in prefNames) {
@ -783,4 +783,4 @@ function testSameGUIDs() {
}
// TODO test for continuity of GUID with recurring study (longitudinal) - i don't think this
// has actually been working so far because a new GUID is generted every time the study starts up...
// has actually been working so far because a new GUID is generted every time the study starts up...

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

@ -3545,29 +3545,11 @@ const BrowserSearch = {
if (!submission)
return;
let newTab;
function newTabHandler(event) {
newTab = event.target;
}
gBrowser.tabContainer.addEventListener("TabOpen", newTabHandler);
openLinkIn(submission.uri.spec,
useNewTab ? "tab" : "current",
{ postData: submission.postData,
inBackground: false,
relatedToCurrent: true });
gBrowser.tabContainer.removeEventListener("TabOpen", newTabHandler);
if (newTab && !newTab.selected) {
let tabSelected = false;
function tabSelectHandler() {
tabSelected = true;
}
newTab.addEventListener("TabSelect", tabSelectHandler);
setTimeout(function () {
newTab.removeEventListener("TabSelect", tabSelectHandler);
Services.telemetry.getHistogramById("FX_CONTEXT_SEARCH_AND_TAB_SELECT").add(tabSelected);
}, 5000);
}
},
/**
@ -5865,7 +5847,7 @@ function hrefAndLinkNodeForClickEvent(event)
function contentAreaClick(event, isPanelClick)
{
if (!event.isTrusted || event.defaultPrevented || event.button == 2)
return true;
return;
let [href, linkNode] = hrefAndLinkNodeForClickEvent(event);
if (!href) {
@ -5876,7 +5858,7 @@ function contentAreaClick(event, isPanelClick)
middleMousePaste(event);
event.preventDefault();
}
return true;
return;
}
// This code only applies if we have a linkNode (i.e. clicks on real anchor
@ -5893,7 +5875,7 @@ function contentAreaClick(event, isPanelClick)
if (linkNode.getAttribute("onclick") ||
href.substr(0, 11) === "javascript:" ||
href.substr(0, 5) === "data:")
return true;
return;
try {
urlSecurityCheck(href, linkNode.ownerDocument.nodePrincipal);
@ -5901,16 +5883,16 @@ function contentAreaClick(event, isPanelClick)
catch(ex) {
// Prevent loading unsecure destinations.
event.preventDefault();
return true;
return;
}
let postData = {};
let url = getShortcutOrURI(href, postData);
if (!url)
return true;
return;
loadURI(url, null, postData.value, false);
event.preventDefault();
return true;
return;
}
if (linkNode.getAttribute("rel") == "sidebar") {
@ -5927,7 +5909,7 @@ function contentAreaClick(event, isPanelClick)
, "keyword" ]
}, window);
event.preventDefault();
return true;
return;
}
}
@ -5940,8 +5922,6 @@ function contentAreaClick(event, isPanelClick)
try {
PlacesUIUtils.markPageAsFollowedLink(href);
} catch (ex) { /* Skip invalid URIs. */ }
return true;
}
/**

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

@ -966,7 +966,7 @@
tabcontainer="tabbrowser-tabs"
contentcontextmenu="contentAreaContextMenu"
autocompletepopup="PopupAutoComplete"
onclick="return contentAreaClick(event, false);"/>
onclick="contentAreaClick(event, false);"/>
<statuspanel id="statusbar-display" inactive="true"/>
</vbox>
<splitter id="devtools-side-splitter" hidden="true"/>

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

@ -794,7 +794,7 @@ function selectSaveFolder()
fp.init(window, titleText, nsIFilePicker.modeGetFolder);
try {
var prefs = Components.classes[PREFERENCES_CONTRACTID]
.getService(Components.interfaces.nsIPrefBranch2);
.getService(Components.interfaces.nsIPrefBranch);
var initialDir = prefs.getComplexValue("browser.download.dir", nsILocalFile);
if (initialDir)
@ -1104,7 +1104,7 @@ function makeBlockImage(url)
var permissionManager = Components.classes[PERMISSION_CONTRACTID]
.getService(nsIPermissionManager);
var prefs = Components.classes[PREFERENCES_CONTRACTID]
.getService(Components.interfaces.nsIPrefBranch2);
.getService(Components.interfaces.nsIPrefBranch);
var checkbox = document.getElementById("blockImage");
var imagePref = prefs.getIntPref("permissions.default.image");

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

@ -99,7 +99,7 @@ var permissionObserver = {
function onLoadPermission()
{
gPrefs = Components.classes[PREFERENCES_CONTRACTID]
.getService(Components.interfaces.nsIPrefBranch2);
.getService(Components.interfaces.nsIPrefBranch);
var uri = gDocument.documentURIObject;
var permTab = document.getElementById("permTab");

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

@ -233,7 +233,7 @@ Sanitizer.prototype = {
// Clear last URL of the Open Web Location dialog
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch2);
.getService(Components.interfaces.nsIPrefBranch);
try {
prefs.clearUserPref("general.open_location.last_url");
}

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

@ -232,7 +232,7 @@ let gClickHandler = {
gCurrentTest.desc + ":Handler received a click event on " + linkId);
let isPanelClick = linkId == "panellink";
let returnValue = gTestWin.contentAreaClick(event, isPanelClick);
gTestWin.contentAreaClick(event, isPanelClick);
let prevent = event.defaultPrevented;
is(prevent, gCurrentTest.preventDefault,
gCurrentTest.desc + ": event.defaultPrevented is correct (" + prevent + ")")

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

@ -82,8 +82,7 @@
<constructor><![CDATA[
this._prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService)
.getBranch("browser.urlbar.")
.QueryInterface(Components.interfaces.nsIPrefBranch2);
.getBranch("browser.urlbar.");
this._prefs.addObserver("", this, false);
this.clickSelectsAll = this._prefs.getBoolPref("clickSelectsAll");

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

@ -98,5 +98,5 @@
<commandset id="editMenuCommands"/>
<browser id="web-panels-browser" persist="cachedurl" type="content" flex="1"
context="contentAreaContextMenu" tooltip="aHTMLTooltip"
onclick="return window.parent.contentAreaClick(event, true);"/>
onclick="window.parent.contentAreaClick(event, true);"/>
</page>

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

@ -1164,7 +1164,7 @@ FeedWriter.prototype = {
// Set up the subscription UI
this._initSubscriptionUI();
var prefs = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch2);
getService(Ci.nsIPrefBranch);
prefs.addObserver(PREF_SELECTED_ACTION, this, false);
prefs.addObserver(PREF_SELECTED_READER, this, false);
prefs.addObserver(PREF_SELECTED_WEB, this, false);
@ -1207,7 +1207,7 @@ FeedWriter.prototype = {
this._document = null;
this._window = null;
var prefs = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch2);
getService(Ci.nsIPrefBranch);
prefs.removeObserver(PREF_SELECTED_ACTION, this);
prefs.removeObserver(PREF_SELECTED_READER, this);
prefs.removeObserver(PREF_SELECTED_WEB, this);

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

@ -221,11 +221,8 @@ HandlerInfoWrapper.prototype = {
_handlerSvc: Cc["@mozilla.org/uriloader/handler-service;1"].
getService(Ci.nsIHandlerService),
// Retrieve this as nsIPrefBranch and then immediately QI to nsIPrefBranch2
// so both interfaces are available to callers.
_prefSvc: Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch).
QueryInterface(Ci.nsIPrefBranch2),
getService(Ci.nsIPrefBranch),
_categoryMgr: Cc["@mozilla.org/categorymanager;1"].
getService(Ci.nsICategoryManager),
@ -885,11 +882,8 @@ var gApplicationsPane = {
_list : null,
_filter : null,
// Retrieve this as nsIPrefBranch and then immediately QI to nsIPrefBranch2
// so both interfaces are available to callers.
_prefSvc : Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch).
QueryInterface(Ci.nsIPrefBranch2),
getService(Ci.nsIPrefBranch),
_mimeSvc : Cc["@mozilla.org/mime;1"].
getService(Ci.nsIMIMEService),

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

@ -80,7 +80,6 @@ var gPrivacyPane = {
*/
prefsForDefault: [
"places.history.enabled",
"browser.download.manager.retention",
"browser.formfill.enable",
"network.cookie.cookieBehavior",
"network.cookie.lifetimePolicy",
@ -96,7 +95,6 @@ var gPrivacyPane = {
*/
dependentControls: [
"rememberHistory",
"rememberDownloads",
"rememberForms",
"keepUntil",
"keepCookiesUntil",
@ -177,10 +175,6 @@ var gPrivacyPane = {
if (!rememberHistoryCheckbox.checked)
rememberHistoryCheckbox.checked = true;
// select the remember downloads option if needed
if (!document.getElementById("rememberDownloads").checked)
document.getElementById("browser.download.manager.retention").value = 2;
// select the remember forms history option
document.getElementById("browser.formfill.enable").value = true;
@ -223,8 +217,6 @@ var gPrivacyPane = {
// adjust the checked state of the remember history checkboxes
document.getElementById("rememberHistory").checked = disabled ? false :
document.getElementById("places.history.enabled").value;
document.getElementById("rememberDownloads").checked = disabled ? false :
this.readDownloadRetention();
document.getElementById("rememberForms").checked = disabled ? false :
document.getElementById("browser.formfill.enable").value;
@ -244,7 +236,7 @@ var gPrivacyPane = {
{
let prefService = document.getElementById("privacyPreferences")
.service
.QueryInterface(Components.interfaces.nsIPrefBranch2);
.QueryInterface(Components.interfaces.nsIPrefBranch);
prefService.addObserver("browser.privatebrowsing.autostart",
this.autoStartPrivateBrowsingObserver,
false);
@ -257,7 +249,7 @@ var gPrivacyPane = {
{
let prefService = document.getElementById("privacyPreferences")
.service
.QueryInterface(Components.interfaces.nsIPrefBranch2);
.QueryInterface(Components.interfaces.nsIPrefBranch);
prefService.removeObserver("browser.privatebrowsing.autostart",
this.autoStartPrivateBrowsingObserver);
},
@ -331,36 +323,8 @@ var gPrivacyPane = {
* browser.formfill.enable
* - true if entries in forms and the search bar should be saved, false
* otherwise
* browser.download.manager.retention
* - determines when downloads are automatically removed from the download
* manager:
*
* 0 means remove downloads when they finish downloading
* 1 means downloads will be removed when the browser quits
* 2 means never remove downloads
*/
/**
* Converts the value of the browser.download.manager.retention preference
* into a Boolean value. "remove on close" and "don't remember" both map
* to an unchecked checkbox, while "remember" maps to a checked checkbox.
*/
readDownloadRetention: function ()
{
var pref = document.getElementById("browser.download.manager.retention");
return (pref.value == 2);
},
/**
* Returns the appropriate value of the browser.download.manager.retention
* preference for the current UI.
*/
writeDownloadRetention: function ()
{
var checkbox = document.getElementById("rememberDownloads");
return checkbox.checked ? 2 : 0;
},
// COOKIES
/*

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

@ -87,9 +87,6 @@
<preference id="browser.formfill.enable"
name="browser.formfill.enable"
type="bool"/>
<preference id="browser.download.manager.retention"
name="browser.download.manager.retention"
type="int"/>
<!-- Cookies -->
<preference id="network.cookie.cookieBehavior" name="network.cookie.cookieBehavior" type="int"/>
@ -194,15 +191,9 @@
<vbox class="indent">
<vbox class="indent">
<checkbox id="rememberHistory"
label="&rememberHistory.label;"
accesskey="&rememberHistory.accesskey;"
label="&rememberHistory2.label;"
accesskey="&rememberHistory2.accesskey;"
preference="places.history.enabled"/>
<checkbox id="rememberDownloads"
label="&rememberDownload.label;"
accesskey="&rememberDownload.accesskey;"
preference="browser.download.manager.retention"
onsyncfrompreference="return gPrivacyPane.readDownloadRetention();"
onsynctopreference="return gPrivacyPane.writeDownloadRetention();"/>
<checkbox id="rememberForms"
label="&rememberSearchForm.label;"
accesskey="&rememberSearchForm.accesskey;"

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

@ -49,8 +49,6 @@ function test() {
run_test_subset([
test_custom_retention("rememberHistory", "remember"),
test_custom_retention("rememberHistory", "custom"),
test_custom_retention("rememberDownloads", "remember"),
test_custom_retention("rememberDownloads", "custom"),
test_custom_retention("rememberForms", "remember"),
test_custom_retention("rememberForms", "custom"),
test_historymode_retention("remember", "remember"),

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

@ -92,7 +92,6 @@ function test_dependent_elements(win) {
ok(pbautostart, "the private browsing auto-start checkbox should exist");
let controls = [
win.document.getElementById("rememberHistory"),
win.document.getElementById("rememberDownloads"),
win.document.getElementById("rememberForms"),
win.document.getElementById("keepUntil"),
win.document.getElementById("keepCookiesUntil"),
@ -116,8 +115,6 @@ function test_dependent_elements(win) {
ok(alwaysclear, "the clear data on close checkbox should exist");
let rememberhistory = win.document.getElementById("rememberHistory");
ok(rememberhistory, "the remember history checkbox should exist");
let rememberdownloads = win.document.getElementById("rememberDownloads");
ok(rememberdownloads, "the remember downloads checkbox should exist");
let rememberforms = win.document.getElementById("rememberForms");
ok(rememberforms, "the remember forms checkbox should exist");
let alwaysclearsettings = win.document.getElementById("clearDataSettings");
@ -135,8 +132,6 @@ function test_dependent_elements(win) {
"the clear data on close checkbox value should be as expected");
ok(!rememberhistory.checked,
"the remember history checkbox value should be as expected");
ok(!rememberdownloads.checked,
"the remember downloads checkbox value should be as expected");
ok(!rememberforms.checked,
"the remember forms checkbox value should be as expected");
}
@ -302,7 +297,6 @@ function test_dependent_prefs(win) {
ok(historymode, "history mode menulist should exist");
let controls = [
win.document.getElementById("rememberHistory"),
win.document.getElementById("rememberDownloads"),
win.document.getElementById("rememberForms"),
win.document.getElementById("acceptCookies"),
win.document.getElementById("acceptThirdParty"),

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

@ -41,7 +41,7 @@
const accessToken = '{"location":{"latitude":51.5090332,"longitude":-0.1212726,"accuracy":150.0},"access_token":"2:jVhRZJ-j6PiRchH_:RGMrR0W1BiwdZs12"}'
function run_test_on_service() {
var prefBranch = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch2);
getService(Ci.nsIPrefBranch);
var pb = Cc[PRIVATEBROWSING_CONTRACT_ID].
getService(Ci.nsIPrivateBrowsingService);
prefBranch.setCharPref("geo.wifi.access_token.test", accessToken);

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

@ -539,9 +539,9 @@
]]></constructor>
<destructor><![CDATA[
var ps2 = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch2);
ps2.removeObserver("browser.search.suggest.enabled", this);
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
prefs.removeObserver("browser.search.suggest.enabled", this);
// Because XBL and the customize toolbar code interacts poorly,
// there may not be anything to remove here
@ -635,9 +635,9 @@
this.controllers.appendController(this.searchbarController);
// Add observer for suggest preference
var ps2 = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch2);
ps2.addObserver("browser.search.suggest.enabled", this, false);
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
prefs.addObserver("browser.search.suggest.enabled", this, false);
]]></body>
</method>

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

@ -163,8 +163,7 @@ function debug(aMsg) {
function SessionStoreService() {
XPCOMUtils.defineLazyGetter(this, "_prefBranch", function () {
return Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefService).getBranch("browser.").
QueryInterface(Ci.nsIPrefBranch2);
getService(Ci.nsIPrefService).getBranch("browser.");
});
// minimal interval between two save operations (in milliseconds)

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

@ -40,8 +40,6 @@
* ***** END LICENSE BLOCK ***** */
"use strict";
/*global Components, NetUtil, Services, XPCOMUtils */
/*global DebuggerServer, DebuggerClient, SourceEditor */
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
@ -295,7 +293,7 @@ DebuggerUI.prototype = {
return this.logError(url, aStatusCode);
}
this._onSourceLoaded(url, chunks.join(""));
this._onSourceLoaded(url, chunks.join(""), channel.contentType);
}.bind(this)
};
@ -325,14 +323,14 @@ DebuggerUI.prototype = {
* The URL of the source script.
* @param string aSourceText
* The text of the source script.
* @param string aContentType
* The content type of the source script.
*/
_onSourceLoaded: function DebuggerUI__onSourceLoaded(aSourceUrl, aSourceText) {
_onSourceLoaded: function DebuggerUI__onSourceLoaded(aSourceUrl,
aSourceText,
aContentType) {
let dbg = this.getDebugger(this.aWindow.gBrowser.selectedTab);
if (aSourceUrl.slice(-3) == ".js") {
dbg.editor.setMode(SourceEditor.MODES.JAVASCRIPT);
} else {
dbg.editor.setMode(SourceEditor.MODES.HTML);
}
dbg.debuggerWindow.SourceScripts.setEditorMode(aSourceUrl, aContentType);
dbg.editor.setText(aSourceText);
let doc = dbg.frame.contentDocument;
let scripts = doc.getElementById("scripts");
@ -340,6 +338,7 @@ DebuggerUI.prototype = {
let script = elt.getUserData("sourceScript");
script.loaded = true;
script.text = aSourceText;
script.contentType = aContentType;
elt.setUserData("sourceScript", script, null);
}
};

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

@ -38,9 +38,7 @@
***** END LICENSE BLOCK *****/
"use strict";
/*global Components, XPCOMUtils, Services, StackFrames, ThreadState, dump */
const Cu = Components.utils;
const DBG_STRINGS_URI = "chrome://browser/locale/devtools/debugger.properties";
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
@ -1070,6 +1068,49 @@ DebuggerView.Scripts = {
}
},
/**
* Checks whether the script with the specified URL is among the scripts
* known to the debugger and shown in the list.
*
* @param string aUrl
* The script URL.
*/
contains: function DVS_contains(aUrl) {
if (this._scripts.getElementsByAttribute("value", aUrl).length > 0) {
return true;
}
return false;
},
/**
* Checks whether the script with the specified URL is selected in the list.
*
* @param string aUrl
* The script URL.
*/
isSelected: function DVS_isSelected(aUrl) {
if (this._scripts.selectedItem &&
this._scripts.selectedItem.value == aUrl) {
return true;
}
return false;
},
/**
* Selects the script with the specified URL from the list.
*
* @param string aUrl
* The script URL.
*/
selectScript: function DVS_selectScript(aUrl) {
for (let i = 0; i < this._scripts.itemCount; i++) {
if (this._scripts.getItemAtIndex(i).value == aUrl) {
this._scripts.selectedIndex = i;
break;
}
}
},
/**
* Adds a script to the scripts container.
* If the script already exists (was previously added), null is returned.
@ -1086,7 +1127,7 @@ DebuggerView.Scripts = {
*/
addScript: function DVS_addScript(aUrl, aSource, aScriptNameText) {
// make sure we don't duplicate anything
if (this._scripts.getElementsByAttribute("value", aUrl).length > 0) {
if (this.contains(aUrl)) {
return null;
}

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

@ -41,6 +41,8 @@
"use strict";
Components.utils.import("resource:///modules/source-editor.jsm");
var gInitialized = false;
var gClient = null;
var gTabClient = null;
@ -255,11 +257,19 @@ var StackFrames = {
DebuggerView.Stackframes.highlightFrame(this.selectedFrame, true);
}
// Display the local variables.
let frame = this.activeThread.cachedFrames[aDepth];
if (!frame) {
return;
}
// Move the editor's caret to the proper line.
if (DebuggerView.Scripts.isSelected(frame.where.url) && frame.where.line) {
window.editor.setCaretPosition(frame.where.line - 1);
} else if (DebuggerView.Scripts.contains(frame.where.url)) {
DebuggerView.Scripts.selectScript(frame.where.url);
SourceScripts.onChange({ target: DebuggerView.Scripts._scripts });
window.editor.setCaretPosition(frame.where.line - 1);
}
// Display the local variables.
let localScope = DebuggerView.Properties.localScope;
localScope.empty();
// Add "this".
@ -435,9 +445,12 @@ var SourceScripts = {
},
/**
* Handler for the thread client's paused notification.
* Handler for the thread client's paused notification. This is triggered only
* once, to retrieve the list of scripts known to the server from before the
* client was ready to handle new script notifications.
*/
onPaused: function SS_onPaused() {
this.activeThread.removeListener("paused", this.onPaused);
this.activeThread.fillScripts();
},
@ -452,7 +465,6 @@ var SourceScripts = {
* Handler for the thread client's scriptsadded notification.
*/
onScripts: function SS_onScripts() {
this.onScriptsCleared();
for each (let script in this.activeThread.cachedScripts) {
this._addScript(script);
}
@ -468,12 +480,49 @@ var SourceScripts = {
/**
* Handler for changes on the selected source script.
*/
onChange: function SS_onClick(aEvent) {
onChange: function SS_onChange(aEvent) {
let scripts = aEvent.target;
if (!scripts.selectedItem) {
return;
}
let script = scripts.selectedItem.getUserData("sourceScript");
this.setEditorMode(script.url, script.contentType);
this._showScript(script);
},
/**
* Sets the proper editor mode (JS or HTML) according to the specified
* content type, or by determining the type from the URL.
*
* @param string aUrl
* The script URL.
* @param string aContentType [optional]
* The script content type.
*/
setEditorMode: function SS_setEditorMode(aUrl, aContentType) {
if (aContentType) {
if (/javascript/.test(aContentType)) {
window.editor.setMode(SourceEditor.MODES.JAVASCRIPT);
} else {
window.editor.setMode(SourceEditor.MODES.HTML);
}
return;
}
let url = aUrl;
// Trim the query part.
let q = url.indexOf('?');
if (q > -1) {
url = url.slice(0, q);
}
if (url.slice(-3) == ".js") {
window.editor.setMode(SourceEditor.MODES.JAVASCRIPT);
} else {
window.editor.setMode(SourceEditor.MODES.HTML);
}
},
/**
* Add the specified script to the list and display it in the editor if the
* editor is empty.

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

@ -70,6 +70,8 @@ _BROWSER_TEST_FILES = \
browser_dbg_location-changes.js \
browser_dbg_script-switching.js \
browser_dbg_pause-resume.js \
browser_dbg_update-editor-mode.js \
browser_dbg_select-line.js \
head.js \
$(NULL)
@ -82,6 +84,8 @@ _BROWSER_TEST_PAGES = \
test-script-switching-01.js \
test-script-switching-02.js \
browser_dbg_frame-parameters.html \
browser_dbg_update-editor-mode.html \
test-editor-mode \
$(NULL)
libs:: $(_BROWSER_TEST_FILES)

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

@ -33,35 +33,24 @@ function test()
function testScriptsDisplay() {
gPane.activeThread.addOneTimeListener("scriptsadded", function() {
Services.tm.currentThread.dispatch({ run: function() {
let count = 0;
gScripts = gDebugger.DebuggerView.Scripts._scripts;
is(gDebugger.StackFrames.activeThread.state, "paused",
"Should only be getting stack frames while paused.");
is(gScripts.itemCount, 2, "Found the expected number of scripts.");
ok(gDebugger.editor.getText().search(/debugger/) != -1,
"The correct script was loaded initially.");
gDebugger.editor.addEventListener(SourceEditor.EVENTS.TEXT_CHANGED,
function onScriptLoad() {
// Skip the first change event, since we're only interested in the
// second.
if (count++ < 1) {
return;
}
function onChange() {
gDebugger.editor.removeEventListener(SourceEditor.EVENTS.TEXT_CHANGED,
onScriptLoad);
gScripts = gDebugger.DebuggerView.Scripts._scripts;
is(gDebugger.StackFrames.activeThread.state, "paused",
"Should only be getting stack frames while paused.");
is(gScripts.itemCount, 2, "Found the expected number of scripts.");
ok(gDebugger.editor.getText().search(/debugger/) != -1,
"The correct script was loaded initially.");
gDebugger.editor.addEventListener(SourceEditor.EVENTS.TEXT_CHANGED,
function onChange() {
gDebugger.editor.removeEventListener(SourceEditor.EVENTS.TEXT_CHANGED,
onChange);
testSwitchPaused();
});
gScripts.selectedIndex = 0;
gDebugger.SourceScripts.onChange({ target: gScripts });
onChange);
testSwitchPaused();
});
gScripts.selectedIndex = 0;
gDebugger.SourceScripts.onChange({ target: gScripts });
}}, 0);
});

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

@ -0,0 +1,81 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Make sure that selecting a stack frame loads the right script in the editor
* pane and highlights the proper line.
*/
const TAB_URL = "http://example.com/browser/browser/devtools/debugger/" +
"test/browser_dbg_script-switching.html";
let tempScope = {};
Cu.import("resource:///modules/source-editor.jsm", tempScope);
let SourceEditor = tempScope.SourceEditor;
var gPane = null;
var gTab = null;
var gDebuggee = null;
var gDebugger = null;
var gScripts = null;
function test()
{
debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
gTab = aTab;
gDebuggee = aDebuggee;
gPane = aPane;
gDebugger = gPane.debuggerWindow;
testSelectLine();
});
}
function testSelectLine() {
gPane.activeThread.addOneTimeListener("scriptsadded", function() {
Services.tm.currentThread.dispatch({ run: function() {
gScripts = gDebugger.DebuggerView.Scripts._scripts;
is(gDebugger.StackFrames.activeThread.state, "paused",
"Should only be getting stack frames while paused.");
is(gScripts.itemCount, 2, "Found the expected number of scripts.");
ok(gDebugger.editor.getText().search(/debugger/) != -1,
"The correct script was loaded initially.");
// getCaretPosition is 0-based.
is(gDebugger.editor.getCaretPosition().line, 5,
"The correct line is selected.");
gDebugger.editor.addEventListener(SourceEditor.EVENTS.TEXT_CHANGED,
function onChange() {
gDebugger.editor.removeEventListener(SourceEditor.EVENTS.TEXT_CHANGED,
onChange);
ok(gDebugger.editor.getText().search(/debugger/) == -1,
"The second script is no longer displayed.");
ok(gDebugger.editor.getText().search(/firstCall/) != -1,
"The first script is displayed.");
// Yield control back to the event loop so that the debugger has a
// chance to highlight the proper line.
executeSoon(function(){
// getCaretPosition is 0-based.
is(gDebugger.editor.getCaretPosition().line, 4,
"The correct line is selected.");
gDebugger.StackFrames.activeThread.resume(function() {
removeTab(gTab);
finish();
});
});
});
// Click the oldest stack frame.
let element = gDebugger.document.getElementById("stackframe-3");
EventUtils.synthesizeMouseAtCenter(element, {}, gDebugger);
}}, 0);
});
gDebuggee.firstCall();
}

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

@ -0,0 +1,12 @@
<!DOCTYPE HTML>
<html>
<head>
<title>Browser Debugger Update Editor Mode Test</title>
<!-- Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ -->
<script type="text/javascript" src="test-script-switching-01.js?q=a"></script>
<script type="text/javascript" src="test-editor-mode?a=b"></script>
</head>
<body>
</body>
</html>

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

@ -0,0 +1,78 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Make sure that updating the editor mode sets the right highlighting engine,
* and script URIs with extra query parameters also get the right engine.
*/
const TAB_URL = "http://example.com/browser/browser/devtools/debugger/" +
"test/browser_dbg_update-editor-mode.html";
let tempScope = {};
Cu.import("resource:///modules/source-editor.jsm", tempScope);
let SourceEditor = tempScope.SourceEditor;
var gPane = null;
var gTab = null;
var gDebuggee = null;
var gDebugger = null;
var gScripts = null;
function test()
{
debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
gTab = aTab;
gDebuggee = aDebuggee;
gPane = aPane;
gDebugger = gPane.debuggerWindow;
testScriptsDisplay();
});
}
function testScriptsDisplay() {
gPane.activeThread.addOneTimeListener("scriptsadded", function() {
Services.tm.currentThread.dispatch({ run: function() {
gScripts = gDebugger.DebuggerView.Scripts._scripts;
is(gDebugger.StackFrames.activeThread.state, "paused",
"Should only be getting stack frames while paused.");
is(gScripts.itemCount, 2, "Found the expected number of scripts.");
is(gDebugger.editor.getMode(), SourceEditor.MODES.HTML,
"Found the expected editor mode.");
ok(gDebugger.editor.getText().search(/debugger/) != -1,
"The correct script was loaded initially.");
gDebugger.editor.addEventListener(SourceEditor.EVENTS.TEXT_CHANGED,
function onChange() {
gDebugger.editor.removeEventListener(SourceEditor.EVENTS.TEXT_CHANGED,
onChange);
testSwitchPaused();
});
gScripts.selectedIndex = 0;
gDebugger.SourceScripts.onChange({ target: gScripts });
}}, 0);
});
gDebuggee.firstCall();
}
function testSwitchPaused()
{
ok(gDebugger.editor.getText().search(/debugger/) == -1,
"The second script is no longer displayed.");
ok(gDebugger.editor.getText().search(/firstCall/) != -1,
"The first script is displayed.");
is(gDebugger.editor.getMode(), SourceEditor.MODES.JAVASCRIPT,
"Found the expected editor mode.");
gDebugger.StackFrames.activeThread.resume(function() {
removeTab(gTab);
finish();
});
}

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

@ -0,0 +1,6 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function secondCall() {
eval("debugger;");
}

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

@ -2,5 +2,6 @@
http://creativecommons.org/publicdomain/zero/1.0/ */
function secondCall() {
// This comment is useful for browser_dbg_select-line.js.
eval("debugger;");
}

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

@ -246,7 +246,7 @@ Tilt.prototype = {
*/
update: function T_update(aNode) {
if (this.currentInstance) {
this.currentInstance.presenter.highlightNode(aNode);
this.currentInstance.presenter.highlightNode(aNode, "moveIntoView");
}
},

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

@ -547,18 +547,6 @@ TiltUtils.getWindowId = function TU_getWindowId(aWindow)
.currentInnerWindowID;
};
/**
* Gets the markup document viewer zoom for the currently selected browser.
*
* @param {Window} aChromeWindow
* the top-level browser window
*
* @return {Number} the zoom ammount
*/
TiltUtils.getDocumentZoom = function TU_getDocumentZoom(aChromeWindow) {
return aChromeWindow.gBrowser.selectedBrowser.markupDocumentViewer.fullZoom;
};
/**
* Sets the markup document viewer zoom for the currently selected browser.
*

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

@ -60,6 +60,7 @@ const WIREFRAME_COLOR = [0, 0, 0, 0.25];
const INTRO_TRANSITION_DURATION = 50;
const OUTRO_TRANSITION_DURATION = 40;
const INITIAL_Z_TRANSLATION = 400;
const MOVE_INTO_VIEW_ACCURACY = 50;
const MOUSE_CLICK_THRESHOLD = 10;
const MOUSE_INTRO_DELAY = 10;
@ -250,7 +251,7 @@ TiltVisualizer.Presenter = function TV_Presenter(
* Modified by events in the controller through delegate functions.
*/
this.transforms = {
zoom: TiltUtils.getDocumentZoom(aChromeWindow),
zoom: 1,
offset: vec3.create(), // mesh offset, aligned to the viewport center
translation: vec3.create(), // scene translation, on the [x, y, z] axis
rotation: quat4.create() // scene rotation, expressed as a quaternion
@ -280,6 +281,7 @@ TiltVisualizer.Presenter = function TV_Presenter(
let setup = function TVP_setup()
{
let renderer = this.renderer;
let inspector = this.chromeWindow.InspectorUI;
// if the renderer was destroyed, don't continue setup
if (!renderer || !renderer.context) {
@ -294,6 +296,11 @@ TiltVisualizer.Presenter = function TV_Presenter(
uniforms: ["mvMatrix", "projMatrix", "sampler"]
});
// get the document zoom to properly scale the visualization
if (inspector.highlighter) {
this.transforms.zoom = inspector.highlighter.zoom;
}
this.setupTexture();
this.setupMeshData();
this.setupEventListeners();
@ -546,9 +553,8 @@ TiltVisualizer.Presenter.prototype = {
if (!this._initialMeshConfiguration) {
this._initialMeshConfiguration = true;
let zoom = this.transforms.zoom;
let width = Math.min(aData.meshWidth * zoom, renderer.width);
let height = Math.min(aData.meshHeight * zoom, renderer.height);
let width = renderer.width;
let height = renderer.height;
// set the necessary mesh offsets
this.transforms.offset[0] = -width * 0.5;
@ -620,7 +626,7 @@ TiltVisualizer.Presenter.prototype = {
*/
onResize: function TVP_onResize(e)
{
let zoom = TiltUtils.getDocumentZoom(this.chromeWindow);
let zoom = this.chromeWindow.InspectorUI.highlighter.zoom;
let width = e.target.innerWidth * zoom;
let height = e.target.innerHeight * zoom;
@ -636,10 +642,12 @@ TiltVisualizer.Presenter.prototype = {
*
* @param {Element} aNode
* the html node to be highlighted
* @param {String} aFlags
* flags specifying highlighting options
*/
highlightNode: function TVP_highlightNode(aNode)
highlightNode: function TVP_highlightNode(aNode, aFlags)
{
this.highlightNodeFor(this.traverseData.nodes.indexOf(aNode));
this.highlightNodeFor(this.traverseData.nodes.indexOf(aNode), aFlags);
},
/**
@ -698,8 +706,10 @@ TiltVisualizer.Presenter.prototype = {
*
* @param {Number} aNodeIndex
* the index of the node in the this.traverseData array
* @param {String} aFlags
* flags specifying highlighting options
*/
highlightNodeFor: function TVP_highlightNodeFor(aNodeIndex)
highlightNodeFor: function TVP_highlightNodeFor(aNodeIndex, aFlags)
{
this.redraw = true;
@ -744,6 +754,17 @@ TiltVisualizer.Presenter.prototype = {
this.contentWindow.innerHeight < y ||
this.contentWindow.pageYOffset > 0);
// if something is highlighted, make sure it's inside the current viewport;
// the point which should be moved into view is considered the center [x, y]
// position along the top edge of the currently selected node
if (aFlags && aFlags.indexOf("moveIntoView") !== -1)
{
this.controller.arcball.moveIntoView(vec3.lerp(
vec3.scale(this.highlight.v0, this.transforms.zoom, []),
vec3.scale(this.highlight.v1, this.transforms.zoom, []), 0.5));
}
Services.obs.notifyObservers(null, this.NOTIFICATIONS.HIGHLIGHTING, null);
},
@ -813,7 +834,7 @@ TiltVisualizer.Presenter.prototype = {
}
}, false);
let zoom = TiltUtils.getDocumentZoom(this.chromeWindow);
let zoom = this.chromeWindow.InspectorUI.highlighter.zoom;
let width = this.renderer.width * zoom;
let height = this.renderer.height * zoom;
let mesh = this.meshStacks;
@ -997,6 +1018,7 @@ TiltVisualizer.Controller = function TV_Controller(aCanvas, aPresenter)
* Save a reference to the presenter to modify its model-view transforms.
*/
this.presenter = aPresenter;
this.presenter.controller = this;
/**
* The initial controller dimensions and offset, in pixels.
@ -1256,7 +1278,7 @@ TiltVisualizer.Controller.prototype = {
*/
onResize: function TVC_onResize(e)
{
let zoom = TiltUtils.getDocumentZoom(this.presenter.chromeWindow);
let zoom = this.presenter.chromeWindow.InspectorUI.highlighter.zoom;
let width = e.target.innerWidth * zoom;
let height = e.target.innerHeight * zoom;
@ -1728,6 +1750,25 @@ TiltVisualizer.Arcball.prototype = {
this._mouseButton = -1;
},
/**
* Moves a target point into view only if it's outside the currently visible
* area bounds (in which case it also resets any additional transforms).
*
* @param {Arary} aPoint
* the [x, y] point which should be brought into view
*/
moveIntoView: function TVA_moveIntoView(aPoint) {
let visiblePointX = -(this._currentTrans[0] + this._additionalTrans[0]);
let visiblePointY = -(this._currentTrans[1] + this._additionalTrans[1]);
if (aPoint[1] - visiblePointY - MOVE_INTO_VIEW_ACCURACY > this.height ||
aPoint[1] - visiblePointY + MOVE_INTO_VIEW_ACCURACY < 0 ||
aPoint[0] - visiblePointX > this.width ||
aPoint[0] - visiblePointX < 0) {
this.reset([0, -aPoint[1]]);
}
},
/**
* Resize this implementation to use different bounds.
* This function is automatically called when the arcball is created.

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

@ -76,6 +76,7 @@ _BROWSER_TEST_FILES = \
browser_tilt_math07.js \
browser_tilt_picking.js \
browser_tilt_picking_delete.js \
browser_tilt_picking_highlight01-offs.js \
browser_tilt_picking_highlight01.js \
browser_tilt_picking_highlight02.js \
browser_tilt_picking_highlight03.js \

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

@ -23,7 +23,7 @@ function test() {
presenter.onSetupMesh = function() {
presenter.pickNode(canvas.width / 2, canvas.height / 2, {
presenter.pickNode(canvas.width / 2, 10, {
onpick: function(data)
{
ok(data.index > 0,

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

@ -24,8 +24,7 @@ function test() {
Services.obs.addObserver(whenNodeRemoved, NODE_REMOVED, false);
presenter.onSetupMesh = function() {
presenter.highlightNodeAt(presenter.canvas.width / 2,
presenter.canvas.height / 2, {
presenter.highlightNodeAt(presenter.canvas.width / 2, 10, {
onpick: function()
{
ok(presenter._currentSelection > 0,

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

@ -0,0 +1,70 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";
let presenter;
function test() {
if (!isTiltEnabled()) {
info("Skipping highlight test because Tilt isn't enabled.");
return;
}
if (!isWebGLSupported()) {
info("Skipping highlight test because WebGL isn't supported.");
return;
}
requestLongerTimeout(10);
waitForExplicitFinish();
createTab(function() {
createTilt({
onTiltOpen: function(instance)
{
presenter = instance.presenter;
Services.obs.addObserver(whenHighlighting, HIGHLIGHTING, false);
presenter.onInitializationFinished = function() {
let contentDocument = presenter.contentWindow.document;
let div = contentDocument.getElementById("far-far-away");
presenter.highlightNode(div, "moveIntoView");
};
}
});
});
}
function whenHighlighting() {
ok(presenter._currentSelection > 0,
"Highlighting a node didn't work properly.");
ok(!presenter.highlight.disabled,
"After highlighting a node, it should be highlighted. D'oh.");
ok(presenter.controller.arcball._resetInterval,
"Highlighting a node that's not already visible should trigger a reset!");
executeSoon(function() {
Services.obs.addObserver(whenUnhighlighting, UNHIGHLIGHTING, false);
presenter.highlightNode(null);
});
}
function whenUnhighlighting() {
ok(presenter._currentSelection < 0,
"Unhighlighting a should remove the current selection.");
ok(presenter.highlight.disabled,
"After unhighlighting a node, it shouldn't be highlighted anymore. D'oh.");
executeSoon(function() {
Services.obs.addObserver(cleanup, DESTROYED, false);
InspectorUI.closeInspectorUI();
});
}
function cleanup() {
Services.obs.removeObserver(whenHighlighting, HIGHLIGHTING);
Services.obs.removeObserver(whenUnhighlighting, UNHIGHLIGHTING);
Services.obs.removeObserver(cleanup, DESTROYED);
gBrowser.removeCurrentTab();
finish();
}

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

@ -27,7 +27,7 @@ function test() {
let contentDocument = presenter.contentWindow.document;
let div = contentDocument.getElementById("first-law");
presenter.highlightNode(div);
presenter.highlightNode(div, "moveIntoView");
};
}
});
@ -39,6 +39,8 @@ function whenHighlighting() {
"Highlighting a node didn't work properly.");
ok(!presenter.highlight.disabled,
"After highlighting a node, it should be highlighted. D'oh.");
ok(!presenter.controller.arcball._resetInterval,
"Highlighting a node that's already visible shouldn't trigger a reset.");
executeSoon(function() {
Services.obs.addObserver(whenUnhighlighting, UNHIGHLIGHTING, false);

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

@ -24,8 +24,7 @@ function test() {
Services.obs.addObserver(whenHighlighting, HIGHLIGHTING, false);
presenter.onSetupMesh = function() {
presenter.highlightNodeAt(presenter.canvas.width / 2,
presenter.canvas.height / 2);
presenter.highlightNodeAt(presenter.canvas.width / 2, 10);
};
}
});

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

@ -6,13 +6,6 @@ const ZOOM = 2;
const RESIZE = 50;
function test() {
let random = Math.random() * 10;
TiltUtils.setDocumentZoom(window, random);
ok(isApprox(TiltUtils.getDocumentZoom(window), random),
"The getDocumentZoom utility function didn't return the expected results.");
if (!isTiltEnabled()) {
info("Skipping controller test because Tilt isn't enabled.");
return;
@ -32,6 +25,9 @@ function test() {
},
onTiltOpen: function(instance)
{
ok(isApprox(InspectorUI.highlighter.zoom, ZOOM),
"The Highlighter zoom doesn't have the expected results.");
ok(isApprox(instance.presenter.transforms.zoom, ZOOM),
"The presenter transforms zoom wasn't initially set correctly.");
@ -74,10 +70,11 @@ function test() {
window.resizeBy(RESIZE * ZOOM, RESIZE * ZOOM);
Services.obs.addObserver(cleanup, DESTROYED, false);
InspectorUI.closeInspectorUI();
});
},
}
});
});
}

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

@ -37,6 +37,9 @@ const DEFAULT_HTML = "data:text/html," +
"A robot must protect its own existence as long as such protection " +
"does not conflict with the First or Second Laws." +
"</div>" +
"<div id='far-far-away' style='position: absolute; top: 250%;'>" +
"I like bacon." +
"</div>" +
"<body>" +
"</html>";
@ -137,8 +140,10 @@ function createTilt(callbacks, close) {
if ("function" === typeof callbacks.onInspectorOpen) {
callbacks.onInspectorOpen();
}
Services.obs.addObserver(onTiltOpen, INITIALIZING, false);
Tilt.initialize();
executeSoon(function() {
Services.obs.addObserver(onTiltOpen, INITIALIZING, false);
Tilt.initialize();
});
});
}
@ -150,8 +155,10 @@ function createTilt(callbacks, close) {
callbacks.onTiltOpen(Tilt.visualizers[Tilt.currentWindowId]);
}
if (close) {
Services.obs.addObserver(onTiltClose, DESTROYED, false);
Tilt.destroy(Tilt.currentWindowId);
executeSoon(function() {
Services.obs.addObserver(onTiltClose, DESTROYED, false);
Tilt.destroy(Tilt.currentWindowId);
});
}
});
}
@ -164,8 +171,10 @@ function createTilt(callbacks, close) {
callbacks.onTiltClose();
}
if (close) {
Services.obs.addObserver(onInspectorClose, INSPECTOR_CLOSED, false);
InspectorUI.closeInspectorUI();
executeSoon(function() {
Services.obs.addObserver(onInspectorClose, INSPECTOR_CLOSED, false);
InspectorUI.closeInspectorUI();
});
}
});
}

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

@ -435,14 +435,11 @@
#endif
@BINPATH@/chrome/toolkit@JAREXT@
@BINPATH@/chrome/toolkit.manifest
#ifdef XP_UNIX
#ifndef XP_MACOSX
#ifdef MOZ_GTK2
@BINPATH@/chrome/icons/default/default16.png
@BINPATH@/chrome/icons/default/default32.png
@BINPATH@/chrome/icons/default/default48.png
#endif
#endif
; shell icons
#ifdef XP_UNIX

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

@ -15,7 +15,6 @@
<!ENTITY locbar.bookmarks.label "Bookmarks">
<!ENTITY locbar.nothing.label "Nothing">
<!ENTITY acceptCookies.label "Accept cookies from sites">
<!ENTITY acceptCookies.accesskey "A">
@ -64,11 +63,8 @@
<!ENTITY privateBrowsingPermanent2.label "Always use private browsing mode">
<!ENTITY privateBrowsingPermanent2.accesskey "p">
<!ENTITY rememberHistory.label "Remember my browsing history">
<!ENTITY rememberHistory.accesskey "b">
<!ENTITY rememberDownload.label "Remember download history">
<!ENTITY rememberDownload.accesskey "d">
<!ENTITY rememberHistory2.label "Remember my browsing and download history">
<!ENTITY rememberHistory2.accesskey "b">
<!ENTITY rememberSearchForm.label "Remember search and form history">
<!ENTITY rememberSearchForm.accesskey "f">

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

@ -67,6 +67,7 @@ browser/components/shell/Makefile
browser/components/shell/public/Makefile
browser/components/shell/src/Makefile
browser/components/tabview/Makefile
browser/components/thumbnails/Makefile
browser/devtools/Makefile
browser/devtools/debugger/Makefile
browser/devtools/highlighter/Makefile
@ -75,6 +76,7 @@ browser/devtools/shared/Makefile
browser/devtools/sourceeditor/Makefile
browser/devtools/styleeditor/Makefile
browser/devtools/styleinspector/Makefile
browser/devtools/tilt/Makefile
browser/devtools/webconsole/Makefile
browser/fuel/Makefile
browser/fuel/public/Makefile
@ -122,6 +124,7 @@ fi
if [ "$ENABLE_TESTS" ]; then
add_makefiles "
browser/base/content/test/Makefile
browser/base/content/test/newtab/Makefile
browser/components/certerror/test/Makefile
browser/components/dirprovider/tests/Makefile
browser/components/preferences/tests/Makefile
@ -137,6 +140,7 @@ if [ "$ENABLE_TESTS" ]; then
browser/components/privatebrowsing/test/browser/Makefile
browser/components/tabview/test/Makefile
browser/components/test/Makefile
browser/components/thumbnails/test/Makefile
browser/devtools/debugger/test/Makefile
browser/devtools/highlighter/test/Makefile
browser/devtools/scratchpad/test/Makefile
@ -144,6 +148,7 @@ if [ "$ENABLE_TESTS" ]; then
browser/devtools/sourceeditor/test/Makefile
browser/devtools/styleeditor/test/Makefile
browser/devtools/styleinspector/test/Makefile
browser/devtools/tilt/test/Makefile
browser/devtools/webconsole/test/Makefile
browser/fuel/test/Makefile
browser/modules/test/Makefile

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

@ -79,8 +79,7 @@ let EXPORTED_SYMBOLS = [
*/
XPCOMUtils.defineLazyGetter(this, "_prefs", function() {
return Services.prefs.getBranch(PREF_TASKBAR_BRANCH)
.QueryInterface(Ci.nsIPrefBranch2);
return Services.prefs.getBranch(PREF_TASKBAR_BRANCH);
});
XPCOMUtils.defineLazyGetter(this, "_stringBundle", function() {

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

@ -724,6 +724,6 @@ XPCOMUtils.defineLazyGetter(AeroPeek, "cacheTimer", function ()
XPCOMUtils.defineLazyServiceGetter(AeroPeek, "prefs",
"@mozilla.org/preferences-service;1",
"nsIPrefBranch2");
"nsIPrefBranch");
AeroPeek.initialize();

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

До

Ширина:  |  Высота:  |  Размер: 517 B

После

Ширина:  |  Высота:  |  Размер: 517 B

0
browser/themes/winstripe/searchbar-dropdown-arrow.png Normal file → Executable file
Просмотреть файл

До

Ширина:  |  Высота:  |  Размер: 509 B

После

Ширина:  |  Высота:  |  Размер: 509 B

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

@ -44,18 +44,18 @@ include $(DEPTH)/config/autoconf.mk
NO_PROFILE_GUIDED_OPTIMIZE = 1
ifdef ENABLE_TESTS
ifdef _MSC_VER
ifneq ($(OS_TEST),x86_64)
DIRS += vmwarerecordinghelper
TEST_DIRS += vmwarerecordinghelper
endif
endif
DIRS += \
TEST_DIRS += \
crashinjectdll \
$(NULL)
ifdef ENABLE_TESTS
PROGRAM = crashinject$(BIN_SUFFIX)
USE_STATIC_LIBS = 1
CPPSRCS = crashinject.cpp

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

@ -67,7 +67,7 @@
#include "nsILocaleService.h"
#include "nsILocalFile.h"
#include "nsIObserverService.h"
#include "nsIPrefBranch2.h"
#include "nsIPrefBranch.h"
#include "nsIPrefService.h"
#include "nsIResProtocolHandler.h"
#include "nsIScriptError.h"
@ -190,12 +190,9 @@ nsChromeRegistryChrome::Init()
SelectLocaleFromPref(prefs);
nsCOMPtr<nsIPrefBranch2> prefs2 (do_QueryInterface(prefs));
if (prefs2) {
rv = prefs2->AddObserver(MATCH_OS_LOCALE_PREF, this, true);
rv = prefs2->AddObserver(SELECTED_LOCALE_PREF, this, true);
rv = prefs2->AddObserver(SELECTED_SKIN_PREF, this, true);
}
rv = prefs->AddObserver(MATCH_OS_LOCALE_PREF, this, true);
rv = prefs->AddObserver(SELECTED_LOCALE_PREF, this, true);
rv = prefs->AddObserver(SELECTED_SKIN_PREF, this, true);
}
nsCOMPtr<nsIObserverService> obsService = mozilla::services::GetObserverService();
@ -220,7 +217,7 @@ nsChromeRegistryChrome::CheckForOSAccessibility()
RefreshSkins();
}
nsCOMPtr<nsIPrefBranch2> prefs (do_GetService(NS_PREFSERVICE_CONTRACTID));
nsCOMPtr<nsIPrefBranch> prefs (do_GetService(NS_PREFSERVICE_CONTRACTID));
if (prefs) {
prefs->RemoveObserver(SELECTED_SKIN_PREF, this);
}
@ -387,7 +384,7 @@ nsChromeRegistryChrome::Observe(nsISupports *aSubject, const char *aTopic,
false, uiLocale);
if (NS_SUCCEEDED(rv) && !uiLocale.IsEmpty()) {
CopyUTF16toUTF8(uiLocale, mSelectedLocale);
nsCOMPtr<nsIPrefBranch2> prefs (do_GetService(NS_PREFSERVICE_CONTRACTID));
nsCOMPtr<nsIPrefBranch> prefs (do_GetService(NS_PREFSERVICE_CONTRACTID));
if (prefs) {
prefs->RemoveObserver(SELECTED_LOCALE_PREF, this);
}

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

@ -5481,7 +5481,7 @@ MOZ_ARG_DISABLE_BOOL(websms-backend,
MOZ_WEBSMS_BACKEND=,
MOZ_WEBSMS_BACKEND=1)
if test $MOZ_WEBSMS_BACKEND -eq 1; then
if test -n "$MOZ_WEBSMS_BACKEND"; then
AC_DEFINE(MOZ_WEBSMS_BACKEND)
fi
@ -5957,7 +5957,8 @@ MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
if test -n "${JAVA_BIN_PATH}" -o "$OS_TARGET" = Android; then
if test -n "${JAVA_BIN_PATH}" -o \
\( "$OS_TARGET" = Android -a x"$MOZ_WIDGET_TOOLKIT" != x"gonk" \); then
if test -z "$JAVA" -o "$JAVA" = ":" -o -z "$JAVAC" -o "$JAVAC" = ":" -o -z "$JAR" -o "$JAR" = ":"; then
AC_MSG_ERROR([The programs java, javac and jar were not found. Set \$JAVA_HOME to your java sdk directory or use --with-java-bin-path={java-bin-dir}])
fi
@ -8210,7 +8211,7 @@ dnl ========================================================
dnl qcms
dnl ========================================================
QCMS_LIBS='$(call EXPAND_LIBNAME_PATH,mozqcms,$(DEPTH)/gfx/qcms)'
QCMS_LIBS='$(DEPTH)/gfx/qcms/$(LIB_PREFIX)mozqcms.$(LIB_SUFFIX)'
AC_SUBST(QCMS_LIBS)
dnl ========================================================
@ -9063,14 +9064,14 @@ if test -z "$MOZ_NATIVE_NSPR"; then
if test -n "$USE_ARM_KUSER"; then
ac_configure_args="$ac_configure_args --with-arm-kuser"
fi
if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a $ac_cv_func_dladdr = no ; then
if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$ac_cv_func_dladdr" = no ; then
# dladdr is supported by the new linker, even when the system linker doesn't
# support it. Trick nspr into using dladdr when it's not supported.
_SAVE_CPPFLAGS="$CPPFLAGS"
export CPPFLAGS="-include $_topsrcdir/mozglue/linker/dladdr.h $CPPFLAGS"
fi
AC_OUTPUT_SUBDIRS(nsprpub)
if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a $ac_cv_func_dladdr = no; then
if test -n "$MOZ_LINKER" -a -z "$MOZ_OLD_LINKER" -a "$ac_cv_func_dladdr" = no; then
unset CPPFLAGS
CPPFLAGS="$_SAVE_CFLAGS"
fi

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

@ -950,6 +950,26 @@ public:
bool aCanBubble,
bool aCancelable,
bool *aDefaultAction = nsnull);
/**
* This method creates and dispatches a untrusted event.
* Works only with events which can be created by calling
* nsIDOMDocument::CreateEvent() with parameter "Events".
* @param aDoc The document which will be used to create the event.
* @param aTarget The target of the event, should be QIable to
* nsIDOMEventTarget.
* @param aEventName The name of the event.
* @param aCanBubble Whether the event can bubble.
* @param aCancelable Is the event cancelable.
* @param aDefaultAction Set to true if default action should be taken,
* see nsIDOMEventTarget::DispatchEvent.
*/
static nsresult DispatchUntrustedEvent(nsIDocument* aDoc,
nsISupports* aTarget,
const nsAString& aEventName,
bool aCanBubble,
bool aCancelable,
bool *aDefaultAction = nsnull);
/**
* This method creates and dispatches a trusted event to the chrome
@ -1945,6 +1965,14 @@ private:
const nsIID* aIID, jsval *vp,
nsIXPConnectJSObjectHolder** aHolder,
bool aAllowWrapping);
static nsresult DispatchEvent(nsIDocument* aDoc,
nsISupports* aTarget,
const nsAString& aEventName,
bool aCanBubble,
bool aCancelable,
bool aTrusted,
bool *aDefaultAction = nsnull);
static void InitializeModifierStrings();

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

@ -64,7 +64,6 @@ var gPrefObserver = {
var prefSvc = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService);
this._branch = prefSvc.getBranch("security.csp.");
this._branch.QueryInterface(Components.interfaces.nsIPrefBranch2);
this._branch.addObserver("", this, false);
this._debugEnabled = this._branch.getBoolPref("debug");
},

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

@ -3072,7 +3072,7 @@ static
nsresult GetEventAndTarget(nsIDocument* aDoc, nsISupports* aTarget,
const nsAString& aEventName,
bool aCanBubble, bool aCancelable,
nsIDOMEvent** aEvent,
bool aTrusted, nsIDOMEvent** aEvent,
nsIDOMEventTarget** aTargetOut)
{
nsCOMPtr<nsIDOMDocument> domDoc = do_QueryInterface(aDoc);
@ -3090,7 +3090,7 @@ nsresult GetEventAndTarget(nsIDocument* aDoc, nsISupports* aTarget,
rv = event->InitEvent(aEventName, aCanBubble, aCancelable);
NS_ENSURE_SUCCESS(rv, rv);
rv = privateEvent->SetTrusted(true);
rv = privateEvent->SetTrusted(aTrusted);
NS_ENSURE_SUCCESS(rv, rv);
rv = privateEvent->SetTarget(target);
@ -3107,11 +3107,33 @@ nsContentUtils::DispatchTrustedEvent(nsIDocument* aDoc, nsISupports* aTarget,
const nsAString& aEventName,
bool aCanBubble, bool aCancelable,
bool *aDefaultAction)
{
return DispatchEvent(aDoc, aTarget, aEventName, aCanBubble, aCancelable,
true, aDefaultAction);
}
// static
nsresult
nsContentUtils::DispatchUntrustedEvent(nsIDocument* aDoc, nsISupports* aTarget,
const nsAString& aEventName,
bool aCanBubble, bool aCancelable,
bool *aDefaultAction)
{
return DispatchEvent(aDoc, aTarget, aEventName, aCanBubble, aCancelable,
false, aDefaultAction);
}
// static
nsresult
nsContentUtils::DispatchEvent(nsIDocument* aDoc, nsISupports* aTarget,
const nsAString& aEventName,
bool aCanBubble, bool aCancelable,
bool aTrusted, bool *aDefaultAction)
{
nsCOMPtr<nsIDOMEvent> event;
nsCOMPtr<nsIDOMEventTarget> target;
nsresult rv = GetEventAndTarget(aDoc, aTarget, aEventName, aCanBubble,
aCancelable, getter_AddRefs(event),
aCancelable, aTrusted, getter_AddRefs(event),
getter_AddRefs(target));
NS_ENSURE_SUCCESS(rv, rv);
@ -3130,7 +3152,7 @@ nsContentUtils::DispatchChromeEvent(nsIDocument *aDoc,
nsCOMPtr<nsIDOMEvent> event;
nsCOMPtr<nsIDOMEventTarget> target;
nsresult rv = GetEventAndTarget(aDoc, aTarget, aEventName, aCanBubble,
aCancelable, getter_AddRefs(event),
aCancelable, true, getter_AddRefs(event),
getter_AddRefs(target));
NS_ENSURE_SUCCESS(rv, rv);

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

@ -81,6 +81,10 @@
#include "mozilla/dom/Element.h"
#include "mozilla/Preferences.h"
using namespace mozilla;
nsresult NS_NewDomSelection(nsISelection **aDomSelection);
static NS_DEFINE_CID(kCClipboardCID, NS_CLIPBOARD_CID);
@ -727,14 +731,16 @@ nsCopySupport::FireClipboardEvent(PRInt32 aType, nsIPresShell* aPresShell, nsISe
return false;
// next, fire the cut or copy event
nsEventStatus status = nsEventStatus_eIgnore;
nsEvent evt(true, aType);
nsEventDispatcher::Dispatch(content, presShell->GetPresContext(), &evt, nsnull,
&status);
// if the event was cancelled, don't do the clipboard operation
if (status == nsEventStatus_eConsumeNoDefault)
return false;
if (Preferences::GetBool("dom.event.clipboardevents.enabled", true)) {
nsEventStatus status = nsEventStatus_eIgnore;
nsEvent evt(true, aType);
nsEventDispatcher::Dispatch(content, presShell->GetPresContext(), &evt, nsnull,
&status);
// if the event was cancelled, don't do the clipboard operation
if (status == nsEventStatus_eConsumeNoDefault)
return false;
}
if (presShell->IsDestroying())
return false;

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

@ -1724,7 +1724,7 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE_WITH_DESTROY(nsDocument,
nsNodeUtils::LastRelease(this))
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsDocument)
return nsGenericElement::CanSkip(tmp);
return nsGenericElement::CanSkip(tmp, aRemovingAllowed);
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_END
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_BEGIN(nsDocument)

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

@ -98,7 +98,7 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsGenericDOMDataNode)
NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsGenericDOMDataNode)
return nsGenericElement::CanSkip(tmp);
return nsGenericElement::CanSkip(tmp, aRemovingAllowed);
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_END
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_BEGIN(nsGenericDOMDataNode)
@ -752,6 +752,9 @@ nsGenericDOMDataNode::SplitData(PRUint32 aOffset, nsIContent** aReturn,
return rv;
}
nsIDocument* document = GetCurrentDoc();
mozAutoDocUpdate updateBatch(document, UPDATE_CONTENT_MODEL, true);
// Use Clone for creating the new node so that the new node is of same class
// as this node!
nsCOMPtr<nsIContent> newContent = CloneDataNode(mNodeInfo, false);

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

@ -4634,7 +4634,7 @@ NodeHasActiveFrame(nsIDocument* aCurrentDoc, nsINode* aNode)
// since checking the blackness of the current document is usually fast and we
// don't want slow down such common cases.
bool
nsGenericElement::CanSkip(nsINode* aNode)
nsGenericElement::CanSkip(nsINode* aNode, bool aRemovingAllowed)
{
// Don't try to optimize anything during shutdown.
if (nsCCUncollectableMarker::sGeneration == 0) {
@ -4693,7 +4693,7 @@ nsGenericElement::CanSkip(nsINode* aNode)
}
// No need to put stuff to the nodesToClear array, if we can clear it
// already here.
if (node->IsPurple() && node != aNode) {
if (node->IsPurple() && (node != aNode || aRemovingAllowed)) {
node->RemovePurple();
}
MarkNodeChildren(node);
@ -4704,12 +4704,15 @@ nsGenericElement::CanSkip(nsINode* aNode)
}
}
if (!foundBlack) {
if (!currentDoc || !foundBlack) {
if (!gPurpleRoots) {
gPurpleRoots = new nsAutoTArray<nsINode*, 1020>();
}
root->SetIsPurpleRoot(true);
gPurpleRoots->AppendElement(root);
}
if (!foundBlack) {
return false;
}
@ -4726,8 +4729,9 @@ nsGenericElement::CanSkip(nsINode* aNode)
for (PRUint32 i = 0; i < nodesToClear.Length(); ++i) {
nsIContent* n = nodesToClear[i];
MarkNodeChildren(n);
// Can't remove currently handled purple node.
if (n != aNode && n->IsPurple()) {
// Can't remove currently handled purple node,
// unless aRemovingAllowed is true.
if ((n != aNode || aRemovingAllowed) && n->IsPurple()) {
n->RemovePurple();
}
}
@ -4757,7 +4761,7 @@ nsGenericElement::InitCCCallbacks()
}
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsGenericElement)
return nsGenericElement::CanSkip(tmp);
return nsGenericElement::CanSkip(tmp, aRemovingAllowed);
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_END
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_BEGIN(nsGenericElement)
@ -4793,14 +4797,31 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsGenericElement)
tmp->OwnerDoc()->GetDocumentURI()->GetSpec(uri);
}
if (nsid < ArrayLength(kNSURIs)) {
PR_snprintf(name, sizeof(name), "nsGenericElement%s %s %s", kNSURIs[nsid],
localName.get(), uri.get());
nsAutoString id;
nsIAtom* idAtom = tmp->GetID();
if (idAtom) {
id.AppendLiteral(" id='");
id.Append(nsDependentAtomString(idAtom));
id.AppendLiteral("'");
}
else {
PR_snprintf(name, sizeof(name), "nsGenericElement %s %s",
localName.get(), uri.get());
nsAutoString classes;
const nsAttrValue* classAttrValue = tmp->GetClasses();
if (classAttrValue) {
classes.AppendLiteral(" class='");
nsAutoString classString;
classAttrValue->ToString(classString);
classes.Append(classString);
classes.AppendLiteral("'");
}
const char* nsuri = nsid < ArrayLength(kNSURIs) ? kNSURIs[nsid] : "";
PR_snprintf(name, sizeof(name), "nsGenericElement%s %s%s%s %s",
nsuri,
localName.get(),
NS_ConvertUTF16toUTF8(id).get(),
NS_ConvertUTF16toUTF8(classes).get(),
uri.get());
cb.DescribeRefCountedNode(tmp->mRefCnt.get(), sizeof(nsGenericElement),
name);
}

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

@ -623,7 +623,7 @@ public:
mRefCnt.RemovePurple();
}
static bool CanSkip(nsINode* aNode);
static bool CanSkip(nsINode* aNode, bool aRemovingAllowed);
static bool CanSkipInCC(nsINode* aNode);
static bool CanSkipThis(nsINode* aNode);
static void MarkNodeChildren(nsINode* aNode);

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

@ -484,16 +484,18 @@ IsSupportedImage(const nsCString& aMimeType)
return NS_SUCCEEDED(rv) && supported;
}
static bool
IsSupportedPlugin(const nsCString& aMIMEType, bool aShouldPlay)
nsresult nsObjectLoadingContent::IsPluginEnabledForType(const nsCString& aMIMEType)
{
if (!mShouldPlay) {
return NS_ERROR_PLUGIN_CLICKTOPLAY;
}
nsCOMPtr<nsIPluginHost> pluginHostCOM(do_GetService(MOZ_PLUGIN_HOST_CONTRACTID));
nsPluginHost *pluginHost = static_cast<nsPluginHost*>(pluginHostCOM.get());
if (!pluginHost) {
return false;
}
nsresult rv = pluginHost->IsPluginEnabledForType(aMIMEType.get(), aShouldPlay);
return NS_SUCCEEDED(rv);
return pluginHost->IsPluginEnabledForType(aMIMEType.get());
}
static void
@ -517,9 +519,12 @@ GetExtensionFromURI(nsIURI* uri, nsCString& ext)
* Checks whether a plugin exists and is enabled for the extension
* in the given URI. The MIME type is returned in the mimeType out parameter.
*/
static bool
IsPluginEnabledByExtension(nsIURI* uri, nsCString& mimeType, bool aShouldPlay)
bool nsObjectLoadingContent::IsPluginEnabledByExtension(nsIURI* uri, nsCString& mimeType)
{
if (!mShouldPlay) {
return false;
}
nsCAutoString ext;
GetExtensionFromURI(uri, ext);
@ -534,8 +539,7 @@ IsPluginEnabledByExtension(nsIURI* uri, nsCString& mimeType, bool aShouldPlay)
}
const char* typeFromExt;
if (NS_SUCCEEDED(pluginHost->IsPluginEnabledForExtension(ext.get(), typeFromExt,
aShouldPlay))) {
if (NS_SUCCEEDED(pluginHost->IsPluginEnabledForExtension(ext.get(), typeFromExt))) {
mimeType = typeFromExt;
return true;
}
@ -568,6 +572,10 @@ nsObjectLoadingContent::~nsObjectLoadingContent()
nsresult
nsObjectLoadingContent::InstantiatePluginInstance(const char* aMimeType, nsIURI* aURI)
{
if (!mShouldPlay) {
return NS_ERROR_PLUGIN_CLICKTOPLAY;
}
// Don't do anything if we already have an active instance.
if (mInstanceOwner) {
return NS_OK;
@ -586,11 +594,6 @@ nsObjectLoadingContent::InstantiatePluginInstance(const char* aMimeType, nsIURI*
nsCOMPtr<nsIObjectLoadingContent> kungFuDeathGrip = this;
nsCOMPtr<nsIContent> thisContent = do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
nsCString typeToUse(aMimeType);
if (typeToUse.IsEmpty() && aURI) {
IsPluginEnabledByExtension(aURI, typeToUse, mShouldPlay);
}
nsCOMPtr<nsIURI> baseURI;
if (!aURI) {
// We need some URI. If we have nothing else, use the base URI.
@ -730,10 +733,10 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest,
if ((channelType.EqualsASCII(APPLICATION_OCTET_STREAM) &&
!mContentType.IsEmpty() &&
GetTypeOfContent(mContentType) != eType_Document) ||
// Need to check IsSupportedPlugin() in addition to GetTypeOfContent()
// Need to check IsPluginEnabledForType() in addition to GetTypeOfContent()
// because otherwise the default plug-in's catch-all behavior would
// confuse things.
(IsSupportedPlugin(mContentType, mShouldPlay) &&
(NS_SUCCEEDED(IsPluginEnabledForType(mContentType)) &&
GetTypeOfContent(mContentType) == eType_Plugin)) {
// Set the type we'll use for dispatch on the channel. Otherwise we could
// end up trying to dispatch to a nsFrameLoader, which will complain that
@ -752,7 +755,7 @@ nsObjectLoadingContent::OnStartRequest(nsIRequest *aRequest,
if (mContentType.EqualsASCII(APPLICATION_OCTET_STREAM)) {
nsCAutoString extType;
if (IsPluginEnabledByExtension(uri, extType, mShouldPlay)) {
if (IsPluginEnabledByExtension(uri, extType)) {
mContentType = extType;
chan->SetContentType(extType);
}
@ -1297,8 +1300,8 @@ nsObjectLoadingContent::LoadObject(nsIURI* aURI,
nsCAutoString overrideType;
if ((caps & eOverrideServerType) &&
((!aTypeHint.IsEmpty() && IsSupportedPlugin(aTypeHint, mShouldPlay)) ||
(aURI && IsPluginEnabledByExtension(aURI, overrideType, mShouldPlay)))) {
((!aTypeHint.IsEmpty() && NS_SUCCEEDED(IsPluginEnabledForType(aTypeHint))) ||
(aURI && IsPluginEnabledByExtension(aURI, overrideType)))) {
ObjectType newType;
if (overrideType.IsEmpty()) {
newType = GetTypeOfContent(aTypeHint);
@ -1434,7 +1437,7 @@ nsObjectLoadingContent::LoadObject(nsIURI* aURI,
return NS_OK;
}
if (IsSupportedPlugin(aTypeHint, mShouldPlay)) {
if (NS_SUCCEEDED(IsPluginEnabledForType(aTypeHint))) {
mType = eType_Plugin;
} else {
rv = NS_ERROR_NOT_AVAILABLE;
@ -1744,7 +1747,7 @@ nsObjectLoadingContent::GetTypeOfContent(const nsCString& aMIMEType)
return eType_Document;
}
if ((caps & eSupportPlugins) && IsSupportedPlugin(aMIMEType, mShouldPlay)) {
if ((caps & eSupportPlugins) && NS_SUCCEEDED(IsPluginEnabledForType(aMIMEType))) {
return eType_Plugin;
}
@ -1755,16 +1758,10 @@ nsresult
nsObjectLoadingContent::TypeForClassID(const nsAString& aClassID,
nsACString& aType)
{
nsCOMPtr<nsIPluginHost> pluginHostCOM(do_GetService(MOZ_PLUGIN_HOST_CONTRACTID));
nsPluginHost *pluginHost = static_cast<nsPluginHost*>(pluginHostCOM.get());
if (!pluginHost) {
return NS_ERROR_NOT_AVAILABLE;
}
if (StringBeginsWith(aClassID, NS_LITERAL_STRING("java:"))) {
// Supported if we have a java plugin
aType.AssignLiteral("application/x-java-vm");
nsresult rv = pluginHost->IsPluginEnabledForType("application/x-java-vm");
nsresult rv = IsPluginEnabledForType(NS_LITERAL_CSTRING("application/x-java-vm"));
return NS_SUCCEEDED(rv) ? NS_OK : NS_ERROR_NOT_AVAILABLE;
}
@ -1772,11 +1769,11 @@ nsObjectLoadingContent::TypeForClassID(const nsAString& aClassID,
if (StringBeginsWith(aClassID, NS_LITERAL_STRING("clsid:"), nsCaseInsensitiveStringComparator())) {
// Check if we have a plugin for that
if (NS_SUCCEEDED(pluginHost->IsPluginEnabledForType("application/x-oleobject"))) {
if (NS_SUCCEEDED(IsPluginEnabledForType(NS_LITERAL_CSTRING("application/x-oleobject")))) {
aType.AssignLiteral("application/x-oleobject");
return NS_OK;
}
if (NS_SUCCEEDED(pluginHost->IsPluginEnabledForType("application/oleobject"))) {
if (NS_SUCCEEDED(IsPluginEnabledForType(NS_LITERAL_CSTRING("application/oleobject")))) {
aType.AssignLiteral("application/oleobject");
return NS_OK;
}
@ -1832,7 +1829,7 @@ nsObjectLoadingContent::HandleBeingBlockedByContentPolicy(nsresult aStatus,
}
}
/* static */ PluginSupportState
PluginSupportState
nsObjectLoadingContent::GetPluginSupportState(nsIContent* aContent,
const nsCString& aContentType)
{
@ -1866,16 +1863,10 @@ nsObjectLoadingContent::GetPluginSupportState(nsIContent* aContent,
GetPluginDisabledState(aContentType);
}
/* static */ PluginSupportState
PluginSupportState
nsObjectLoadingContent::GetPluginDisabledState(const nsCString& aContentType)
{
nsCOMPtr<nsIPluginHost> pluginHostCOM(do_GetService(MOZ_PLUGIN_HOST_CONTRACTID));
nsPluginHost *pluginHost = static_cast<nsPluginHost*>(pluginHostCOM.get());
if (!pluginHost) {
return ePluginUnsupported;
}
nsresult rv = pluginHost->IsPluginEnabledForType(aContentType.get());
nsresult rv = IsPluginEnabledForType(aContentType);
if (rv == NS_ERROR_PLUGIN_DISABLED)
return ePluginDisabled;
if (rv == NS_ERROR_PLUGIN_CLICKTOPLAY)
@ -1953,14 +1944,17 @@ nsObjectLoadingContent::SyncStartPluginInstance()
NS_ASSERTION(nsContentUtils::IsSafeToRunScript(),
"Must be able to run script in order to instantiate a plugin instance!");
// Don't even attempt to start an instance unless the content is in the document.
nsCOMPtr<nsIContent> thisContent = do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
// Don't even attempt to start an instance unless the content is in
// the document.
nsCOMPtr<nsIContent> thisContent =
do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
if (!thisContent->IsInDoc()) {
return NS_ERROR_FAILURE;
}
nsCOMPtr<nsIURI> kungFuURIGrip(mURI);
return InstantiatePluginInstance(mContentType.get(), mURI.get());
nsCString contentType(mContentType);
return InstantiatePluginInstance(contentType.get(), mURI.get());
}
NS_IMETHODIMP
@ -2117,6 +2111,7 @@ nsObjectLoadingContent::PlayPlugin()
if (!nsContentUtils::IsCallerChrome())
return NS_OK;
mSrcStreamLoadInitiated = false;
mShouldPlay = true;
return LoadObject(mURI, true, mContentType, true);
}

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

@ -328,9 +328,7 @@ class nsObjectLoadingContent : public nsImageLoadingContent
*
* This should only be called if the type of this content is eType_Null.
*/
static PluginSupportState
GetPluginSupportState(nsIContent* aContent,
const nsCString& aContentType);
PluginSupportState GetPluginSupportState(nsIContent* aContent, const nsCString& aContentType);
/**
* If the plugin for aContentType is disabled, return ePluginDisabled.
@ -339,17 +337,17 @@ class nsObjectLoadingContent : public nsImageLoadingContent
*
* This should only be called if the type of this content is eType_Null.
*/
static PluginSupportState
GetPluginDisabledState(const nsCString& aContentType);
PluginSupportState GetPluginDisabledState(const nsCString& aContentType);
/**
* When there is no usable plugin available this will send UI events and
* update the AutoFallback object appropriate to the reason for there being
* no plugin available.
*/
static void
UpdateFallbackState(nsIContent* aContent, AutoFallback& fallback,
const nsCString& aTypeHint);
void UpdateFallbackState(nsIContent* aContent, AutoFallback& fallback, const nsCString& aTypeHint);
nsresult IsPluginEnabledForType(const nsCString& aMIMEType);
bool IsPluginEnabledByExtension(nsIURI* uri, nsCString& mimeType);
/**
* The final listener to ship the data to (imagelib, uriloader, etc)

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

@ -554,6 +554,7 @@ _TEST_FILES2 = \
file_bug717511.html^headers^ \
file_bug717511_2.html \
file_bug717511_2.html^headers^ \
test_bug726364.html \
$(NULL)
_CHROME_FILES = \

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

@ -0,0 +1,48 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=726364
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 726364</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=726364">Mozilla Bug 726364</a>
<p id="display"><div id="v">ABC</div></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 726364 **/
function boom()
{
var v = document.getElementById("v");
var t = v.firstChild;
is(v.childNodes.length,1, "child count");
var f = function(event) {
window.removeEventListener("DOMCharacterDataModified", f, true);
is(v.childNodes[0],t, "first child is the same");
is(v.childNodes.length,2, "child count");
r.setEnd(v, 0);
SimpleTest.finish();
};
window.addEventListener("DOMCharacterDataModified", f, true);
var r = document.createRange();
r.setStart(t, 2);
t.splitText(1);
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(boom);
</script>
</pre>
</body>
</html>

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

@ -74,8 +74,21 @@
var first_test = 1;
var last_test = 46;
var current_test = first_test;
// Set this to >1 if you want to run the suite multiple times to probe for
// random orange failures.
// - Do NOT check into mozilla-central with a value != 1.
// - Too large a count will wind up causing tryserver to timeout the test (which
// is ok, but means all testruns will be orange). If I set first_test to >22
// (i.e don't run any of the tests that require waiting) I can get ~250-300
// iterations of the remaining tests w/o a timeout.
var testsuite_iterations = 1;
var current_test = first_test;
var testsuite_iteration = 1;
var test_started = new Array(last_test);
var all_ws = [];
function shouldNotOpen(e)
@ -176,16 +189,21 @@ function doTest(number)
return;
}
$("feedback").innerHTML = "executing test: " + number + " of " + last_test + " tests.";
if (testsuite_iteration > 1) {
$("feedback").innerHTML = "test suite iteration #" + testsuite_iteration + " of " + testsuite_iterations +
": executing test: " + number + " of " + last_test + " tests.";
} else {
$("feedback").innerHTML = "executing test: " + number + " of " + last_test + " tests.";
}
var fnTest = eval("test" + number + "");
if (fnTest._started === true) {
if (test_started[number] === true) {
doTest(number + 1);
return;
}
fnTest._started = true;
test_started[number] = true;
fnTest();
}
doTest.timeoutId = null;
@ -561,7 +579,7 @@ var status_test17 = "not started";
var waitTest17 = false;
window._test17 = function()
var test17func = function()
{
waitTest17 = true;
@ -611,6 +629,7 @@ window._test17 = function()
function test17()
{
window._test17 = test17func;
window._test17();
}
@ -644,7 +663,7 @@ function test19()
var waitTest20 = false;
window._test20 = function()
var test20func = function()
{
waitTest20 = true;
@ -674,12 +693,13 @@ window._test20 = function()
function test20()
{
window._test20 = test20func;
window._test20();
}
var waitTest21 = false;
window._test21 = function()
test21func = function()
{
waitTest21 = true;
@ -727,6 +747,7 @@ window._test21 = function()
function test21()
{
window._test21 = test21func;
window._test21();
}
@ -1422,7 +1443,15 @@ function maybeFinished()
}
}
SimpleTest.finish();
if (testsuite_iteration++ < testsuite_iterations) {
// play it again, Sam...
ok(1, "starting testsuite iteration " + testsuite_iteration);
test_started = new Array(last_test);
doTest(current_test = first_test);
} else {
// all done
SimpleTest.finish();
}
}
function testWebSocket ()

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

@ -43,6 +43,7 @@
#include "nsIDocument.h"
#include "nsIJSContextStack.h"
#include "nsDOMJSUtils.h"
#include "prprf.h"
NS_IMPL_CYCLE_COLLECTION_CLASS(nsDOMEventListenerWrapper)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsDOMEventListenerWrapper)
@ -72,7 +73,21 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(nsDOMEventTargetHelper)
NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
NS_IMPL_CYCLE_COLLECTION_TRACE_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsDOMEventTargetHelper)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsDOMEventTargetHelper)
if (NS_UNLIKELY(cb.WantDebugInfo())) {
char name[512];
nsAutoString uri;
if (tmp->mOwner && tmp->mOwner->GetExtantDocument()) {
tmp->mOwner->GetExtantDocument()->GetDocumentURI(uri);
}
PR_snprintf(name, sizeof(name), "nsDOMEventTargetHelper %s",
NS_ConvertUTF16toUTF8(uri).get());
cb.DescribeRefCountedNode(tmp->mRefCnt.get(), sizeof(nsDOMEventTargetHelper),
name);
} else {
NS_IMPL_CYCLE_COLLECTION_DESCRIBE(nsDOMEventTargetHelper, tmp->mRefCnt.get())
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_MEMBER(mListenerManager,
nsEventListenerManager)

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше