--- a/accessible/build/Makefile.in
+++ b/accessible/build/Makefile.in
@@ -66,34 +66,10 @@ SHARED_LIBRARY_LIBS = \
ifdef MOZ_XUL
SHARED_LIBRARY_LIBS += ../src/xul/$(LIB_PREFIX)accessibility_xul_s.$(LIB_SUFFIX)
endif
ifndef DISABLE_XFORMS_HOOKS
SHARED_LIBRARY_LIBS += ../src/xforms/$(LIB_PREFIX)accessibility_xforms_s.$(LIB_SUFFIX)
endif
-EXTRA_DSO_LIBS = \
- gkgfx \
- thebes \
- $(NULL)
-
-EXTRA_DSO_LDOPTS = \
- $(LIBS_DIR) \
- $(EXTRA_DSO_LIBS) \
- $(MOZ_UNICHARUTIL_LIBS) \
- $(MOZ_COMPONENT_LIBS) \
- $(NULL)
-
-ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
-EXTRA_DSO_LDOPTS += $(MOZ_GTK2_LIBS)
-endif
-
-ifeq ($(OS_ARCH),WINNT)
-OS_LIBS += \
- oleaut32.lib \
- version.lib \
- ole32.lib \
- $(NULL)
-endif
-
include $(topsrcdir)/config/rules.mk
--- a/accessible/src/atk/AtkSocketAccessible.cpp
+++ b/accessible/src/atk/AtkSocketAccessible.cpp
@@ -1,11 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2:
- */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/AtkSocketAccessible.h
+++ b/accessible/src/atk/AtkSocketAccessible.h
@@ -1,11 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2:
- */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/Makefile.in
+++ b/accessible/src/atk/Makefile.in
@@ -83,18 +83,16 @@ EXPORTS = \
nsHTMLImageAccessibleWrap.h \
nsHTMLTableAccessibleWrap.h \
nsAccessibleRelationWrap.h \
$(NULL)
# we want to force the creation of a static lib.
FORCE_STATIC_LIB = 1
-EXTRA_DSO_LDOPTS += $(MOZ_GTK2_LIBS)
-
include $(topsrcdir)/config/rules.mk
CFLAGS += $(MOZ_GTK2_CFLAGS)
CXXFLAGS += $(MOZ_GTK2_CFLAGS)
LOCAL_INCLUDES += \
-I$(srcdir) \
-I$(srcdir)/../base \
--- a/accessible/src/atk/nsARIAGridAccessibleWrap.h
+++ b/accessible/src/atk/nsARIAGridAccessibleWrap.h
@@ -1,11 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2:
- */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsAccessNodeWrap.cpp
+++ b/accessible/src/atk/nsAccessNodeWrap.cpp
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsAccessNodeWrap.h
+++ b/accessible/src/atk/nsAccessNodeWrap.h
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsAccessibleRelationWrap.h
+++ b/accessible/src/atk/nsAccessibleRelationWrap.h
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsAccessibleWrap.cpp
+++ b/accessible/src/atk/nsAccessibleWrap.cpp
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsAccessibleWrap.h
+++ b/accessible/src/atk/nsAccessibleWrap.h
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsApplicationAccessibleWrap.cpp
+++ b/accessible/src/atk/nsApplicationAccessibleWrap.cpp
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsApplicationAccessibleWrap.h
+++ b/accessible/src/atk/nsApplicationAccessibleWrap.h
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsDocAccessibleWrap.cpp
+++ b/accessible/src/atk/nsDocAccessibleWrap.cpp
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsDocAccessibleWrap.h
+++ b/accessible/src/atk/nsDocAccessibleWrap.h
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsHTMLImageAccessibleWrap.h
+++ b/accessible/src/atk/nsHTMLImageAccessibleWrap.h
@@ -1,11 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2:
- */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsHTMLTableAccessibleWrap.h
+++ b/accessible/src/atk/nsHTMLTableAccessibleWrap.h
@@ -1,11 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2:
- */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsHyperTextAccessibleWrap.h
+++ b/accessible/src/atk/nsHyperTextAccessibleWrap.h
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsMai.h
+++ b/accessible/src/atk/nsMai.h
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsMaiHyperlink.cpp
+++ b/accessible/src/atk/nsMaiHyperlink.cpp
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsMaiHyperlink.h
+++ b/accessible/src/atk/nsMaiHyperlink.h
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsMaiInterfaceAction.cpp
+++ b/accessible/src/atk/nsMaiInterfaceAction.cpp
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsMaiInterfaceAction.h
+++ b/accessible/src/atk/nsMaiInterfaceAction.h
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsMaiInterfaceComponent.cpp
+++ b/accessible/src/atk/nsMaiInterfaceComponent.cpp
@@ -1,11 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2:
- */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsMaiInterfaceComponent.h
+++ b/accessible/src/atk/nsMaiInterfaceComponent.h
@@ -1,11 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2:
- */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsMaiInterfaceDocument.cpp
+++ b/accessible/src/atk/nsMaiInterfaceDocument.cpp
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsMaiInterfaceDocument.h
+++ b/accessible/src/atk/nsMaiInterfaceDocument.h
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsMaiInterfaceEditableText.cpp
+++ b/accessible/src/atk/nsMaiInterfaceEditableText.cpp
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsMaiInterfaceEditableText.h
+++ b/accessible/src/atk/nsMaiInterfaceEditableText.h
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsMaiInterfaceHyperlinkImpl.cpp
+++ b/accessible/src/atk/nsMaiInterfaceHyperlinkImpl.cpp
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsMaiInterfaceHyperlinkImpl.h
+++ b/accessible/src/atk/nsMaiInterfaceHyperlinkImpl.h
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsMaiInterfaceHypertext.cpp
+++ b/accessible/src/atk/nsMaiInterfaceHypertext.cpp
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsMaiInterfaceHypertext.h
+++ b/accessible/src/atk/nsMaiInterfaceHypertext.h
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsMaiInterfaceImage.cpp
+++ b/accessible/src/atk/nsMaiInterfaceImage.cpp
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsMaiInterfaceImage.h
+++ b/accessible/src/atk/nsMaiInterfaceImage.h
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsMaiInterfaceSelection.cpp
+++ b/accessible/src/atk/nsMaiInterfaceSelection.cpp
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsMaiInterfaceSelection.h
+++ b/accessible/src/atk/nsMaiInterfaceSelection.h
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsMaiInterfaceTable.cpp
+++ b/accessible/src/atk/nsMaiInterfaceTable.cpp
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsMaiInterfaceTable.h
+++ b/accessible/src/atk/nsMaiInterfaceTable.h
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsMaiInterfaceText.cpp
+++ b/accessible/src/atk/nsMaiInterfaceText.cpp
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsMaiInterfaceText.h
+++ b/accessible/src/atk/nsMaiInterfaceText.h
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsMaiInterfaceValue.cpp
+++ b/accessible/src/atk/nsMaiInterfaceValue.cpp
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsMaiInterfaceValue.h
+++ b/accessible/src/atk/nsMaiInterfaceValue.h
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsRoleMap.h
+++ b/accessible/src/atk/nsRoleMap.h
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsRootAccessibleWrap.cpp
+++ b/accessible/src/atk/nsRootAccessibleWrap.cpp
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsRootAccessibleWrap.h
+++ b/accessible/src/atk/nsRootAccessibleWrap.h
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsStateMap.h
+++ b/accessible/src/atk/nsStateMap.h
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsTextAccessibleWrap.h
+++ b/accessible/src/atk/nsTextAccessibleWrap.h
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsXULListboxAccessibleWrap.h
+++ b/accessible/src/atk/nsXULListboxAccessibleWrap.h
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsXULMenuAccessibleWrap.h
+++ b/accessible/src/atk/nsXULMenuAccessibleWrap.h
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/atk/nsXULTreeGridAccessibleWrap.h
+++ b/accessible/src/atk/nsXULTreeGridAccessibleWrap.h
@@ -1,10 +1,10 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2: */
+/* vim: set ts=2 et sw=2 tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
--- a/accessible/src/base/AccEvent.cpp
+++ b/accessible/src/base/AccEvent.cpp
@@ -308,18 +308,18 @@ AccMutationEvent::
// AccHideEvent
////////////////////////////////////////////////////////////////////////////////
AccHideEvent::
AccHideEvent(nsAccessible* aTarget, nsINode* aTargetNode) :
AccMutationEvent(::nsIAccessibleEvent::EVENT_HIDE, aTarget, aTargetNode)
{
mParent = mAccessible->GetParent();
- mNextSibling = mAccessible->GetCachedNextSibling();
- mPrevSibling = mAccessible->GetCachedPrevSibling();
+ mNextSibling = mAccessible->NextSibling();
+ mPrevSibling = mAccessible->PrevSibling();
}
////////////////////////////////////////////////////////////////////////////////
// AccShowEvent
////////////////////////////////////////////////////////////////////////////////
AccShowEvent::
--- a/accessible/src/base/AccGroupInfo.cpp
+++ b/accessible/src/base/AccGroupInfo.cpp
@@ -147,27 +147,27 @@ AccGroupInfo::AccGroupInfo(nsAccessible*
// parent. Or, if the parent is something other than a tree we will
// return that.
if (parentRole != nsIAccessibleRole::ROLE_GROUPING) {
mParent = parent;
return;
}
- nsAccessible* parentPrevSibling = parent->GetSiblingAtOffset(-1);
+ nsAccessible* parentPrevSibling = parent->PrevSibling();
if (!parentPrevSibling)
return;
PRUint32 parentPrevSiblingRole = parentPrevSibling->Role();
if (parentPrevSiblingRole == nsIAccessibleRole::ROLE_TEXT_LEAF) {
// XXX Sometimes an empty text accessible is in the hierarchy here,
// although the text does not appear to be rendered, GetRenderedText()
// says that it is so we need to skip past it to find the true
// previous sibling.
- parentPrevSibling = parentPrevSibling->GetSiblingAtOffset(-1);
+ parentPrevSibling = parentPrevSibling->PrevSibling();
if (parentPrevSibling)
parentPrevSiblingRole = parentPrevSibling->Role();
}
// Previous sibling of parent group is a tree item, this is the
// conceptual tree item parent.
if (parentPrevSiblingRole == nsIAccessibleRole::ROLE_OUTLINEITEM)
mParent = parentPrevSibling;
--- a/accessible/src/base/nsAccessNode.cpp
+++ b/accessible/src/base/nsAccessNode.cpp
@@ -85,17 +85,17 @@ nsApplicationAccessible *nsAccessNode::g
/*
* Class nsAccessNode
*/
////////////////////////////////////////////////////////////////////////////////
// nsAccessible. nsISupports
-NS_IMPL_CYCLE_COLLECTION_0(nsAccessNode)
+NS_IMPL_CYCLE_COLLECTION_1(nsAccessNode, mContent)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsAccessNode)
NS_INTERFACE_MAP_ENTRY(nsIAccessNode)
NS_INTERFACE_MAP_ENTRY(nsAccessNode)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIAccessNode)
NS_INTERFACE_MAP_END
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsAccessNode)
--- a/accessible/src/base/nsAccessible.cpp
+++ b/accessible/src/base/nsAccessible.cpp
@@ -445,27 +445,35 @@ nsAccessible::GetParent(nsIAccessible **
return *aParent ? NS_OK : NS_ERROR_FAILURE;
}
/* readonly attribute nsIAccessible nextSibling; */
NS_IMETHODIMP
nsAccessible::GetNextSibling(nsIAccessible **aNextSibling)
{
NS_ENSURE_ARG_POINTER(aNextSibling);
+ *aNextSibling = nsnull;
+
+ if (IsDefunct())
+ return NS_ERROR_FAILURE;
nsresult rv = NS_OK;
NS_IF_ADDREF(*aNextSibling = GetSiblingAtOffset(1, &rv));
return rv;
}
/* readonly attribute nsIAccessible previousSibling; */
NS_IMETHODIMP
nsAccessible::GetPreviousSibling(nsIAccessible * *aPreviousSibling)
{
NS_ENSURE_ARG_POINTER(aPreviousSibling);
+ *aPreviousSibling = nsnull;
+
+ if (IsDefunct())
+ return NS_ERROR_FAILURE;
nsresult rv = NS_OK;
NS_IF_ADDREF(*aPreviousSibling = GetSiblingAtOffset(-1, &rv));
return rv;
}
/* readonly attribute nsIAccessible firstChild; */
NS_IMETHODIMP
@@ -598,17 +606,17 @@ nsresult nsAccessible::GetTranslatedStri
nsresult nsAccessible::GetFullKeyName(const nsAString& aModifierName, const nsAString& aKeyName, nsAString& aStringOut)
{
nsXPIDLString modifierName, separator;
if (!gKeyStringBundle ||
NS_FAILED(gKeyStringBundle->GetStringFromName(PromiseFlatString(aModifierName).get(),
getter_Copies(modifierName))) ||
- NS_FAILED(gKeyStringBundle->GetStringFromName(PromiseFlatString(NS_LITERAL_STRING("MODIFIER_SEPARATOR")).get(),
+ NS_FAILED(gKeyStringBundle->GetStringFromName(NS_LITERAL_STRING("MODIFIER_SEPARATOR").get(),
getter_Copies(separator)))) {
return NS_ERROR_FAILURE;
}
aStringOut = modifierName + separator + aKeyName;
return NS_OK;
}
@@ -3161,49 +3169,31 @@ nsAccessible::EnsureChildren()
if (document)
document->NotifyOfCachingEnd(this);
return false;
}
nsAccessible*
-nsAccessible::GetSiblingAtOffset(PRInt32 aOffset, nsresult* aError)
+nsAccessible::GetSiblingAtOffset(PRInt32 aOffset, nsresult* aError) const
{
- if (IsDefunct()) {
- if (aError)
- *aError = NS_ERROR_FAILURE;
-
- return nsnull;
- }
-
- nsAccessible *parent = GetParent();
- if (!parent) {
+ if (!mParent || mIndexInParent == -1) {
if (aError)
*aError = NS_ERROR_UNEXPECTED;
return nsnull;
}
- if (mIndexInParent == -1) {
- if (aError)
- *aError = NS_ERROR_UNEXPECTED;
-
+ if (aError && mIndexInParent + aOffset >= mParent->GetChildCount()) {
+ *aError = NS_OK; // fail peacefully
return nsnull;
}
- if (aError) {
- PRInt32 childCount = parent->GetChildCount();
- if (mIndexInParent + aOffset >= childCount) {
- *aError = NS_OK; // fail peacefully
- return nsnull;
- }
- }
-
- nsAccessible* child = parent->GetChildAt(mIndexInParent + aOffset);
+ nsAccessible* child = mParent->GetChildAt(mIndexInParent + aOffset);
if (aError && !child)
*aError = NS_ERROR_UNEXPECTED;
return child;
}
nsAccessible *
nsAccessible::GetFirstAvailableAccessible(nsINode *aStartNode) const
--- a/accessible/src/base/nsAccessible.h
+++ b/accessible/src/base/nsAccessible.h
@@ -300,47 +300,56 @@ public:
virtual PRInt32 GetIndexInParent() const;
/**
* Return true if accessible has children;
*/
PRBool HasChildren() { return !!GetChildAt(0); }
/**
+ * Return next/previous sibling of the accessible.
+ */
+ inline nsAccessible* NextSibling() const
+ { return GetSiblingAtOffset(1); }
+ inline nsAccessible* PrevSibling() const
+ { return GetSiblingAtOffset(-1); }
+
+ /**
* Return embedded accessible children count.
*/
PRInt32 GetEmbeddedChildCount();
/**
* Return embedded accessible child at the given index.
*/
nsAccessible* GetEmbeddedChildAt(PRUint32 aIndex);
/**
* Return index of the given embedded accessible child.
*/
PRInt32 GetIndexOfEmbeddedChild(nsAccessible* aChild);
/**
- * Return cached accessible of parent-child relatives.
+ * Return number of content children/content child at index. The content
+ * child is created from markup in contrast to it's never constructed by its
+ * parent accessible (like treeitem accessibles for XUL trees).
*/
- nsAccessible* GetCachedNextSibling() const
- {
- return mParent ?
- mParent->mChildren.SafeElementAt(mIndexInParent + 1, nsnull).get() : nsnull;
- }
- nsAccessible* GetCachedPrevSibling() const
- {
- return mParent ?
- mParent->mChildren.SafeElementAt(mIndexInParent - 1, nsnull).get() : nsnull;
- }
- PRUint32 GetCachedChildCount() const { return mChildren.Length(); }
- nsAccessible* GetCachedChildAt(PRUint32 aIndex) const { return mChildren.ElementAt(aIndex); }
+ PRUint32 ContentChildCount() const { return mChildren.Length(); }
+ nsAccessible* ContentChildAt(PRUint32 aIndex) const
+ { return mChildren.ElementAt(aIndex); }
+
+ /**
+ * Return true if children were initialized.
+ */
inline bool AreChildrenCached() const
{ return !IsChildrenFlag(eChildrenUninitialized); }
+
+ /**
+ * Return true if the accessible is attached to tree.
+ */
bool IsBoundToParent() const { return !!mParent; }
//////////////////////////////////////////////////////////////////////////////
// Miscellaneous methods
/**
* Handle accessible event, i.e. process it, notifies observers and fires
* platform specific event.
@@ -498,17 +507,17 @@ protected:
*/
virtual void BindToParent(nsAccessible* aParent, PRUint32 aIndexInParent);
void UnbindFromParent();
/**
* Return sibling accessible at the given offset.
*/
virtual nsAccessible* GetSiblingAtOffset(PRInt32 aOffset,
- nsresult *aError = nsnull);
+ nsresult *aError = nsnull) const;
/**
* Flags used to describe the state and type of children.
*/
enum ChildrenFlags {
eChildrenUninitialized = 0, // children aren't initialized
eMixedChildren = 1 << 0, // text leaf children are presented
eEmbeddedChildren = 1 << 1 // all children are embedded objects
--- a/accessible/src/base/nsApplicationAccessible.cpp
+++ b/accessible/src/base/nsApplicationAccessible.cpp
@@ -423,25 +423,19 @@ nsApplicationAccessible::CacheChildren()
GetAccService()->GetDocAccessible(docNode); // ensure creation
}
}
windowEnumerator->HasMoreElements(&hasMore);
}
}
nsAccessible*
-nsApplicationAccessible::GetSiblingAtOffset(PRInt32 aOffset, nsresult* aError)
+nsApplicationAccessible::GetSiblingAtOffset(PRInt32 aOffset,
+ nsresult* aError) const
{
- if (IsDefunct()) {
- if (aError)
- *aError = NS_ERROR_FAILURE;
-
- return nsnull;
- }
-
if (aError)
*aError = NS_OK; // fail peacefully
return nsnull;
}
////////////////////////////////////////////////////////////////////////////////
// nsIAccessNode and nsAccessNode
--- a/accessible/src/base/nsApplicationAccessible.h
+++ b/accessible/src/base/nsApplicationAccessible.h
@@ -131,16 +131,16 @@ public:
virtual void InvalidateChildren();
protected:
// nsAccessible
virtual void CacheChildren();
virtual nsAccessible* GetSiblingAtOffset(PRInt32 aOffset,
- nsresult *aError = nsnull);
+ nsresult *aError = nsnull) const;
private:
nsCOMPtr<nsIXULAppInfo> mAppInfo;
};
#endif
--- a/accessible/src/base/nsDocAccessible.cpp
+++ b/accessible/src/base/nsDocAccessible.cpp
@@ -133,29 +133,31 @@ nsDocAccessible::~nsDocAccessible()
////////////////////////////////////////////////////////////////////////////////
// nsISupports
NS_IMPL_CYCLE_COLLECTION_CLASS(nsDocAccessible)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsDocAccessible, nsAccessible)
+ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mDocument)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_MEMBER(mNotificationController,
NotificationController)
PRUint32 i, length = tmp->mChildDocuments.Length();
for (i = 0; i < length; ++i) {
- NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mChildDocuments[i]");
- cb.NoteXPCOMChild(static_cast<nsIAccessible*>(tmp->mChildDocuments[i].get()));
+ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mChildDocuments[i],
+ nsIAccessible)
}
CycleCollectorTraverseCache(tmp->mAccessibleCache, &cb);
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsDocAccessible, nsAccessible)
+ NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mDocument)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mNotificationController)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSTARRAY(mChildDocuments)
tmp->mDependentIDsHash.Clear();
tmp->mNodeToAccessibleMap.Clear();
ClearCache(tmp->mAccessibleCache);
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDocAccessible)
@@ -1914,51 +1916,54 @@ nsDocAccessible::UpdateTreeInternal(nsAc
return updateFlags;
}
void
nsDocAccessible::CacheChildrenInSubtree(nsAccessible* aRoot)
{
aRoot->EnsureChildren();
- PRUint32 count = aRoot->GetChildCount();
- for (PRUint32 idx = 0; idx < count; idx++) {
- nsAccessible* child = aRoot->GetChildAt(idx);
+ // Make sure we create accessible tree defined in DOM only, i.e. if accessible
+ // provides specific tree (like XUL trees) then tree creation is handled by
+ // this accessible.
+ PRUint32 count = aRoot->ContentChildCount();
+ for (PRUint32 idx = 0; idx < count; idx++) {
+ nsAccessible* child = aRoot->ContentChildAt(idx);
NS_ASSERTION(child, "Illicit tree change while tree is created!");
// Don't cross document boundaries.
if (child && child->IsContent())
CacheChildrenInSubtree(child);
}
}
void
nsDocAccessible::UncacheChildrenInSubtree(nsAccessible* aRoot)
{
if (aRoot->IsElement())
RemoveDependentIDsFor(aRoot);
- PRUint32 count = aRoot->GetCachedChildCount();
+ PRUint32 count = aRoot->ContentChildCount();
for (PRUint32 idx = 0; idx < count; idx++)
- UncacheChildrenInSubtree(aRoot->GetCachedChildAt(idx));
+ UncacheChildrenInSubtree(aRoot->ContentChildAt(idx));
if (aRoot->IsPrimaryForNode() &&
mNodeToAccessibleMap.Get(aRoot->GetNode()) == aRoot)
mNodeToAccessibleMap.Remove(aRoot->GetNode());
}
void
nsDocAccessible::ShutdownChildrenInSubtree(nsAccessible* aAccessible)
{
// Traverse through children and shutdown them before this accessible. When
// child gets shutdown then it removes itself from children array of its
//parent. Use jdx index to process the cases if child is not attached to the
// parent and as result doesn't remove itself from its children.
- PRUint32 count = aAccessible->GetCachedChildCount();
+ PRUint32 count = aAccessible->ContentChildCount();
for (PRUint32 idx = 0, jdx = 0; idx < count; idx++) {
- nsAccessible* child = aAccessible->GetCachedChildAt(jdx);
+ nsAccessible* child = aAccessible->ContentChildAt(jdx);
if (!child->IsBoundToParent()) {
NS_ERROR("Parent refers to a child, child doesn't refer to parent!");
jdx++;
}
ShutdownChildrenInSubtree(child);
}
--- a/accessible/src/xul/nsXULTreeAccessible.cpp
+++ b/accessible/src/xul/nsXULTreeAccessible.cpp
@@ -632,19 +632,36 @@ nsXULTreeItemAccessibleBase::
mTree(aTree), mTreeView(aTreeView), mRow(aRow)
{
mParent = aParent;
}
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeItemAccessibleBase: nsISupports implementation
-NS_IMPL_ISUPPORTS_INHERITED1(nsXULTreeItemAccessibleBase,
- nsAccessible,
- nsXULTreeItemAccessibleBase)
+NS_IMPL_CYCLE_COLLECTION_CLASS(nsXULTreeItemAccessibleBase)
+
+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsXULTreeItemAccessibleBase,
+ nsAccessible)
+ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mTree)
+ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mTreeView)
+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
+
+NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsXULTreeItemAccessibleBase,
+ nsAccessible)
+ NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mTree)
+ NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mTreeView)
+NS_IMPL_CYCLE_COLLECTION_UNLINK_END
+
+NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(nsXULTreeItemAccessibleBase)
+ NS_INTERFACE_TABLE_INHERITED1(nsXULTreeItemAccessibleBase,
+ nsXULTreeItemAccessibleBase)
+NS_INTERFACE_TABLE_TAIL_INHERITING(nsAccessible)
+NS_IMPL_ADDREF_INHERITED(nsXULTreeItemAccessibleBase, nsAccessible)
+NS_IMPL_RELEASE_INHERITED(nsXULTreeItemAccessibleBase, nsAccessible)
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeItemAccessibleBase: nsIAccessible implementation
NS_IMETHODIMP
nsXULTreeItemAccessibleBase::GetFocusedChild(nsIAccessible **aFocusedChild)
{
NS_ENSURE_ARG_POINTER(aFocusedChild);
@@ -966,17 +983,17 @@ nsXULTreeItemAccessibleBase::NativeState
state |= states::INVISIBLE;
return state;
}
PRInt32
nsXULTreeItemAccessibleBase::GetIndexInParent() const
{
- return mParent ? mParent->GetCachedChildCount() + mRow : -1;
+ return mParent ? mParent->ContentChildCount() + mRow : -1;
}
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeItemAccessibleBase: nsAccessible protected methods
void
nsXULTreeItemAccessibleBase::DispatchClickEvent(nsIContent *aContent,
PRUint32 aActionIndex)
@@ -1003,25 +1020,18 @@ nsXULTreeItemAccessibleBase::DispatchCli
}
if (column)
nsCoreUtils::DispatchClickEvent(mTree, mRow, column, pseudoElm);
}
nsAccessible*
nsXULTreeItemAccessibleBase::GetSiblingAtOffset(PRInt32 aOffset,
- nsresult* aError)
+ nsresult* aError) const
{
- if (IsDefunct()) {
- if (aError)
- *aError = NS_ERROR_FAILURE;
-
- return nsnull;
- }
-
if (aError)
*aError = NS_OK; // fail peacefully
return mParent->GetChildAt(GetIndexInParent() + aOffset);
}
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeItemAccessibleBase: protected implementation
@@ -1045,51 +1055,78 @@ nsXULTreeItemAccessibleBase::IsExpandabl
return PR_TRUE;
}
}
}
return PR_FALSE;
}
+void
+nsXULTreeItemAccessibleBase::GetCellName(nsITreeColumn* aColumn,
+ nsAString& aName)
+{
+ mTreeView->GetCellText(mRow, aColumn, aName);
+
+ // If there is still no name try the cell value:
+ // This is for graphical cells. We need tree/table view implementors to
+ // implement FooView::GetCellValue to return a meaningful string for cases
+ // where there is something shown in the cell (non-text) such as a star icon;
+ // in which case GetCellValue for that cell would return "starred" or
+ // "flagged" for example.
+ if (aName.IsEmpty())
+ mTreeView->GetCellValue(mRow, aColumn, aName);
+}
+
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeItemAccessible
////////////////////////////////////////////////////////////////////////////////
nsXULTreeItemAccessible::
nsXULTreeItemAccessible(nsIContent *aContent, nsIWeakReference *aShell,
nsAccessible *aParent, nsITreeBoxObject *aTree,
nsITreeView *aTreeView, PRInt32 aRow) :
nsXULTreeItemAccessibleBase(aContent, aShell, aParent, aTree, aTreeView, aRow)
{
mColumn = nsCoreUtils::GetFirstSensibleColumn(mTree);
}
////////////////////////////////////////////////////////////////////////////////
+// nsXULTreeItemAccessible: nsISupports implementation
+
+NS_IMPL_CYCLE_COLLECTION_CLASS(nsXULTreeItemAccessible)
+
+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsXULTreeItemAccessible,
+ nsXULTreeItemAccessibleBase)
+ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mColumn)
+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
+
+NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsXULTreeItemAccessible,
+ nsXULTreeItemAccessibleBase)
+ NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mColumn)
+NS_IMPL_CYCLE_COLLECTION_UNLINK_END
+
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsXULTreeItemAccessible)
+NS_INTERFACE_MAP_END_INHERITING(nsXULTreeItemAccessibleBase)
+NS_IMPL_ADDREF_INHERITED(nsXULTreeItemAccessible, nsXULTreeItemAccessibleBase)
+NS_IMPL_RELEASE_INHERITED(nsXULTreeItemAccessible, nsXULTreeItemAccessibleBase)
+
+////////////////////////////////////////////////////////////////////////////////
// nsXULTreeItemAccessible: nsIAccessible implementation
NS_IMETHODIMP
nsXULTreeItemAccessible::GetName(nsAString& aName)
{
aName.Truncate();
if (IsDefunct())
return NS_ERROR_FAILURE;
- mTreeView->GetCellText(mRow, mColumn, aName);
-
- // If there is still no name try the cell value:
- // This is for graphical cells. We need tree/table view implementors to implement
- // FooView::GetCellValue to return a meaningful string for cases where there is
- // something shown in the cell (non-text) such as a star icon; in which case
- // GetCellValue for that cell would return "starred" or "flagged" for example.
- if (aName.IsEmpty())
- mTreeView->GetCellValue(mRow, mColumn, aName);
-
+ GetCellName(mColumn, aName);
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeItemAccessible: nsAccessNode implementation
bool
nsXULTreeItemAccessible::IsDefunct() const
@@ -1167,40 +1204,33 @@ nsXULTreeItemAccessible::CacheChildren()
nsXULTreeColumnsAccessible::
nsXULTreeColumnsAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
nsXULColumnsAccessible(aContent, aShell)
{
}
nsAccessible*
nsXULTreeColumnsAccessible::GetSiblingAtOffset(PRInt32 aOffset,
- nsresult* aError)
+ nsresult* aError) const
{
if (aOffset < 0)
return nsXULColumnsAccessible::GetSiblingAtOffset(aOffset, aError);
- if (IsDefunct()) {
- if (aError)
- *aError = NS_ERROR_FAILURE;
-
- return nsnull;
- }
-
if (aError)
- *aError = NS_OK; // fail peacefully
+ *aError = NS_OK; // fail peacefully
nsCOMPtr<nsITreeBoxObject> tree = nsCoreUtils::GetTreeBoxObject(mContent);
if (tree) {
nsCOMPtr<nsITreeView> treeView;
tree->GetView(getter_AddRefs(treeView));
if (treeView) {
PRInt32 rowCount = 0;
treeView->GetRowCount(&rowCount);
if (rowCount > 0 && aOffset <= rowCount) {
- nsRefPtr<nsXULTreeAccessible> treeAcc = do_QueryObject(mParent);
+ nsRefPtr<nsXULTreeAccessible> treeAcc = do_QueryObject(GetParent());
if (treeAcc)
return treeAcc->GetTreeItemAccessible(aOffset - 1);
}
}
}
return nsnull;
--- a/accessible/src/xul/nsXULTreeAccessible.h
+++ b/accessible/src/xul/nsXULTreeAccessible.h
@@ -172,18 +172,20 @@ class nsXULTreeItemAccessibleBase : publ
{
public:
using nsAccessible::GetParent;
nsXULTreeItemAccessibleBase(nsIContent *aContent, nsIWeakReference *aShell,
nsAccessible *aParent, nsITreeBoxObject *aTree,
nsITreeView *aTreeView, PRInt32 aRow);
- // nsISupports
+ // nsISupports and cycle collection
NS_DECL_ISUPPORTS_INHERITED
+ NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsXULTreeItemAccessibleBase,
+ nsAccessibleWrap)
// nsIAccessible
NS_IMETHOD GetFocusedChild(nsIAccessible **aFocusedChild);
NS_IMETHOD GetBounds(PRInt32 *aX, PRInt32 *aY,
PRInt32 *aWidth, PRInt32 *aHeight);
NS_IMETHOD SetSelected(PRBool aSelect);
@@ -230,25 +232,30 @@ public:
virtual void RowInvalidated(PRInt32 aStartColIdx, PRInt32 aEndColIdx) = 0;
protected:
enum { eAction_Click = 0, eAction_Expand = 1 };
// nsAccessible
virtual void DispatchClickEvent(nsIContent *aContent, PRUint32 aActionIndex);
virtual nsAccessible* GetSiblingAtOffset(PRInt32 aOffset,
- nsresult *aError = nsnull);
+ nsresult *aError = nsnull) const;
// nsXULTreeItemAccessibleBase
/**
* Return true if the tree item accessible is expandable (contains subrows).
*/
PRBool IsExpandable();
+ /**
+ * Return name for cell at the given column.
+ */
+ void GetCellName(nsITreeColumn* aColumn, nsAString& aName);
+
nsCOMPtr<nsITreeBoxObject> mTree;
nsCOMPtr<nsITreeView> mTreeView;
PRInt32 mRow;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsXULTreeItemAccessibleBase,
NS_XULTREEITEMBASEACCESSIBLE_IMPL_CID)
@@ -258,16 +265,21 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsXULTreeI
*/
class nsXULTreeItemAccessible : public nsXULTreeItemAccessibleBase
{
public:
nsXULTreeItemAccessible(nsIContent *aContent, nsIWeakReference *aShell,
nsAccessible *aParent, nsITreeBoxObject *aTree,
nsITreeView *aTreeView, PRInt32 aRow);
+ // nsISupports and cycle collection
+ NS_DECL_ISUPPORTS_INHERITED
+ NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsXULTreeItemAccessible,
+ nsXULTreeItemAccessibleBase)
+
NS_IMETHOD GetName(nsAString& aName);
// nsAccessNode
virtual bool IsDefunct() const;
virtual PRBool Init();
virtual void Shutdown();
// nsAccessible
@@ -294,12 +306,12 @@ class nsXULTreeColumnsAccessible : publi
{
public:
nsXULTreeColumnsAccessible(nsIContent *aContent, nsIWeakReference *aShell);
protected:
// nsAccessible
virtual nsAccessible* GetSiblingAtOffset(PRInt32 aOffset,
- nsresult *aError = nsnull);
+ nsresult *aError = nsnull) const;
};
#endif
--- a/accessible/src/xul/nsXULTreeGridAccessible.cpp
+++ b/accessible/src/xul/nsXULTreeGridAccessible.cpp
@@ -623,22 +623,22 @@ nsXULTreeGridRowAccessible::
}
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeGridRowAccessible: nsISupports and cycle collection implementation
NS_IMPL_CYCLE_COLLECTION_CLASS(nsXULTreeGridRowAccessible)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsXULTreeGridRowAccessible,
- nsAccessible)
+ nsXULTreeItemAccessibleBase)
CycleCollectorTraverseCache(tmp->mAccessibleCache, &cb);
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsXULTreeGridRowAccessible,
- nsAccessible)
+ nsXULTreeItemAccessibleBase)
ClearCache(tmp->mAccessibleCache);
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsXULTreeGridRowAccessible)
NS_INTERFACE_MAP_STATIC_AMBIGUOUS(nsXULTreeGridRowAccessible)
NS_INTERFACE_MAP_END_INHERITING(nsXULTreeItemAccessibleBase)
NS_IMPL_ADDREF_INHERITED(nsXULTreeGridRowAccessible,
@@ -660,16 +660,35 @@ nsXULTreeGridRowAccessible::Shutdown()
// nsXULTreeGridRowAccessible: nsAccessible implementation
PRUint32
nsXULTreeGridRowAccessible::NativeRole()
{
return nsIAccessibleRole::ROLE_ROW;
}
+NS_IMETHODIMP
+nsXULTreeGridRowAccessible::GetName(nsAString& aName)
+{
+ aName.Truncate();
+
+ if (IsDefunct())
+ return NS_ERROR_FAILURE;
+
+ nsCOMPtr<nsITreeColumns> columns;
+ mTree->GetColumns(getter_AddRefs(columns));
+ if (columns) {
+ nsCOMPtr<nsITreeColumn> primaryColumn;
+ columns->GetPrimaryColumn(getter_AddRefs(primaryColumn));
+ if (primaryColumn)
+ GetCellName(primaryColumn, aName);
+ }
+ return NS_OK;
+}
+
nsAccessible*
nsXULTreeGridRowAccessible::GetChildAtPoint(PRInt32 aX, PRInt32 aY,
EWhichChildAtPoint aWhichChild)
{
nsIFrame *frame = GetFrame();
if (!frame)
return nsnull;
@@ -792,20 +811,39 @@ nsXULTreeGridCellAccessible(nsIContent *
mTreeView(aTreeView), mRow(aRow), mColumn(aColumn)
{
mParent = aRowAcc;
}
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeGridCellAccessible: nsISupports implementation
-NS_IMPL_ISUPPORTS_INHERITED2(nsXULTreeGridCellAccessible,
- nsLeafAccessible,
- nsIAccessibleTableCell,
- nsXULTreeGridCellAccessible)
+NS_IMPL_CYCLE_COLLECTION_CLASS(nsXULTreeGridCellAccessible)
+
+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsXULTreeGridCellAccessible,
+ nsLeafAccessible)
+ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mTree)
+ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mTreeView)
+ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mColumn)
+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
+
+NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsXULTreeGridCellAccessible,
+ nsLeafAccessible)
+ NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mTree)
+ NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mTreeView)
+ NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mColumn)
+NS_IMPL_CYCLE_COLLECTION_UNLINK_END
+
+NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(nsXULTreeGridCellAccessible)
+ NS_INTERFACE_TABLE_INHERITED2(nsXULTreeGridCellAccessible,
+ nsIAccessibleTableCell,
+ nsXULTreeGridCellAccessible)
+NS_INTERFACE_TABLE_TAIL_INHERITING(nsLeafAccessible)
+NS_IMPL_ADDREF_INHERITED(nsXULTreeGridCellAccessible, nsLeafAccessible)
+NS_IMPL_RELEASE_INHERITED(nsXULTreeGridCellAccessible, nsLeafAccessible)
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeGridCellAccessible: nsIAccessible implementation
NS_IMETHODIMP
nsXULTreeGridCellAccessible::GetFocusedChild(nsIAccessible **aFocusedChild)
{
NS_ENSURE_ARG_POINTER(aFocusedChild);
@@ -1239,27 +1277,20 @@ nsXULTreeGridCellAccessible::CellInvalid
}
}
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeGridCellAccessible: nsAccessible protected implementation
nsAccessible*
nsXULTreeGridCellAccessible::GetSiblingAtOffset(PRInt32 aOffset,
- nsresult* aError)
+ nsresult* aError) const
{
- if (IsDefunct()) {
- if (aError)
- *aError = NS_ERROR_FAILURE;
-
- return nsnull;
- }
-
if (aError)
- *aError = NS_OK; // fail peacefully
+ *aError = NS_OK; // fail peacefully
nsCOMPtr<nsITreeColumn> columnAtOffset(mColumn), column;
if (aOffset < 0) {
for (PRInt32 index = aOffset; index < 0 && columnAtOffset; index++) {
column = nsCoreUtils::GetPreviousSensibleColumn(columnAtOffset);
column.swap(columnAtOffset);
}
} else {
@@ -1267,18 +1298,17 @@ nsXULTreeGridCellAccessible::GetSiblingA
column = nsCoreUtils::GetNextSensibleColumn(columnAtOffset);
column.swap(columnAtOffset);
}
}
if (!columnAtOffset)
return nsnull;
- nsRefPtr<nsXULTreeItemAccessibleBase> rowAcc = do_QueryObject(mParent);
-
+ nsRefPtr<nsXULTreeItemAccessibleBase> rowAcc = do_QueryObject(GetParent());
return rowAcc->GetCellAccessible(columnAtOffset);
}
void
nsXULTreeGridCellAccessible::DispatchClickEvent(nsIContent *aContent,
PRUint32 aActionIndex)
{
if (IsDefunct())
--- a/accessible/src/xul/nsXULTreeGridAccessible.h
+++ b/accessible/src/xul/nsXULTreeGridAccessible.h
@@ -81,23 +81,24 @@ public:
nsXULTreeGridRowAccessible(nsIContent *aContent, nsIWeakReference *aShell,
nsAccessible *aParent, nsITreeBoxObject *aTree,
nsITreeView *aTreeView, PRInt32 aRow);
// nsISupports and cycle collection
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsXULTreeGridRowAccessible,
- nsAccessible)
+ nsXULTreeItemAccessibleBase)
// nsAccessNode
virtual void Shutdown();
// nsAccessible
virtual PRUint32 NativeRole();
+ NS_IMETHOD GetName(nsAString& aName);
virtual nsAccessible* GetChildAtPoint(PRInt32 aX, PRInt32 aY,
EWhichChildAtPoint aWhichChild);
virtual nsAccessible* GetChildAt(PRUint32 aIndex);
virtual PRInt32 GetChildCount();
// nsXULTreeItemAccessibleBase
virtual nsAccessible* GetCellAccessible(nsITreeColumn *aColumn);
@@ -134,16 +135,18 @@ public:
nsXULTreeGridCellAccessible(nsIContent *aContent, nsIWeakReference *aShell,
nsXULTreeGridRowAccessible *aRowAcc,
nsITreeBoxObject *aTree, nsITreeView *aTreeView,
PRInt32 aRow, nsITreeColumn* aColumn);
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
+ NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsXULTreeGridCellAccessible,
+ nsLeafAccessible)
// nsIAccessible
NS_IMETHOD GetFocusedChild(nsIAccessible **aFocusedChild);
NS_IMETHOD GetName(nsAString& aName);
NS_IMETHOD GetBounds(PRInt32 *aX, PRInt32 *aY,
PRInt32 *aWidth, PRInt32 *aHeight);
@@ -177,17 +180,17 @@ public:
* Fire name or state change event if the accessible text or value has been
* changed.
*/
void CellInvalidated();
protected:
// nsAccessible
virtual nsAccessible* GetSiblingAtOffset(PRInt32 aOffset,
- nsresult *aError = nsnull);
+ nsresult *aError = nsnull) const;
virtual void DispatchClickEvent(nsIContent *aContent, PRUint32 aActionIndex);
// nsXULTreeGridCellAccessible
/**
* Return true if value of cell can be modified.
*/
PRBool IsEditable() const;
--- a/accessible/tests/mochitest/attributes/test_obj.html
+++ b/accessible/tests/mochitest/attributes/test_obj.html
@@ -48,38 +48,41 @@ https://bugzilla.mozilla.org/show_bug.cg
// ARIA
testAttrs("live", {"live" : "polite"}, true);
testAttrs("live2", {"live" : "polite"}, true);
testAbsentAttrs("live3", {"live" : ""});
testAttrs("log", {"live" : "polite"}, true);
testAttrs("logAssertive", {"live" : "assertive"}, true);
testAttrs("marquee", {"live" : "off"}, true);
testAttrs("status", {"live" : "polite"}, true);
+ testAttrs("tablist", {"live" : "polite"}, true);
testAttrs("timer", {"live" : "off"}, true);
// container-live object attribute
testAttrs("liveChild", {"container-live" : "polite"}, true);
testAttrs("live2Child", {"container-live" : "polite"}, true);
testAttrs("logChild", {"container-live" : "polite"}, true);
testAttrs("logAssertiveChild", {"container-live" : "assertive"}, true);
testAttrs("marqueeChild", {"container-live" : "off"}, true);
testAttrs("statusChild", {"container-live" : "polite"}, true);
+ testAttrs("tablistChild", {"container-live" : "polite"}, true);
testAttrs("timerChild", {"container-live" : "off"}, true);
// container-live-role object attribute
testAttrs("log", {"container-live-role" : "log"}, true);
testAttrs("logAssertive", {"container-live-role" : "log"}, true);
testAttrs("marquee", {"container-live-role" : "marquee"}, true);
testAttrs("status", {"container-live-role" : "status"}, true);
testAttrs("timer", {"container-live-role" : "timer"}, true);
testAttrs("logChild", {"container-live-role" : "log"}, true);
testAttrs("logAssertive", {"container-live-role" : "log"}, true);
testAttrs("logAssertiveChild", {"container-live-role" : "log"}, true);
testAttrs("marqueeChild", {"container-live-role" : "marquee"}, true);
testAttrs("statusChild", {"container-live-role" : "status"}, true);
+ testAttrs("tablistChild", {"container-live-role" : "tablist"}, true);
testAttrs("timerChild", {"container-live-role" : "timer"}, true);
// absent aria-label and aria-labelledby object attribute
testAbsentAttrs("label", {"label" : "foo"});
testAbsentAttrs("labelledby", {"labelledby" : "label"});
// container that has no default live attribute
testAttrs("liveGroup", {"live" : "polite"}, true);
@@ -115,17 +118,21 @@ https://bugzilla.mozilla.org/show_bug.cg
title="Make explicit that aria-label is not an object attribute">
Mozilla Bug 475006
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=558036"
title="make HTML <output> accessible">
Mozilla Bug 558036
</a>
-
+ <a target="_blank"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=663136"
+ title="Add test coverage for tablist as implicit live region">
+ Mozilla Bug 663136
+ </a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<!-- aria -->
<div id="atomic" aria-atomic="true"></div>
<div id="autocomplete" role="textbox" aria-autocomplete="true"></div>
@@ -149,16 +156,17 @@ https://bugzilla.mozilla.org/show_bug.cg
<!-- back to aria -->
<div id="live" aria-live="polite">excuse <div id="liveChild">me</div></div>
<div id="live2" role="marquee" aria-live="polite">excuse <div id="live2Child">me</div></div>
<div id="live3" role="region">excuse</div>
<div id="log" role="log">excuse <div id="logChild">me</div></div>
<div id="logAssertive" role="log" aria-live="assertive">excuse <div id="logAssertiveChild">me</div></div>
<div id="marquee" role="marquee">excuse <div id="marqueeChild">me</div></div>
<div id="status" role="status">excuse <div id="statusChild">me</div></div>
+ <div id="tablist" role="tablist">tablist <div id="tablistChild">tab</div></div>
<div id="timer" role="timer">excuse <div id="timerChild">me</div></div>
<!-- aria-label[ledby] should not be an object attribute -->
<div id="label" role="checkbox" aria-label="foo"></div>
<div id="labelledby" role="checkbox" aria-labelledby="label"></div>
<!-- unusual live case -->
<div id="liveGroup" role="group" aria-live="polite">
--- a/accessible/tests/mochitest/name/Makefile.in
+++ b/accessible/tests/mochitest/name/Makefile.in
@@ -52,13 +52,14 @@ include $(topsrcdir)/config/rules.mk
nsRootAcc_wnd.xul \
test_button.html \
test_general.html \
test_general.xul \
test_link.html \
test_list.html \
test_markup.html \
test_nsRootAcc.xul \
+ test_tree.xul \
markuprules.xml \
$(NULL)
libs:: $(_TEST_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/a11y/$(relativesrcdir)
new file mode 100644
--- /dev/null
+++ b/accessible/tests/mochitest/name/test_tree.xul
@@ -0,0 +1,200 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
+ type="text/css"?>
+<?xml-stylesheet href="general.css"
+ type="text/css"?>
+
+
+<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ title="Accessibility Name Calculating Test.">
+
+ <script type="application/javascript"
+ src="chrome://mochikit/content/MochiKit/packed.js"></script>
+ <script type="application/javascript"
+ src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
+
+ <script type="application/javascript"
+ src="../treeview.js" />
+
+ <script type="application/javascript"
+ src="../common.js"></script>
+ <script type="application/javascript"
+ src="../role.js"></script>
+ <script type="application/javascript"
+ src="../name.js"></script>
+ <script type="application/javascript"
+ src="../events.js"></script>
+
+ <script type="application/javascript">
+ <![CDATA[
+ function treeTester(aID)
+ {
+ this.DOMNode = getNode(aID);
+
+ this.invoke = function treeTester_invoke()
+ {
+ this.DOMNode.treeBoxObject.view = new nsTreeTreeView();
+ }
+
+ this.check = function treeTester_check(aEvent)
+ {
+ var tree = {
+ role: ROLE_OUTLINE,
+ children: [
+ {
+ role: ROLE_LIST
+ },
+ {
+ role: ROLE_OUTLINEITEM,
+ children: [],
+ name: "row1col"
+ },
+ {
+ role: ROLE_OUTLINEITEM,
+ children: [],
+ name: "row2_col"
+ },
+ {
+ role: ROLE_OUTLINEITEM,
+ children: [],
+ name: "row2.1_col"
+ },
+ {
+ role: ROLE_OUTLINEITEM,
+ children: [],
+ name: "row2.2_col"
+ },
+ {
+ role: ROLE_OUTLINEITEM,
+ children: [],
+ name: "row3_col"
+ },
+ {
+ role: ROLE_OUTLINEITEM,
+ children: [],
+ name: "row4col"
+ }
+ ]
+ };
+ testAccessibleTree(this.DOMNode, tree);
+ }
+
+ this.getID = function treeTester_getID()
+ {
+ return "Tree name testing for " + aID;
+ }
+ }
+
+ function tableTester(aID)
+ {
+ this.DOMNode = getNode(aID);
+
+ this.invoke = function tableTester_invoke()
+ {
+ this.DOMNode.treeBoxObject.view = new nsTableTreeView(2);
+ }
+
+ this.check = function tableTester_check(aEvent)
+ {
+ var tree = {
+ role: ROLE_TREE_TABLE,
+ children: [
+ {
+ role: ROLE_LIST
+ },
+ {
+ role: ROLE_ROW,
+ children: [
+ {
+ role: ROLE_GRID_CELL,
+ children: [],
+ name: "row0_col1"
+ },
+ {
+ role: ROLE_GRID_CELL,
+ children: [],
+ name: "row0_col2"
+ }
+ ],
+ name: "row0_col1"
+ },
+ {
+ role: ROLE_ROW,
+ children: [
+ {
+ role: ROLE_GRID_CELL,
+ children: [],
+ name: "row1_col1"
+ },
+ {
+ role: ROLE_GRID_CELL,
+ children: [],
+ name: "row1_col2"
+ }
+ ],
+ name: "row1_col1"
+ }
+ ]
+ };
+ testAccessibleTree(this.DOMNode, tree);
+ }
+
+ this.getID = function tableTester_getID()
+ {
+ return "Tree name testing for " + aID;
+ }
+ }
+
+ var gQueue = null;
+ function doTest()
+ {
+ var gQueue = new eventQueue(EVENT_REORDER);
+
+ gQueue.push(new treeTester("tree"));
+ gQueue.push(new tableTester("table"));
+
+ gQueue.invoke(); // Will call SimpleTest.finish()
+ }
+
+ SimpleTest.waitForExplicitFinish();
+ addA11yLoadEvent(doTest);
+ ]]>
+ </script>
+
+ <hbox flex="1" style="overflow: auto;">
+
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <a target="_blank"
+ href="https://bugzilla.mozilla.org/show_bug.cgi?id=546812"
+ title="Treegrid row accessible shouldn't inherit name from tree accessible">
+ Mozilla Bug 546812
+ </a>
+ <p id="display"></p>
+ <div id="content" style="display: none">
+ </div>
+ <pre id="test">
+ </pre>
+ </body>
+
+ <vbox flex="1">
+
+ <tree id="tree" flex="1">
+ <treecols>
+ <treecol id="col" flex="1" primary="true" label="column"/>
+ </treecols>
+ <treechildren/>
+ </tree>
+
+ <tree id="table" flex="1">
+ <treecols>
+ <treecol id="col1" flex="1" label="column" primary="true"/>
+ <treecol id="col2" flex="1" label="column 2"/>
+ </treecols>
+ <treechildren/>
+ </tree>
+
+ </vbox> <!-- close tests area -->
+ </hbox> <!-- close main area -->
+</window>
+
--- a/browser/app/blocklist.xml
+++ b/browser/app/blocklist.xml
@@ -1,193 +1,201 @@
<?xml version="1.0"?>
-<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist">
+<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1306529826000">
<emItems>
- <emItem id="fdm_ffext@freedownloadmanager.org">
- <versionRange minVersion="1.0" maxVersion="1.3.1">
- <targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
- <versionRange minVersion="3.0a1" maxVersion="*"/>
- </targetApplication>
- </versionRange>
- </emItem>
- <emItem id="firefox@bandoo.com">
- <versionRange minVersion="5.0" maxVersion="5.0" severity="1">
- <targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
- <versionRange minVersion="3.7a1pre" maxVersion="*"/>
- </targetApplication>
- </versionRange>
- </emItem>
- <emItem id="langpack-vi-VN@firefox.mozilla.org">
- <versionRange minVersion="2.0" maxVersion="2.0"/>
- </emItem>
- <emItem id="masterfiler@gmail.com">
- <versionRange severity="3"/>
- </emItem>
- <emItem id="mozilla_cc@internetdownloadmanager.com">
- <versionRange minVersion=" " maxVersion="6.9.8">
- <targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
- <versionRange minVersion="3.7a1pre" maxVersion="*"/>
- </targetApplication>
- </versionRange>
- <versionRange minVersion="2.1" maxVersion="3.3">
- <targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
- <versionRange minVersion="3.0a1" maxVersion="*"/>
- </targetApplication>
- </versionRange>
- </emItem>
- <emItem id="msntoolbar@msn.com">
- <versionRange minVersion=" " maxVersion="6.*"/>
- </emItem>
- <emItem id="personas@christopher.beard">
- <versionRange minVersion="1.6" maxVersion="1.6">
- <targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
- <versionRange minVersion="3.6" maxVersion="3.6.*"/>
- </targetApplication>
- </versionRange>
- </emItem>
- <emItem id="ShopperReports@ShopperReports.com">
- <versionRange minVersion="3.1.22.0" maxVersion="3.1.22.0"/>
- </emItem>
- <emItem id="support@daemon-tools.cc">
- <versionRange minVersion=" " maxVersion="1.0.0.5"/>
- </emItem>
- <emItem id="support@update-firefox.com"/>
- <emItem id="yslow@yahoo-inc.com">
- <versionRange minVersion="2.0.5" maxVersion="2.0.5">
- <targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
- <versionRange minVersion="3.5.7" maxVersion="*"/>
- </targetApplication>
- </versionRange>
- </emItem>
- <emItem id="{2224e955-00e9-4613-a844-ce69fccaae91}"/>
- <emItem id="{27182e60-b5f3-411c-b545-b44205977502}">
- <versionRange minVersion="1.0" maxVersion="1.0"/>
- </emItem>
- <emItem id="{3252b9ae-c69a-4eaf-9502-dc9c1f6c009e}">
- <versionRange minVersion="2.2" maxVersion="2.2"/>
- </emItem>
- <emItem id="{3f963a5b-e555-4543-90e2-c3908898db71}">
- <versionRange minVersion=" " maxVersion="8.5"/>
- </emItem>
- <emItem id="{46551EC9-40F0-4e47-8E18-8E5CF550CFB8}">
- <versionRange minVersion="1.1b1" maxVersion="1.1b1"/>
- </emItem>
- <emItem id="{4B3803EA-5230-4DC3-A7FC-33638F3D3542}">
- <versionRange minVersion="1.2" maxVersion="1.2">
- <targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
- <versionRange minVersion="3.0a1" maxVersion="*"/>
- </targetApplication>
- </versionRange>
- </emItem>
- <emItem id="{6E19037A-12E3-4295-8915-ED48BC341614}">
- <versionRange minVersion="0.1" maxVersion="1.3.328.4" severity="1">
- <targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
- <versionRange minVersion="3.7a1pre" maxVersion="*"/>
- </targetApplication>
- </versionRange>
- </emItem>
- <emItem id="{8CE11043-9A15-4207-A565-0C94C42D590D}"/>
- <emItem id="{AB2CE124-6272-4b12-94A9-7303C7397BD1}">
- <versionRange minVersion="0.1" maxVersion="5.2.0.7164" severity="1"/>
- </emItem>
- <emItem id="{B13721C7-F507-4982-B2E5-502A71474FED}">
- <versionRange severity="1"/>
- </emItem>
- <emItem id="{B7082FAA-CB62-4872-9106-E42DD88EDE45}">
- <versionRange minVersion="0.1" maxVersion="3.3.0.*">
- <targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
- <versionRange minVersion="3.7a1" maxVersion="*"/>
- </targetApplication>
- </versionRange>
- <versionRange minVersion="3.3.1" maxVersion="*">
- <targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
- <versionRange minVersion="5.0a1" maxVersion="*"/>
- </targetApplication>
- </versionRange>
- </emItem>
- <emItem id="{E8E88AB0-7182-11DF-904E-6045E0D72085}"/>
- </emItems>
-<pluginItems>
- <pluginItem>
- <match name="name" exp="^Yahoo Application State Plugin$"/>
- <match name="description" exp="^Yahoo Application State Plugin$"/>
- <match name="filename" exp="npYState.dll"/>
- <versionRange>
- <targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
- <versionRange minVersion="3.0a1" maxVersion="3.*"/>
- </targetApplication>
- </versionRange>
- </pluginItem>
- <pluginItem>
- <match name="name" exp="QuickTime Plug-in 7[.]1[.]"/>
- <match name="filename" exp="npqtplugin.?[.]dll"/>
- <versionRange>
- <targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
- <versionRange minVersion="3.0a1" maxVersion="3.*"/>
- </targetApplication>
- </versionRange>
- </pluginItem>
- <pluginItem>
- <match name="filename" exp="NPFFAddOn.dll"/>
- <versionRange>
- </versionRange>
- </pluginItem>
- <pluginItem>
- <match name="filename" exp="NPMySrch.dll"/>
- <versionRange>
- </versionRange>
- </pluginItem>
- <pluginItem>
- <match name="filename" exp="npViewpoint.dll"/>
- <versionRange>
- <targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
- <versionRange minVersion="3.0" maxVersion="*"/>
- </targetApplication>
- </versionRange>
- </pluginItem>
- <pluginItem>
- <match name="name" exp="[0-6]\.0\.[01]\d{2}\.\d+"/>
- <match name="filename" exp="npdeploytk.dll"/>
- <versionRange severity="1">
- </versionRange>
- </pluginItem>
- <pluginItem>
- <match name="filename" exp="[Nn][Pp][Jj][Pp][Ii]1[56]0_[0-9]+\.[Dd][Ll][Ll]"/>
- <versionRange>
- <targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
- <versionRange minVersion="3.6a1pre" maxVersion="*"/>
- </targetApplication>
- </versionRange>
- </pluginItem>
-</pluginItems>
-<gfxItems>
- <gfxBlacklistEntry>
- <os>WINNT 6.1</os>
- <vendor>0x10de</vendor>
- <devices>
- <device>0x0a6c</device>
- </devices>
- <feature>DIRECT2D</feature>
- <featureStatus>BLOCKED_DRIVER_VERSION</featureStatus>
- <driverVersion>8.17.12.5896</driverVersion>
- <driverVersionComparator>LESS_THAN_OR_EQUAL</driverVersionComparator>
- </gfxBlacklistEntry>
- <gfxBlacklistEntry>
- <os>WINNT 6.1</os>
- <vendor>0x10de</vendor>
- <devices>
- <device>0x0a6c</device>
- </devices>
- <feature>DIRECT3D_9_LAYERS</feature>
- <featureStatus>BLOCKED_DRIVER_VERSION</featureStatus>
- <driverVersion>8.17.12.5896</driverVersion>
- <driverVersionComparator>LESS_THAN_OR_EQUAL</driverVersionComparator>
- </gfxBlacklistEntry>
- <gfxBlacklistEntry>
- <os>WINNT 5.1</os>
- <vendor>0x10de</vendor>
- <feature>DIRECT3D_9_LAYERS</feature>
- <featureStatus>BLOCKED_DRIVER_VERSION</featureStatus>
- <driverVersion>7.0.0.0</driverVersion>
- <driverVersionComparator>GREATER_THAN_OR_EQUAL</driverVersionComparator>
- </gfxBlacklistEntry>
-</gfxItems>
-</blocklist>
+ <emItem blockID="i8" id="{B13721C7-F507-4982-B2E5-502A71474FED}">
+ <versionRange minVersion=" " severity="1">
+ </versionRange>
+ </emItem>
+ <emItem blockID="i38" id="{B7082FAA-CB62-4872-9106-E42DD88EDE45}">
+ <versionRange minVersion="0.1" maxVersion="3.3.0.*" severity="0">
+ <targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
+ <versionRange minVersion="3.7a1" maxVersion="*" />
+ </targetApplication>
+ </versionRange>
+ <versionRange minVersion="3.3.1" maxVersion="*" severity="0">
+ <targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
+ <versionRange minVersion="5.0a1" maxVersion="*" />
+ </targetApplication>
+ </versionRange>
+ </emItem>
+ <emItem blockID="i19" id="{46551EC9-40F0-4e47-8E18-8E5CF550CFB8}">
+ <versionRange minVersion="1.1b1" maxVersion="1.1b1" severity="0">
+ </versionRange>
+ </emItem>
+ <emItem blockID="i16" id="{27182e60-b5f3-411c-b545-b44205977502}">
+ <versionRange minVersion="1.0" maxVersion="1.0" severity="0">
+ </versionRange>
+ </emItem>
+ <emItem blockID="i10" id="{8CE11043-9A15-4207-A565-0C94C42D590D}">
+ </emItem>
+ <emItem blockID="i1" id="mozilla_cc@internetdownloadmanager.com">
+ <versionRange minVersion="2.1" maxVersion="3.3" severity="0">
+ <targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
+ <versionRange minVersion="3.0a1" maxVersion="*" />
+ </targetApplication>
+ </versionRange>
+ <versionRange minVersion=" " maxVersion="6.9.8" severity="0">
+ <targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
+ <versionRange minVersion="3.7a1pre" maxVersion="*" />
+ </targetApplication>
+ </versionRange>
+ </emItem>
+ <emItem blockID="i18" id="msntoolbar@msn.com">
+ <versionRange minVersion=" " maxVersion="6.*" severity="0">
+ </versionRange>
+ </emItem>
+ <emItem blockID="i13" id="{E8E88AB0-7182-11DF-904E-6045E0D72085}">
+ </emItem>
+ <emItem blockID="i4" id="{4B3803EA-5230-4DC3-A7FC-33638F3D3542}">
+ <versionRange minVersion="1.2" maxVersion="1.2" severity="0">
+ <targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
+ <versionRange minVersion="3.0a1" maxVersion="*" />
+ </targetApplication>
+ </versionRange>
+ </emItem>
+ <emItem blockID="i23" id="firefox@bandoo.com">
+ <versionRange minVersion="5.0" maxVersion="5.0" severity="1">
+ <targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
+ <versionRange minVersion="3.7a1pre" maxVersion="*" />
+ </targetApplication>
+ </versionRange>
+ </emItem>
+ <emItem blockID="i22" id="ShopperReports@ShopperReports.com">
+ <versionRange minVersion="3.1.22.0" maxVersion="3.1.22.0" severity="0">
+ </versionRange>
+ </emItem>
+ <emItem blockID="i2" id="fdm_ffext@freedownloadmanager.org">
+ <versionRange minVersion="1.0" maxVersion="1.3.1" severity="0">
+ <targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
+ <versionRange minVersion="3.0a1" maxVersion="*" />
+ </targetApplication>
+ </versionRange>
+ </emItem>
+ <emItem blockID="i5" id="support@daemon-tools.cc">
+ <versionRange minVersion=" " maxVersion="1.0.0.5" severity="0">
+ </versionRange>
+ </emItem>
+ <emItem blockID="i6" id="{3f963a5b-e555-4543-90e2-c3908898db71}">
+ <versionRange minVersion=" " maxVersion="8.5" severity="0">
+ </versionRange>
+ </emItem>
+ <emItem blockID="i12" id="masterfiler@gmail.com">
+ <versionRange severity="3">
+ </versionRange>
+ </emItem>
+ <emItem blockID="i20" id="{AB2CE124-6272-4b12-94A9-7303C7397BD1}">
+ <versionRange minVersion="0.1" maxVersion="5.2.0.7164" severity="1">
+ </versionRange>
+ </emItem>
+ <emItem blockID="i11" id="yslow@yahoo-inc.com">
+ <versionRange minVersion="2.0.5" maxVersion="2.0.5" severity="0">
+ <targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
+ <versionRange minVersion="3.5.7" maxVersion="*" />
+ </targetApplication>
+ </versionRange>
+ </emItem>
+ <emItem blockID="i17" id="{3252b9ae-c69a-4eaf-9502-dc9c1f6c009e}">
+ <versionRange minVersion="2.2" maxVersion="2.2" severity="0">
+ </versionRange>
+ </emItem>
+ <emItem blockID="i3" id="langpack-vi-VN@firefox.mozilla.org">
+ <versionRange minVersion="2.0" maxVersion="2.0" severity="0">
+ </versionRange>
+ </emItem>
+ <emItem blockID="i7" id="{2224e955-00e9-4613-a844-ce69fccaae91}">
+ </emItem>
+ <emItem blockID="i24" id="{6E19037A-12E3-4295-8915-ED48BC341614}">
+ <versionRange minVersion="0.1" maxVersion="1.3.328.4" severity="1">
+ <targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
+ <versionRange minVersion="3.7a1pre" maxVersion="*" />
+ </targetApplication>
+ </versionRange>
+ </emItem>
+ <emItem blockID="i15" id="personas@christopher.beard">
+ <versionRange minVersion="1.6" maxVersion="1.6" severity="0">
+ <targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
+ <versionRange minVersion="3.6" maxVersion="3.6.*" />
+ </targetApplication>
+ </versionRange>
+ </emItem>
+ <emItem blockID="i21" id="support@update-firefox.com">
+ </emItem>
+ </emItems>
+
+ <pluginItems>
+ <pluginItem blockID="p26">
+ <match name="name" exp="^Yahoo Application State Plugin$" /> <match name="description" exp="^Yahoo Application State Plugin$" /> <match name="filename" exp="npYState.dll" /> <versionRange severity="0">
+ <targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
+ <versionRange minVersion="3.0a1" maxVersion="3.*" />
+ </targetApplication>
+ </versionRange>
+ </pluginItem>
+ <pluginItem blockID="p27">
+ <match name="name" exp="QuickTime Plug-in 7[.]1[.]" /> <match name="filename" exp="npqtplugin.?[.]dll" /> <versionRange severity="0">
+ <targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
+ <versionRange minVersion="3.0a1" maxVersion="3.*" />
+ </targetApplication>
+ </versionRange>
+ </pluginItem>
+ <pluginItem blockID="p28">
+ <match name="filename" exp="NPFFAddOn.dll" /> <versionRange severity="0">
+ </versionRange>
+ </pluginItem>
+ <pluginItem blockID="p31">
+ <match name="filename" exp="NPMySrch.dll" /> <versionRange severity="0">
+ </versionRange>
+ </pluginItem>
+ <pluginItem blockID="p32">
+ <match name="filename" exp="npViewpoint.dll" /> <versionRange severity="0">
+ <targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
+ <versionRange minVersion="3.0" maxVersion="*" />
+ </targetApplication>
+ </versionRange>
+ </pluginItem>
+ <pluginItem blockID="p33">
+ <match name="name" exp="[0-6]\.0\.[01]\d{2}\.\d+" /> <match name="filename" exp="npdeploytk.dll" /> <versionRange severity="1">
+ </versionRange>
+ </pluginItem>
+ <pluginItem blockID="p34">
+ <match name="filename" exp="[Nn][Pp][Jj][Pp][Ii]1[56]0_[0-9]+\.[Dd][Ll][Ll]" /> <versionRange severity="0">
+ <targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
+ <versionRange minVersion="3.6a1pre" maxVersion="*" />
+ </targetApplication>
+ </versionRange>
+ </pluginItem>
+ </pluginItems>
+
+ <gfxItems>
+ <gfxBlacklistEntry blockID="g35">
+ <os>WINNT 6.1</os>
+ <vendor>0x10de</vendor>
+ <devices>
+ <device>0x0a6c</device>
+ </devices>
+ <feature>DIRECT2D</feature>
+ <featureStatus>BLOCKED_DRIVER_VERSION</featureStatus>
+ <driverVersion>8.17.12.5896</driverVersion>
+ <driverVersionComparator>LESS_THAN_OR_EQUAL</driverVersionComparator>
+ </gfxBlacklistEntry>
+ <gfxBlacklistEntry blockID="g36">
+ <os>WINNT 6.1</os>
+ <vendor>0x10de</vendor>
+ <devices>
+ <device>0x0a6c</device>
+ </devices>
+ <feature>DIRECT3D_9_LAYERS</feature>
+ <featureStatus>BLOCKED_DRIVER_VERSION</featureStatus>
+ <driverVersion>8.17.12.5896</driverVersion>
+ <driverVersionComparator>LESS_THAN_OR_EQUAL</driverVersionComparator>
+ </gfxBlacklistEntry>
+ <gfxBlacklistEntry blockID="g37">
+ <os>WINNT 5.1</os>
+ <vendor>0x10de</vendor>
+ <feature>DIRECT3D_9_LAYERS</feature>
+ <featureStatus>BLOCKED_DRIVER_VERSION</featureStatus>
+ <driverVersion>7.0.0.0</driverVersion>
+ <driverVersionComparator>GREATER_THAN_OR_EQUAL</driverVersionComparator>
+ </gfxBlacklistEntry>
+ </gfxItems>
+
+
+</blocklist>
\ No newline at end of file
--- a/browser/base/Makefile.in
+++ b/browser/base/Makefile.in
@@ -52,17 +52,16 @@ CHROME_DEPS += $(abs_srcdir)/content/ove
ifdef ENABLE_TESTS
DIRS += content/test
endif
EXTRA_JS_MODULES = \
content/openLocationLastURL.jsm \
content/NetworkPrioritizer.jsm \
content/domplate.jsm \
- content/stylePanel.jsm \
$(NULL)
include $(topsrcdir)/config/rules.mk
PRE_RELEASE_SUFFIX := ""
DEFINES += \
-DMOZ_APP_VERSION=$(MOZ_APP_VERSION) \
--- a/browser/base/content/browser-sets.inc
+++ b/browser/base/content/browser-sets.inc
@@ -186,17 +186,17 @@
accesskey="&dontShowMessage.accesskey;"
type="checkbox"
oncommand="gPopupBlockerObserver.dontShowMessage();"/>
<broadcaster id="blockedPopupsSeparator"/>
<broadcaster id="isImage"/>
<broadcaster id="isFrameImage"/>
<broadcaster id="singleFeedMenuitemState" disabled="true"/>
<broadcaster id="multipleFeedsMenuState" hidden="true"/>
- <broadcaster id="tabviewGroupsNumber" groups="0"/>
+ <broadcaster id="tabviewGroupsNumber" groups="1"/>
#ifdef MOZ_SERVICES_SYNC
<broadcaster id="sync-setup-state"/>
<broadcaster id="sync-syncnow-state"/>
#endif
<broadcaster id="workOfflineMenuitemState"/>
</broadcasterset>
<keyset id="mainKeyset">
--- a/browser/base/content/browser-tabview.js
+++ b/browser/base/content/browser-tabview.js
@@ -35,25 +35,28 @@
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
let TabView = {
_deck: null,
_iframe: null,
_window: null,
+ _initialized: false,
_browserKeyHandlerInitialized: false,
_isFrameLoading: false,
_initFrameCallbacks: [],
+ _lastSessionGroupName: null,
PREF_BRANCH: "browser.panorama.",
PREF_FIRST_RUN: "browser.panorama.experienced_first_run",
PREF_STARTUP_PAGE: "browser.startup.page",
PREF_RESTORE_ENABLED_ONCE: "browser.panorama.session_restore_enabled_once",
+ GROUPS_IDENTIFIER: "tabview-groups",
VISIBILITY_IDENTIFIER: "tabview-visibility",
- GROUPS_IDENTIFIER: "tabview-groups",
+ LAST_SESSION_GROUP_NAME_IDENTIFIER: "tabview-last-session-group-name",
// ----------
get windowTitle() {
delete this.windowTitle;
let brandBundle = document.getElementById("bundle_brand");
let brandShortName = brandBundle.getString("brandShortName");
let title = gNavigatorBundle.getFormattedString("tabView2.title", [brandShortName]);
return this.windowTitle = title;
@@ -84,71 +87,85 @@ let TabView = {
// ----------
set sessionRestoreEnabledOnce(val) {
Services.prefs.setBoolPref(this.PREF_RESTORE_ENABLED_ONCE, val);
},
// ----------
init: function TabView_init() {
+ if (this._initialized)
+ return;
+
if (this.firstUseExperienced) {
if ((gBrowser.tabs.length - gBrowser.visibleTabs.length) > 0)
this._setBrowserKeyHandlers();
// ___ visibility
let sessionstore =
Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
let data = sessionstore.getWindowValue(window, this.VISIBILITY_IDENTIFIER);
if (data && data == "true") {
this.show();
} else {
try {
data = sessionstore.getWindowValue(window, this.GROUPS_IDENTIFIER);
if (data) {
let parsedData = JSON.parse(data);
- this.updateGroupNumberBroadcaster(parsedData.totalNumber || 0);
+ this.updateGroupNumberBroadcaster(parsedData.totalNumber || 1);
}
} catch (e) { }
let self = this;
// if a tab is changed from hidden to unhidden and the iframe is not
// initialized, load the iframe and setup the tab.
this._tabShowEventListener = function (event) {
if (!self._window)
self._initFrame(function() {
self._window.UI.onTabSelect(gBrowser.selectedTab);
});
};
gBrowser.tabContainer.addEventListener(
"TabShow", this._tabShowEventListener, true);
+
+ // grab the last used group title
+ this._lastSessionGroupName = sessionstore.getWindowValue(window,
+ this.LAST_SESSION_GROUP_NAME_IDENTIFIER);
}
}
Services.prefs.addObserver(this.PREF_BRANCH, this, false);
+
+ this._initialized = true;
},
// ----------
// Observes topic changes.
observe: function TabView_observe(subject, topic, data) {
if (data == this.PREF_FIRST_RUN && this.firstUseExperienced) {
this._addToolbarButton();
this.enableSessionRestore();
}
},
// ----------
// Uninitializes TabView.
uninit: function TabView_uninit() {
+ if (!this._initialized)
+ return;
+
Services.prefs.removeObserver(this.PREF_BRANCH, this);
if (this._tabShowEventListener) {
gBrowser.tabContainer.removeEventListener(
"TabShow", this._tabShowEventListener, true);
}
+
+ this._initialized = false;
},
// ----------
// Creates the frame and calls the callback once it's loaded.
// If the frame already exists, calls the callback immediately.
_initFrame: function TabView__initFrame(callback) {
let hasCallback = typeof callback == "function";
@@ -231,28 +248,38 @@ let TabView = {
toggle: function() {
if (this.isVisible())
this.hide();
else
this.show();
},
getActiveGroupName: function TabView_getActiveGroupName() {
+ if (!this._window)
+ return this._lastSessionGroupName;
+
// We get the active group this way, instead of querying
// GroupItems.getActiveGroupItem() because the tabSelect event
// will not have happened by the time the browser tries to
// update the title.
+ let groupItem = null;
let activeTab = window.gBrowser.selectedTab;
- if (activeTab._tabViewTabItem && activeTab._tabViewTabItem.parent){
- let groupName = activeTab._tabViewTabItem.parent.getTitle();
- if (groupName)
- return groupName;
+ let activeTabItem = activeTab._tabViewTabItem;
+
+ if (activeTab.pinned) {
+ // It's an app tab, so it won't have a .tabItem. However, its .parent
+ // will already be set as the active group.
+ groupItem = this._window.GroupItems.getActiveGroupItem();
+ } else if (activeTabItem) {
+ groupItem = activeTabItem.parent;
}
- return null;
- },
+
+ // groupItem may still be null, if the active tab is an orphan.
+ return groupItem ? groupItem.getTitle() : "";
+ },
// ----------
updateContextMenu: function(tab, popup) {
let separator = document.getElementById("context_tabViewNamedGroups");
let isEmpty = true;
while (popup.firstChild && popup.firstChild != separator)
popup.removeChild(popup.firstChild);
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -4361,16 +4361,20 @@ var XULBrowserWindow = {
this.throbberElement.removeAttribute("busy");
this.stopCommand.setAttribute("disabled", "true");
CombinedStopReload.switchToReload(aRequest instanceof Ci.nsIRequest);
}
}
},
+ onLocationChange2: function (aWebProgress, aRequest, aLocationURI, aFlags) {
+ onLocationChange(aWebProgress, aRequest, aLocationURI);
+ },
+
onLocationChange: function (aWebProgress, aRequest, aLocationURI) {
var location = aLocationURI ? aLocationURI.spec : "";
this._hostChanged = true;
// Hide the form invalid popup.
if (gFormSubmitObserver.panelIsOpen()) {
gFormSubmitObserver.panel.hidePopup();
}
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -245,58 +245,23 @@
label="&inspectPanelTitle.label;">
<toolbar id="inspector-toolbar"
nowindowdrag="true">
<toolbarbutton id="inspector-inspect-toolbutton"
label="&inspectButton.label;"
accesskey="&inspectButton.accesskey;"
class="toolbarbutton-text"
command="Inspector:Inspect"/>
- <toolbarbutton id="inspector-previous-toolbutton"
- label="&inspectPreviousButton.label;"
- accesskey="&inspectPreviousButton.accesskey;"
- class="toolbarbutton-text"
- command="Inspector:Previous"/>
- <toolbarbutton id="inspector-next-toolbutton"
- label="&inspectNextButton.label;"
- accesskey="&inspectNextButton.accesskey;"
- class="toolbarbutton-text"
- command="Inspector:Next"/>
- <toolbarbutton id="inspector-style-toolbutton"
- label="&inspectStyleButton.label;"
- accesskey="&inspectStyleButton.accesskey;"
- class="toolbarbutton-text"
- oncommand="InspectorUI.toggleStylePanel();"/>
- <toolbarbutton id="inspector-dom-toolbutton"
- label="&inspectObjectButton.label;"
- accesskey="&inspectObjectButton.accesskey;"
- class="toolbarbutton-text"
- oncommand="InspectorUI.toggleDOMPanel();"/>
</toolbar>
<hbox id="tree-panel-resizer-box" align="end">
<spacer flex="1" />
<resizer dir="bottomend" />
</hbox>
</panel>
- <panel id="inspector-style-panel"
- hidden="true"
- orient="vertical"
- ignorekeys="true"
- noautofocus="true"
- noautohide="true"
- titlebar="normal"
- label="&inspectStylePanelTitle.label;">
- <listbox id="inspector-style-listbox" flex="1"/>
- <hbox align="end">
- <spacer flex="1" />
- <resizer dir="bottomend"/>
- </hbox>
- </panel>
-
<menupopup id="toolbar-context-menu"
onpopupshowing="onViewToolbarsPopupShowing(event);">
<menuseparator/>
<menuitem command="cmd_ToggleTabsOnTop"
type="checkbox"
label="&viewTabsOnTop.label;"
accesskey="&viewTabsOnTop.accesskey;"/>
<menuseparator/>
--- a/browser/base/content/inspector.js
+++ b/browser/base/content/inspector.js
@@ -362,77 +362,26 @@ var InspectorUI = {
if (this.inspecting) {
this.stopInspecting();
} else {
this.startInspecting();
}
},
/**
- * Toggle the style panel. Invoked from the toolbar's Style button.
- */
- toggleStylePanel: function IUI_toggleStylePanel()
- {
- if (this.isStylePanelOpen) {
- this.stylePanel.hidePopup();
- } else {
- this.openStylePanel();
- if (this.selection) {
- this.updateStylePanel(this.selection);
- }
- }
- },
-
- /**
- * Toggle the DOM panel. Invoked from the toolbar's DOM button.
- */
- toggleDOMPanel: function IUI_toggleDOMPanel()
- {
- if (this.isDOMPanelOpen) {
- this.domPanel.hidePopup();
- } else {
- this.clearDOMPanel();
- this.openDOMPanel();
- if (this.selection) {
- this.updateDOMPanel(this.selection);
- }
- }
- },
-
- /**
* Is the tree panel open?
*
* @returns boolean
*/
get isTreePanelOpen()
{
return this.treePanel && this.treePanel.state == "open";
},
/**
- * Is the style panel open?
- *
- * @returns boolean
- */
- get isStylePanelOpen()
- {
- return this.stylePanel && this.stylePanel.state == "open";
- },
-
- /**
- * Is the DOM panel open?
- *
- * @returns boolean
- */
- get isDOMPanelOpen()
- {
- return this.domPanel && this.domPanel.state == "open";
- },
-
- /**
* Return the default selection element for the inspected document.
*/
get defaultSelection()
{
let doc = this.win.document;
return doc.documentElement.lastElementChild;
},
@@ -440,20 +389,27 @@ var InspectorUI = {
{
this.treeBrowserDocument = this.treeIFrame.contentDocument;
this.treePanelDiv = this.treeBrowserDocument.createElement("div");
this.treeBrowserDocument.body.appendChild(this.treePanelDiv);
this.treePanelDiv.ownerPanel = this;
this.ioBox = new InsideOutBox(this, this.treePanelDiv);
this.ioBox.createObjectBox(this.win.document.documentElement);
this.treeLoaded = true;
- if (this.isTreePanelOpen && this.isStylePanelOpen &&
- this.isDOMPanelOpen && this.treeLoaded) {
- this.notifyReady();
- }
+
+ // setup highlighter and start inspecting
+ this.initializeHighlighter();
+
+ // Setup the InspectorStore or restore state
+ this.initializeStore();
+
+ if (InspectorStore.getValue(this.winID, "inspecting"))
+ this.startInspecting();
+
+ this.notifyReady();
},
/**
* Open the inspector's tree panel and initialize it.
*/
openTreePanel: function IUI_openTreePanel()
{
if (!this.treePanel) {
@@ -466,36 +422,50 @@ var InspectorUI = {
let resizerBox = document.getElementById("tree-panel-resizer-box");
this.treeIFrame = document.createElement("iframe");
this.treeIFrame.setAttribute("id", "inspector-tree-iframe");
this.treeIFrame.setAttribute("flex", "1");
this.treeIFrame.setAttribute("type", "content");
this.treeIFrame.setAttribute("onclick", "InspectorUI.onTreeClick(event)");
this.treeIFrame = this.treePanel.insertBefore(this.treeIFrame, resizerBox);
}
-
+
+ this.treePanel.addEventListener("popupshown", function treePanelShown() {
+ InspectorUI.treePanel.removeEventListener("popupshown",
+ treePanelShown, false);
+
+ InspectorUI.treeIFrame.addEventListener("load",
+ function loadedInitializeTreePanel() {
+ InspectorUI.treeIFrame.removeEventListener("load",
+ loadedInitializeTreePanel, true);
+ InspectorUI.initializeTreePanel();
+ }, true);
+
+ let src = InspectorUI.treeIFrame.getAttribute("src");
+ if (src != "chrome://browser/content/inspector.html") {
+ InspectorUI.treeIFrame.setAttribute("src",
+ "chrome://browser/content/inspector.html");
+ } else {
+ InspectorUI.treeIFrame.contentWindow.location.reload();
+ }
+
+ }, false);
+
const panelWidthRatio = 7 / 8;
const panelHeightRatio = 1 / 5;
- this.treePanel.openPopup(this.browser, "overlap", 80, this.win.innerHeight,
- false, false);
- this.treePanel.sizeTo(this.win.outerWidth * panelWidthRatio,
- this.win.outerHeight * panelHeightRatio);
+
+ let width = parseInt(this.win.outerWidth * panelWidthRatio);
+ let height = parseInt(this.win.outerHeight * panelHeightRatio);
+ let y = Math.min(window.screen.availHeight - height, this.win.innerHeight);
- let src = this.treeIFrame.getAttribute("src");
- if (src != "chrome://browser/content/inspector.html") {
- let self = this;
- this.treeIFrame.addEventListener("DOMContentLoaded", function() {
- self.treeIFrame.removeEventListener("DOMContentLoaded", arguments.callee, true);
- self.initializeTreePanel();
- }, true);
+ this.treePanel.openPopup(this.browser, "overlap", 0, 0,
+ false, false);
- this.treeIFrame.setAttribute("src", "chrome://browser/content/inspector.html");
- } else {
- this.initializeTreePanel();
- }
+ this.treePanel.moveTo(80, y);
+ this.treePanel.sizeTo(width, height);
},
createObjectBox: function IUI_createObjectBox(object, isRoot)
{
let tag = this.domplateUtils.getNodeTag(object);
if (tag)
return tag.replace({object: object}, this.treeBrowserDocument);
},
@@ -595,115 +565,36 @@ var InspectorUI = {
if (!next)
delete this.treeWalker;
return next;
},
/**
- * Open the style panel if not already onscreen.
- */
- openStylePanel: function IUI_openStylePanel()
- {
- if (!this.stylePanel)
- this.stylePanel = document.getElementById("inspector-style-panel");
- if (!this.isStylePanelOpen) {
- this.stylePanel.hidden = false;
- // open at top right of browser panel, offset by 20px from top.
- this.stylePanel.openPopup(this.browser, "end_before", 0, 20, false, false);
- // size panel to 200px wide by half browser height - 60.
- this.stylePanel.sizeTo(200, this.win.outerHeight / 2 - 60);
- }
- },
-
- /**
- * Open the DOM panel if not already onscreen.
- */
- openDOMPanel: function IUI_openDOMPanel()
- {
- if (!this.isDOMPanelOpen) {
- this.domPanel.hidden = false;
- // open at middle right of browser panel, offset by 20px from middle.
- this.domPanel.openPopup(this.browser, "end_before", 0,
- this.win.outerHeight / 2 - 20, false, false);
- // size panel to 200px wide by half browser height - 60.
- this.domPanel.sizeTo(200, this.win.outerHeight / 2 - 60);
- }
- },
-
- /**
- * Toggle the dimmed (semi-transparent) state for a panel by setting or
- * removing a dimmed attribute.
- *
- * @param aDim
- * The panel to be dimmed.
- */
- toggleDimForPanel: function IUI_toggleDimForPanel(aDim)
- {
- if (aDim.hasAttribute("dimmed")) {
- aDim.removeAttribute("dimmed");
- } else {
- aDim.setAttribute("dimmed", "true");
- }
- },
-
- /**
- * Open inspector UI. tree, style and DOM panels if enabled. Add listeners for
- * document scrolling, resize, tabContainer.TabSelect and others.
+ * Open inspector UI. tree. Add listeners for document scrolling,
+ * resize, tabContainer.TabSelect and others.
*/
openInspectorUI: function IUI_openInspectorUI()
{
// initialization
this.browser = gBrowser.selectedBrowser;
this.win = this.browser.contentWindow;
this.winID = this.getWindowID(this.win);
if (!this.domplate) {
Cu.import("resource:///modules/domplate.jsm", this);
this.domplateUtils.setDOM(window);
}
- // DOM panel initialization and loading (via PropertyPanel.jsm)
- let objectPanelTitle = this.strings.
- GetStringFromName("object.objectPanelTitle");
- let parent = document.getElementById("inspector-style-panel").parentNode;
- this.propertyPanel = new (this.PropertyPanel)(parent, document,
- objectPanelTitle, {});
-
- // additional DOM panel setup needed for unittest identification and use
- this.domPanel = this.propertyPanel.panel;
- this.domPanel.setAttribute("id", "inspector-dom-panel");
- this.domBox = this.propertyPanel.tree;
- this.domTreeView = this.propertyPanel.treeView;
-
// open inspector UI
this.openTreePanel();
- // style panel setup and activation
- this.styleBox = document.getElementById("inspector-style-listbox");
- this.clearStylePanel();
- this.openStylePanel();
-
- // DOM panel setup and activation
- this.clearDOMPanel();
- this.openDOMPanel();
-
- // setup highlighter and start inspecting
- this.initializeHighlighter();
-
- // Setup the InspectorStore or restore state
- this.initializeStore();
-
- if (InspectorStore.getValue(this.winID, "inspecting"))
- this.startInspecting();
-
this.win.document.addEventListener("scroll", this, false);
this.win.addEventListener("resize", this, false);
this.inspectCmd.setAttribute("checked", true);
- document.addEventListener("popupshown", this, false);
},
/**
* Initialize highlighter.
*/
initializeHighlighter: function IUI_initializeHighlighter()
{
this.highlighter = new PanelHighlighter(this.browser);
@@ -769,18 +660,16 @@ var InspectorUI = {
this.win.document.removeEventListener("scroll", this, false);
this.win.removeEventListener("resize", this, false);
this.stopInspecting();
if (this.highlighter && this.highlighter.isHighlighting) {
this.highlighter.unhighlight();
}
- if (this.isTreePanelOpen)
- this.treePanel.hidePopup();
if (this.treePanelDiv) {
this.treePanelDiv.ownerPanel = null;
let parent = this.treePanelDiv.parentNode;
parent.removeChild(this.treePanelDiv);
delete this.treePanelDiv;
delete this.treeBrowserDocument;
}
@@ -790,57 +679,51 @@ var InspectorUI = {
if (this.domplate) {
this.domplateUtils.setDOM(null);
delete this.domplate;
delete this.HTMLTemplates;
delete this.domplateUtils;
}
- if (this.isStylePanelOpen) {
- this.stylePanel.hidePopup();
- }
- if (this.domPanel) {
- this.domPanel.hidePopup();
- this.domBox = null;
- this.domTreeView = null;
- }
this.inspectCmd.setAttribute("checked", false);
this.browser = this.win = null; // null out references to browser and window
this.winID = null;
this.selection = null;
this.treeLoaded = false;
- this.closing = false;
- Services.obs.notifyObservers(null, "inspector-closed", null);
+
+ this.treePanel.addEventListener("popuphidden", function treePanelHidden() {
+ InspectorUI.closing = false;
+ Services.obs.notifyObservers(null, "inspector-closed", null);
+ }, false);
+
+ this.treePanel.hidePopup();
+ delete this.treePanel;
},
/**
* Begin inspecting webpage, attach page event listeners, activate
* highlighter event listeners.
*/
startInspecting: function IUI_startInspecting()
{
this.attachPageListeners();
this.inspecting = true;
- this.toggleDimForPanel(this.stylePanel);
- this.toggleDimForPanel(this.domPanel);
},
/**
* Stop inspecting webpage, detach page listeners, disable highlighter
* event listeners.
*/
stopInspecting: function IUI_stopInspecting()
{
if (!this.inspecting)
return;
this.detachPageListeners();
this.inspecting = false;
- this.toggleDimForPanel(this.stylePanel);
- this.toggleDimForPanel(this.domPanel);
if (this.highlighter.node) {
this.select(this.highlighter.node, true, true);
}
},
/**
* Select an object in the tree view.
* @param aNode
@@ -855,199 +738,62 @@ var InspectorUI = {
if (!aNode)
aNode = this.defaultSelection;
if (forceUpdate || aNode != this.selection) {
this.selection = aNode;
let box = this.ioBox.createObjectBox(this.selection);
if (!this.inspecting) {
this.highlighter.highlightNode(this.selection);
- this.updateStylePanel(this.selection);
- this.updateDOMPanel(this.selection);
}
this.ioBox.select(aNode, true, true, aScroll);
}
},
/////////////////////////////////////////////////////////////////////////
- //// Model Creation Methods
-
- /**
- * Add a new item to the style panel listbox.
- *
- * @param aLabel
- * A bit of text to put in the listitem's label attribute.
- * @param aType
- * The type of item.
- * @param content
- * Text content or value of the listitem.
- */
- addStyleItem: function IUI_addStyleItem(aLabel, aType, aContent)
- {
- let itemLabelString = this.strings.GetStringFromName("style.styleItemLabel");
- let item = document.createElement("listitem");
-
- // Do not localize these strings
- let label = aLabel;
- item.className = "style-" + aType;
- if (aContent) {
- label = itemLabelString.replace("#1", aLabel);
- label = label.replace("#2", aContent);
- }
- item.setAttribute("label", label);
-
- this.styleBox.appendChild(item);
- },
-
- /**
- * Create items for each rule included in the given array.
- *
- * @param aRules
- * an array of rule objects
- */
- createStyleRuleItems: function IUI_createStyleRuleItems(aRules)
- {
- let selectorLabel = this.strings.GetStringFromName("style.selectorLabel");
-
- aRules.forEach(function(rule) {
- this.addStyleItem(selectorLabel, "selector", rule.id);
- rule.properties.forEach(function(property) {
- if (property.overridden)
- return; // property marked overridden elsewhere
- // Do not localize the strings below this line
- let important = "";
- if (property.important)
- important += " !important";
- this.addStyleItem(property.name, "property", property.value + important);
- }, this);
- }, this);
- },
-
- /**
- * Create rule items for each section as well as the element's style rules,
- * if any.
- *
- * @param aRules
- * Array of rules corresponding to the element's style object.
- * @param aSections
- * Array of sections encapsulating the inherited rules for selectors
- * and elements.
- */
- createStyleItems: function IUI_createStyleItems(aRules, aSections)
- {
- this.createStyleRuleItems(aRules);
- let inheritedString =
- this.strings.GetStringFromName("style.inheritedFrom");
- aSections.forEach(function(section) {
- let sectionTitle = section.element.tagName;
- if (section.element.id)
- sectionTitle += "#" + section.element.id;
- let replacedString = inheritedString.replace("#1", sectionTitle);
- this.addStyleItem(replacedString, "section");
- this.createStyleRuleItems(section.rules);
- }, this);
- },
-
- /**
- * Remove all items from the Style Panel's listbox.
- */
- clearStylePanel: function IUI_clearStylePanel()
- {
- for (let i = this.styleBox.childElementCount; i >= 0; --i)
- this.styleBox.removeItemAt(i);
- },
-
- /**
- * Remove all items from the DOM Panel's listbox.
- */
- clearDOMPanel: function IUI_clearStylePanel()
- {
- this.domTreeView.data = {};
- },
-
- /**
- * Update the contents of the style panel with styles for the currently
- * inspected node.
- *
- * @param aNode
- * The highlighted node to get styles for.
- */
- updateStylePanel: function IUI_updateStylePanel(aNode)
- {
- if (this.inspecting || !this.isStylePanelOpen) {
- return;
- }
-
- let rules = [], styleSections = [], usedProperties = {};
- this.style.getInheritedRules(aNode, styleSections, usedProperties);
- this.style.getElementRules(aNode, rules, usedProperties);
- this.clearStylePanel();
- this.createStyleItems(rules, styleSections);
- },
-
- /**
- * Update the contents of the DOM panel with name/value pairs for the
- * currently-inspected node.
- */
- updateDOMPanel: function IUI_updateDOMPanel(aNode)
- {
- if (this.inspecting || !this.isDOMPanelOpen) {
- return;
- }
-
- this.domTreeView.data = aNode;
- },
-
- /////////////////////////////////////////////////////////////////////////
//// Event Handling
notifyReady: function IUI_notifyReady()
{
- document.removeEventListener("popupshowing", this, false);
Services.obs.notifyObservers(null, "inspector-opened", null);
},
/**
* Main callback handler for events.
*
* @param event
* The event to be handled.
*/
handleEvent: function IUI_handleEvent(event)
{
let winID = null;
let win = null;
let inspectorClosed = false;
switch (event.type) {
- case "popupshown":
- if (event.target.id == "inspector-tree-panel" ||
- event.target.id == "inspector-style-panel" ||
- event.target.id == "inspector-dom-panel")
- if (this.isTreePanelOpen && this.isStylePanelOpen &&
- this.isDOMPanelOpen && this.treeLoaded) {
- this.notifyReady();
- }
- break;
case "TabSelect":
winID = this.getWindowID(gBrowser.selectedBrowser.contentWindow);
if (this.isTreePanelOpen && winID != this.winID) {
this.closeInspectorUI(true);
inspectorClosed = true;
}
if (winID && InspectorStore.hasID(winID)) {
if (inspectorClosed && this.closing) {
- Services.obs.addObserver(function () {
+ Services.obs.addObserver(function reopenInspectorForTab() {
+ Services.obs.removeObserver(reopenInspectorForTab,
+ "inspector-closed", false);
InspectorUI.openInspectorUI();
}, "inspector-closed", false);
} else {
this.openInspectorUI();
}
- } else if (InspectorStore.isEmpty()) {
+ }
+
+ if (InspectorStore.isEmpty()) {
gBrowser.tabContainer.removeEventListener("TabSelect", this, false);
}
break;
case "pagehide":
win = event.originalTarget.defaultView;
// Skip iframes/frames.
if (!win || win.frameElement || win.top != win) {
break;
@@ -1146,18 +892,16 @@ var InspectorUI = {
* the element in the document to inspect
*/
inspectNode: function IUI_inspectNode(aNode)
{
this.highlighter.highlightNode(aNode);
this.selectEventsSuppressed = true;
this.select(aNode, true, true);
this.selectEventsSuppressed = false;
- this.updateStylePanel(aNode);
- this.updateDOMPanel(aNode);
},
/**
* Find an element from the given coordinates. This method descends through
* frames to find the element the user clicked inside frames.
*
* @param DOMDocument aDocument the document to look into.
* @param integer aX
@@ -1279,16 +1023,35 @@ var InspectorUI = {
/**
* @param msg
* text message to send to the log
*/
_log: function LOG(msg)
{
Services.console.logStringMessage(msg);
},
+
+ /**
+ * Debugging function.
+ * @param msg
+ * text to show with the stack trace.
+ */
+ _trace: function TRACE(msg)
+ {
+ this._log("TRACE: " + msg);
+ let frame = Components.stack.caller;
+ while (frame = frame.caller) {
+ if (frame.language == Ci.nsIProgrammingLanguage.JAVASCRIPT ||
+ frame.language == Ci.nsIProgrammingLanguage.JAVASCRIPT2) {
+ this._log("filename: " + frame.filename + " lineNumber: " + frame.lineNumber +
+ " functionName: " + frame.name);
+ }
+ }
+ this._log("END TRACE");
+ },
}
/**
* The Inspector store is used for storing data specific to each tab window.
*/
var InspectorStore = {
store: {},
length: 0,
@@ -1415,31 +1178,8 @@ var InspectorStore = {
/////////////////////////////////////////////////////////////////////////
//// Initializors
XPCOMUtils.defineLazyGetter(InspectorUI, "inspectCmd", function () {
return document.getElementById("Tools:Inspect");
});
-XPCOMUtils.defineLazyGetter(InspectorUI, "strings", function () {
- return Services.strings.createBundle("chrome://browser/locale/inspector.properties");
-});
-
-XPCOMUtils.defineLazyGetter(InspectorUI, "PropertyTreeView", function () {
- var obj = {};
- Cu.import("resource:///modules/PropertyPanel.jsm", obj);
- return obj.PropertyTreeView;
-});
-
-XPCOMUtils.defineLazyGetter(InspectorUI, "PropertyPanel", function () {
- var obj = {};
- Cu.import("resource:///modules/PropertyPanel.jsm", obj);
- return obj.PropertyPanel;
-});
-
-XPCOMUtils.defineLazyGetter(InspectorUI, "style", function () {
- var obj = {};
- Cu.import("resource:///modules/stylePanel.jsm", obj);
- obj.style.initialize();
- return obj.style;
-});
-
deleted file mode 100644
--- a/browser/base/content/stylePanel.jsm
+++ /dev/null
@@ -1,315 +0,0 @@
-/*
- * Software License Agreement (BSD License)
- *
- * Copyright (c) 2007, Parakey Inc.
- * All rights reserved.
- *
- * Redistribution and use of this software in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above
- * copyright notice, this list of conditions and the
- * following disclaimer.
- *
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the
- * following disclaimer in the documentation and/or other
- * materials provided with the distribution.
- *
- * * Neither the name of Parakey Inc. nor the names of its
- * contributors may be used to endorse or promote products
- * derived from this software without specific prior
- * written permission of Parakey Inc.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
- * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
- * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/*
- * Creator:
- * Joe Hewitt
- * Contributors
- * John J. Barton (IBM Almaden)
- * Jan Odvarko (Mozilla Corp.)
- * Max Stepanov (Aptana Inc.)
- * Rob Campbell (Mozilla Corp.)
- * Hans Hillen (Paciello Group, Mozilla)
- * Curtis Bartley (Mozilla Corp.)
- * Mike Collins (IBM Almaden)
- * Kevin Decker
- * Mike Ratcliffe (Comartis AG)
- * Hernan RodrÃguez Colmeiro
- * Austin Andrews
- * Christoph Dorn
- * Steven Roussey (AppCenter Inc, Network54)
- */
-
-var EXPORTED_SYMBOLS = ["style"];
-
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cu = Components.utils;
-
-Cu.import("resource://gre/modules/Services.jsm");
-
-var style = {
-
- /**
- * initialize domUtils
- */
- initialize: function CSS_initialize()
- {
- this.domUtils = Cc["@mozilla.org/inspector/dom-utils;1"].
- getService(Ci["inIDOMUtils"]);
- },
-
- /**
- * Is the given property sheet a system (user agent) stylesheet?
- *
- * @param aSheet
- * a stylesheet
- */
- isSystemStyleSheet: function CSS_isSystemStyleSheet(aSheet)
- {
- if (!aSheet)
- return true;
-
- let url = aSheet.href;
-
- if (!url)
- return false;
- if (url.length == 0)
- return true;
- if (url[0] == 'h')
- return false;
- if (url.substr(0, 9) == "resource:")
- return true;
- if (url.substr(0, 7) == "chrome:")
- return true;
- if (url == "XPCSafeJSObjectWrapper.cpp")
- return true;
- if (url.substr(0, 6) == "about:")
- return true;
-
- return false;
- },
-
- /**
- * Parse properties from a given style object.
- * Borrowed from Firebug's css.js.
- *
- * @param aStyle
- * a style object
- */
- parseCSSProperties: function CSS_parseCSSProps(aStyle)
- {
- let properties = [];
- let lines = aStyle.cssText.match(/(?:[^;\(]*(?:\([^\)]*?\))?[^;\(]*)*;?/g);
- let propRE = /\s*([^:\s]*)\s*:\s*(.*?)\s*(! important)?;?$/;
- let line, i = 0;
- while(line = lines[i++]) {
- let match = propRE.exec(line);
- if (!match)
- continue;
- let name = match[1];
- let value = match[2];
- let important = !!match[3]; // true if match[3] is non-empty
- properties.unshift({name: name, value: value, important: important});
- }
-
- return properties;
- },
-
- /**
- * Mark properties overridden further up the hierarchy.
- *
- * @param aProps
- * Array of properties.
- * @param aUsedProps
- * Object of arrays keyed by property name.
- * @param aInherit
- * Boolean of whether or not we are in inherited mode.
- */
- markOverriddenProperties: function CSS_markOverriddenProperties(aProps, aUsedProps, aInherit)
- {
- for (let i = 0; i < aProps.length; ++i) {
- let prop = aProps[i];
- if (aUsedProps.hasOwnProperty(prop.name)) {
- // all previous occurrences of this property
- let deadProps = aUsedProps[prop.name];
- for (let j = 0; j < deadProps.length; ++j) {
- let deadProp = deadProps[j];
- if (!deadProp.disabled && !deadProp.wasInherited &&
- deadProp.important && !prop.important) {
- prop.overridden = true; // new occurrence overridden
- } else if (!prop.disabled) {
- deadProp.overridden = true; // previous occurrences overridden
- } else {
- aUsedProps[prop.name] = [];
- }
-
- prop.wasInherited = aInherit ? true : false;
- // all occurrences of a property seen so far, by name
- aUsedProps[prop.name].push(prop);
- }
- }
- }
- },
-
- /**
- * Sort given properties in lexical order by name.
- *
- * @param properties
- * An array of properties.
- * @returns sorted array.
- */
- sortProperties: function CSS_sortProperties(properties)
- {
- properties.sort(function(a, b)
- {
- if (a.name < b.name) {
- return -1;
- }
- if (a.name > b.name) {
- return 1;
- }
- return 0;
- });
- },
-
- /**
- * Get properties for a given element and push them to the rules array.
- *
- * @param aNode
- * a DOM node
- * @param rules
- * An array of rules to add properties to.
- * @param usedProps
- * Object of arrays keyed by property name.
- * @param inherit
- * boolean determining whether or not we're in inherit mode
- */
- getStyleProperties: function CSS_getStyleProperties(aNode, aRules, aUsedProps, aInherit)
- {
- let properties = this.parseCSSProperties(aNode.style, aInherit);
-
- this.sortProperties(properties);
- this.markOverriddenProperties(properties, aUsedProps, aInherit);
-
- if (properties.length) {
- aRules.push({rule: aNode, selector: "element.style",
- properties: properties, inherited: aInherit});
- }
- },
-
- /**
- * Get properties for a given rule.
- *
- * @param aRule
- * A Rule from a stylesheet.
- */
- getRuleProperties: function CSS_getRuleProperties(aRule)
- {
- let style = aRule.style;
- return this.parseCSSProperties(style);
- },
-
- /**
- * Recursively get rules for an element's parents and add them to the
- * sections array.
- *
- * @param aNode
- * an element in a DOM tree.
- * @param sections
- * an array of sections
- * @param usedProps
- * Object of arrays keyed by property name.
- */
- getInheritedRules: function CSS_getInheritedRules(aNode, aSections, aUsedProps)
- {
- let parent = aNode.parentNode;
- if (parent && parent.nodeType == 1) {
- this.getInheritedRules(parent, aSections, aUsedProps);
-
- let rules = [];
- this.getElementRules(parent, rules, aUsedProps, true);
-
- if (rules.length) {
- aSections.unshift({element: parent, rules: rules});
- }
- }
- },
-
- /**
- * Get the CSS style rules for a given node in the DOM and append them to the
- * rules array.
- *
- * @param aNode
- * an element in the DOM tree.
- * @param aRules
- * an array of rules.
- * @param aUsedProps
- * Object of arrays keyed by property name.
- * @param aInherit
- * boolean indicating whether we are in an inherited mode or not
- */
- getElementRules: function CSS_getElementRules(aNode, aRules, aUsedProps, aInherit)
- {
- let inspectedRules;
-
- try {
- inspectedRules = this.domUtils.getCSSStyleRules(aNode);
- } catch (ex) {
- Services.console.logStringMessage(ex);
- }
-
- if (!inspectedRules)
- return;
-
- for (let i = 0; i < inspectedRules.Count(); ++i) {
- let rule = inspectedRules.GetElementAt(i);
- let href = rule.parentStyleSheet.href;
-
- if (!href) {
- // Null href means inline style.
- href = aNode.ownerDocument.location.href;
- }
-
- let isSystemSheet = this.isSystemStyleSheet(rule.parentStyleSheet);
-
- if (isSystemSheet)
- continue;
-
- let properties = this.getRuleProperties(rule, aInherit);
- if (aInherit && !properties.length)
- continue;
-
- let line = this.domUtils.getRuleLine(rule);
- let ruleId = rule.selectorText + " " + href + " (" + line + ")";
-
- let sourceLink = "view-source:" + href + "#" + line;
-
- this.markOverriddenProperties(properties, aUsedProps, aInherit);
-
- aRules.unshift(
- {rule: rule,
- id: ruleId,
- selector: rule.selectorText,
- properties: properties,
- inherited: aInherit,
- sourceLink: sourceLink,
- isSystemSheet: isSystemSheet});
- }
-
- if (aNode.style) {
- this.getStyleProperties(aNode, aRules, aUsedProps, aInherit);
- }
- },
-};
-
--- a/browser/base/content/tabview/drag.js
+++ b/browser/base/content/tabview/drag.js
@@ -80,29 +80,16 @@ function Drag(item, event, isFauxDrag) {
this.startTime = Date.now();
this.item.isDragging = true;
this.item.setZ(999999);
this.safeWindowBounds = Items.getSafeWindowBounds();
Trenches.activateOthersTrenches(this.el);
-
- if (!isFauxDrag) {
- // When a tab drag starts, make it the focused tab.
- if (this.item.isAGroupItem) {
- var tab = UI.getActiveTab();
- if (!tab || tab.parent != this.item) {
- if (this.item._children.length)
- UI.setActive(this.item._children[0]);
- }
- } else if (this.item.isATabItem) {
- UI.setActive(this.item);
- }
- }
};
Drag.prototype = {
// ----------
// Function: toString
// Prints [Drag (item)] for debug use
toString: function Drag_toString() {
return "[Drag (" + this.item + ")]";
--- a/browser/base/content/tabview/groupitems.js
+++ b/browser/base/content/tabview/groupitems.js
@@ -1009,18 +1009,17 @@ GroupItem.prototype = Utils.extend(new I
UI.setActive(self);
});
item.setParent(this);
if (typeof item.setResizable == 'function')
item.setResizable(false, options.immediately);
- // if it is visually active, set it as the active tab.
- if (iQ(item.container).hasClass("focus"))
+ if (item == UI.getActiveTab() || !this._activeTab)
this.setActiveTab(item);
// if it matches the selected tab or no active tab and the browser
// tab is hidden, the active group item would be set.
if (item.tab == gBrowser.selectedTab ||
(!GroupItems.getActiveGroupItem() && !item.tab.hidden))
UI.setActive(this);
}
--- a/browser/base/content/tabview/items.js
+++ b/browser/base/content/tabview/items.js
@@ -146,20 +146,19 @@ Item.prototype = {
this.$container = iQ(container);
iQ(this.container).data('item', this);
// ___ drag
this.dragOptions = {
cancelClass: 'close stackExpander',
start: function(e, ui) {
- if (this.isAGroupItem) {
- UI.setActive(this);
+ UI.setActive(this);
+ if (this.isAGroupItem)
this._unfreezeItemSize();
- }
// if we start dragging a tab within a group, start with dropSpace on.
else if (this.parent != null)
this.parent._dropSpaceActive = true;
drag.info = new Drag(this, e);
},
drag: function(e) {
drag.info.drag(e);
},
@@ -196,18 +195,17 @@ Item.prototype = {
// ___ resize
var self = this;
this.resizeOptions = {
aspectRatio: self.keepProportional,
minWidth: 90,
minHeight: 90,
start: function(e,ui) {
- if (this.isAGroupItem)
- UI.setActive(this);
+ UI.setActive(this);
resize.info = new Drag(this, e);
},
resize: function(e,ui) {
resize.info.snap(UI.rtl ? 'topright' : 'topleft', false, self.keepProportional);
},
stop: function() {
self.setUserSize();
self.pushAway();
--- a/browser/base/content/tabview/search.js
+++ b/browser/base/content/tabview/search.js
@@ -205,17 +205,17 @@ TabMatcher.prototype = {
// ---------
// Function: _filterForUnmatches
// Given an array of <TabItem>s returns an unsorted array of tabs whose name
// does not match the the search term.
_filterForUnmatches: function TabMatcher__filterForUnmatches(tabs) {
var self = this;
return tabs.filter(function(tab) {
- var name = tab.$tabTitle[0].innerHTML;
+ let name = tab.$tabTitle[0].textContent;
let url = TabUtils.URLOf(tab);
return !name.match(self.term, "i") && !url.match(self.term, "i");
});
},
// ---------
// Function: _getTabsForOtherWindows
// Returns an array of <TabItem>s and <xul:tabs>s representing tabs
@@ -225,27 +225,18 @@ TabMatcher.prototype = {
// been activated.
_getTabsForOtherWindows: function TabMatcher__getTabsForOtherWindows() {
var enumerator = Services.wm.getEnumerator("navigator:browser");
var allTabs = [];
while (enumerator.hasMoreElements()) {
var win = enumerator.getNext();
// This function gets tabs from other windows, not from the current window
- if (win != gWindow) {
- // If TabView is around iterate over all tabs, else get the currently
- // shown tabs...
- let tvWindow = win.TabView.getContentWindow();
- if (tvWindow)
- allTabs = allTabs.concat(tvWindow.TabItems.getItems());
- else
- // win.gBrowser.tabs isn't a proper array, so we can't use concat
- for (let i = 0; i < win.gBrowser.tabs.length; i++)
- allTabs.push(win.gBrowser.tabs[i]);
- }
+ if (win != gWindow)
+ allTabs.push.apply(allTabs, win.gBrowser.tabs);
}
return allTabs;
},
// ----------
// Function: matchedTabsFromOtherWindows
// Returns an array of <TabItem>s and <xul:tab>s that match the search term
// from all windows but the current window. <TabItem>s will be returned for
--- a/browser/base/content/tabview/storage.js
+++ b/browser/base/content/tabview/storage.js
@@ -216,16 +216,25 @@ let Storage = {
// Function: saveVisibilityData
// Saves visibility for the given window.
saveVisibilityData: function Storage_saveVisibilityData(win, data) {
this._sessionStore.setWindowValue(
win, win.TabView.VISIBILITY_IDENTIFIER, data);
},
// ----------
+ // Function: saveActiveGroupName
+ // Saves the active group's name for the given window.
+ saveActiveGroupName: function Storage_saveActiveGroupName(win) {
+ let groupName = win.TabView.getActiveGroupName();
+ this._sessionStore.setWindowValue(
+ win, win.TabView.LAST_SESSION_GROUP_NAME_IDENTIFIER, groupName);
+ },
+
+ // ----------
// Function: saveData
// Generic routine for saving data to a window.
saveData: function Storage_saveData(win, id, data) {
try {
this._sessionStore.setWindowValue(win, id, JSON.stringify(data));
} catch (e) {
Utils.log("Error in saveData: "+e);
}
--- a/browser/base/content/tabview/ui.js
+++ b/browser/base/content/tabview/ui.js
@@ -123,18 +123,17 @@ let UI = {
wasInTabView: false
},
// Variable: _storageBusyCount
// Used to keep track of how many calls to storageBusy vs storageReady.
_storageBusyCount: 0,
// Variable: isDOMWindowClosing
- // Tells wether we already received the "domwindowclosed" event and the parent
- // windows is about to close.
+ // Tells wether the parent window is about to close
isDOMWindowClosing: false,
// Variable: _browserKeys
// Used to keep track of allowed browser keys.
_browserKeys: null,
// Variable: ignoreKeypressForSearch
// Used to prevent keypress being handled after quitting search mode.
@@ -252,31 +251,29 @@ let UI = {
this._resize(true);
else
this._pageBounds = Items.getPageBounds();
iQ(window).resize(function() {
self._resize();
});
- // ___ setup observer to save canvas images
- function domWinClosedObserver(subject, topic, data) {
- if (topic == "domwindowclosed" && subject == gWindow) {
- self.isDOMWindowClosing = true;
- if (self.isTabViewVisible())
- GroupItems.removeHiddenGroups();
- TabItems.saveAll(true);
- self._save();
- }
- }
- Services.obs.addObserver(
- domWinClosedObserver, "domwindowclosed", false);
- this._cleanupFunctions.push(function() {
- Services.obs.removeObserver(domWinClosedObserver, "domwindowclosed");
- });
+ // ___ setup event listener to save canvas images
+ gWindow.addEventListener("SSWindowClosing", function onWindowClosing() {
+ gWindow.removeEventListener("SSWindowClosing", onWindowClosing, false);
+
+ self.isDOMWindowClosing = true;
+
+ if (self.isTabViewVisible())
+ GroupItems.removeHiddenGroups();
+
+ Storage.saveActiveGroupName(gWindow);
+ TabItems.saveAll(true);
+ self._save();
+ }, false);
// ___ Done
this._frameInitialized = true;
this._save();
// fire an iframe initialized event so everyone knows tab view is
// initialized.
let event = document.createEvent("Events");
--- a/browser/base/content/test/Makefile.in
+++ b/browser/base/content/test/Makefile.in
@@ -181,18 +181,16 @@ endif
browser_discovery.js \
browser_duplicateIDs.js \
browser_gestureSupport.js \
browser_getshortcutoruri.js \
browser_hide_removing.js \
browser_inspector_initialization.js \
browser_inspector_treeSelection.js \
browser_inspector_highlighter.js \
- browser_inspector_stylePanel.js \
- browser_inspector_domPanel.js \
browser_inspector_iframeTest.js \
browser_inspector_scrolling.js \
browser_inspector_store.js \
browser_inspector_tab_switch.js \
browser_inspector_treePanel_output.js \
browser_inspector_treePanel_input.html \
browser_inspector_treePanel_result.html \
browser_scratchpad_initialization.js \
--- a/browser/base/content/test/browser_bug321000.js
+++ b/browser/base/content/test/browser_bug321000.js
@@ -33,19 +33,16 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-const Ci = Components.interfaces;
-const Cc = Components.classes;
-
const kTestString = " hello hello \n world\nworld ";
var gTests = [
{ desc: "Urlbar strips newlines and surrounding whitespace",
element: gURLBar,
expected: kTestString.replace(/\s*\n\s*/g,'')
},
@@ -82,18 +79,17 @@ function next_test() {
function test_paste(aCurrentTest) {
var element = aCurrentTest.element;
// Register input listener.
var inputListener = {
test: aCurrentTest,
handleEvent: function(event) {
- var element = event.target;
- element.removeEventListener("input", this, false);
+ element.removeEventListener(event.type, this, false);
is(element.value, this.test.expected, this.test.desc);
// Clear the field and go to next test.
element.value = "";
setTimeout(next_test, 0);
}
}
--- a/browser/base/content/test/browser_bug380960.js
+++ b/browser/base/content/test/browser_bug380960.js
@@ -56,16 +56,17 @@ function preperForNextText() {
nextAsyncText(tab);
});
}
function nextAsyncText(tab) {
var gotCloseEvent = false;
tab.addEventListener("TabClose", function () {
+ tab.removeEventListener("TabClose", arguments.callee, false);
info("got TabClose event");
gotCloseEvent = true;
const DEFAULT_ANIMATION_LENGTH = 250;
const MAX_WAIT_TIME = DEFAULT_ANIMATION_LENGTH * 7;
var polls = Math.ceil(MAX_WAIT_TIME / DEFAULT_ANIMATION_LENGTH);
var pollTabRemoved = setInterval(function () {
--polls;
--- a/browser/base/content/test/browser_bug477014.js
+++ b/browser/base/content/test/browser_bug477014.js
@@ -47,35 +47,33 @@ function test() {
function onPageShow(event) {
// we get here if the test is executed before the pageshow
// event for the window's first tab
if (!tabToDetach ||
tabToDetach.linkedBrowser.contentDocument != event.target)
return;
+ event.currentTarget.removeEventListener("pageshow", onPageShow, false);
+
if (!newWindow) {
- gBrowser.removeEventListener("pageshow", onPageShow, false);
-
// prepare the tab (set icon and busy state)
// we have to set these only after onState* notification, otherwise
// they're overriden
setTimeout(function() {
gBrowser.setIcon(tabToDetach, iconURLSpec);
tabToDetach.setAttribute("busy", "true");
// detach and set the listener on the new window
newWindow = gBrowser.replaceTabWithWindow(tabToDetach);
// wait for gBrowser to come along
- function onLoad(event) {
- newWindow.gBrowser
- .addEventListener("pageshow", onPageShow, false);
+ newWindow.addEventListener("load", function () {
newWindow.removeEventListener("load", arguments.callee, false);
- }
- newWindow.addEventListener("load", onLoad, false);
+ newWindow.gBrowser.addEventListener("pageshow", onPageShow, false);
+ }, false);
}, 0);
return;
}
is(newWindow.gBrowser.selectedTab.hasAttribute("busy"), true);
is(newWindow.gBrowser.getIcon(), iconURLSpec);
newWindow.close();
finish();
--- a/browser/base/content/test/browser_bug481560.js
+++ b/browser/base/content/test/browser_bug481560.js
@@ -4,20 +4,24 @@ function test() {
var win = openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no");
win.addEventListener("load", function () {
win.removeEventListener("load", arguments.callee, false);
win.content.addEventListener("focus", function () {
win.content.removeEventListener("focus", arguments.callee, false);
- win.gBrowser.selectedTab.addEventListener("TabClose", function () {
+ function onTabClose() {
ok(false, "shouldn't have gotten the TabClose event for the last tab");
- }, false);
+ }
+ var tab = win.gBrowser.selectedTab;
+ tab.addEventListener("TabClose", onTabClose, false);
EventUtils.synthesizeKey("w", { accelKey: true }, win);
ok(win.closed, "accel+w closed the window immediately");
+ tab.removeEventListener("TabClose", onTabClose, false);
+
finish();
}, false);
}, false);
}
--- a/browser/base/content/test/browser_bug517902.js
+++ b/browser/base/content/test/browser_bug517902.js
@@ -8,16 +8,17 @@ function test() {
gBrowser.selectedBrowser.addEventListener("load", function () {
gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
var doc = gBrowser.contentDocument;
var testImg = doc.getElementById("test-image");
var pageInfo = BrowserPageInfo(doc, "mediaTab", testImg);
pageInfo.addEventListener("load", function () {
+ pageInfo.removeEventListener("load", arguments.callee, true);
pageInfo.onFinished.push(function () {
executeSoon(function () {
var pageInfoImg = pageInfo.document.getElementById("thepreviewimage");
is(pageInfoImg.src, testImg.src, "selected image has the correct source");
is(pageInfoImg.width, testImg.width, "selected image has the correct width");
is(pageInfoImg.height, testImg.height, "selected image has the correct height");
--- a/browser/base/content/test/browser_bug550565.js
+++ b/browser/base/content/test/browser_bug550565.js
@@ -1,16 +1,18 @@
function test() {
waitForExplicitFinish();
let testPath = getRootDirectory(gTestPath);
let tab = gBrowser.addTab(testPath + "file_bug550565_popup.html");
- tab.linkedBrowser.addEventListener('DOMContentLoaded', function() {
+ tab.linkedBrowser.addEventListener("DOMContentLoaded", function() {
+ tab.linkedBrowser.removeEventListener("DOMContentLoaded", arguments.callee, true);
+
let expectedIcon = testPath + "file_bug550565_favicon.ico";
is(gBrowser.getIcon(tab), expectedIcon, "Correct icon before pushState.");
tab.linkedBrowser.contentWindow.history.pushState("page2", "page2", "page2");
is(gBrowser.getIcon(tab), expectedIcon, "Correct icon after pushState.");
gBrowser.removeTab(tab);
--- a/browser/base/content/test/browser_bug562649.js
+++ b/browser/base/content/test/browser_bug562649.js
@@ -11,14 +11,17 @@ function test() {
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.removeCurrentTab();
is(gBrowser.userTypedValue, URI, "userTypedValue matches test URI after switching tabs");
is(gURLBar.value, URI, "location bar value matches test URI after switching tabs");
waitForExplicitFinish();
gBrowser.selectedBrowser.addEventListener("load", function () {
+ gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
+
is(gBrowser.userTypedValue, null, "userTypedValue is null as the page has loaded");
is(gURLBar.value, URI, "location bar value matches test URI as the page has loaded");
+
gBrowser.removeCurrentTab();
finish();
}, true);
}
--- a/browser/base/content/test/browser_bug580956.js
+++ b/browser/base/content/test/browser_bug580956.js
@@ -1,27 +1,31 @@
function numClosedTabs()
Cc["@mozilla.org/browser/sessionstore;1"].
getService(Ci.nsISessionStore).
getClosedTabCount(window);
function isUndoCloseEnabled() {
document.popupNode = gBrowser.tabs[0];
TabContextMenu.updateContextMenu(document.getElementById("tabContextMenu"));
+ TabContextMenu.contextTab = null;
return !document.getElementById("context_undoCloseTab").disabled;
}
function test() {
waitForExplicitFinish();
gPrefService.setIntPref("browser.sessionstore.max_tabs_undo", 0);
gPrefService.clearUserPref("browser.sessionstore.max_tabs_undo");
is(numClosedTabs(), 0, "There should be 0 closed tabs.");
ok(!isUndoCloseEnabled(), "Undo Close Tab should be disabled.");
var tab = gBrowser.addTab("http://mochi.test:8888/");
var browser = gBrowser.getBrowserForTab(tab);
browser.addEventListener("load", function() {
+ browser.removeEventListener("load", arguments.callee, true);
+
gBrowser.removeTab(tab);
ok(isUndoCloseEnabled(), "Undo Close Tab should be enabled.");
+
finish();
}, true);
}
--- a/browser/base/content/test/browser_bug585785.js
+++ b/browser/base/content/test/browser_bug585785.js
@@ -22,15 +22,17 @@ function checkAnimationState() {
ok(true, "tab removed synchronously since the opening animation hasn't moved yet");
finish();
return;
}
info("tab didn't close immediately, so the tab opening animation must have started moving");
info("waiting for the tab to close asynchronously");
tab.addEventListener("transitionend", function (event) {
- if (event.propertyName == "max-width")
+ if (event.propertyName == "max-width") {
+ tab.removeEventListener("transitionend", arguments.callee, false);
executeSoon(function () {
ok(!tab.parentNode, "tab removed asynchronously");
finish();
});
+ }
}, false);
}
--- a/browser/base/content/test/browser_bug594131.js
+++ b/browser/base/content/test/browser_bug594131.js
@@ -38,16 +38,18 @@ function test() {
let backgroundPref = "browser.tabs.loadBookmarksInBackground";
let newTab = gBrowser.addTab("http://example.com");
waitForExplicitFinish();
newTab.linkedBrowser.addEventListener("load", mainPart, true);
Services.prefs.setBoolPref(backgroundPref, true);
function mainPart() {
+ newTab.linkedBrowser.removeEventListener("load", mainPart, true);
+
gBrowser.pinTab(newTab);
gBrowser.selectedTab = newTab;
openUILinkIn("http://example.org/", "current");
isnot(gBrowser.selectedTab, newTab, "shouldn't load in background");
if (Services.prefs.prefHasUserValue(backgroundPref))
Services.prefs.clearUserPref(backgroundPref);
--- a/browser/base/content/test/browser_bug596687.js
+++ b/browser/base/content/test/browser_bug596687.js
@@ -1,20 +1,26 @@
function test() {
var tab = gBrowser.addTab(null, {skipAnimation: true});
gBrowser.selectedTab = tab;
var gotTabAttrModified = false;
var gotTabClose = false;
- tab.addEventListener("TabClose", function () {
+ function onTabClose() {
gotTabClose = true;
+ tab.addEventListener("TabAttrModified", onTabAttrModified, false);
+ }
- tab.addEventListener("TabAttrModified", function () {
- gotTabAttrModified = true;
- }, false);
- }, false);
+ function onTabAttrModified() {
+ gotTabAttrModified = true;
+ }
+
+ tab.addEventListener("TabClose", onTabClose, false);
gBrowser.removeTab(tab);
ok(gotTabClose, "should have got the TabClose event");
ok(!gotTabAttrModified, "shouldn't have got the TabAttrModified event after TabClose");
+
+ tab.removeEventListener("TabClose", onTabClose, false);
+ tab.removeEventListener("TabAttrModified", onTabAttrModified, false);
}
--- a/browser/base/content/test/browser_bug609700.js
+++ b/browser/base/content/test/browser_bug609700.js
@@ -3,16 +3,17 @@ function test() {
Services.ww.registerNotification(function (aSubject, aTopic, aData) {
if (aTopic == "domwindowopened") {
Services.ww.unregisterNotification(arguments.callee);
ok(true, "duplicateTabIn opened a new window");
aSubject.addEventListener("load", function () {
+ aSubject.removeEventListener("load", arguments.callee, false);
executeSoon(function () {
aSubject.close();
finish();
});
}, false);
}
});
--- a/browser/base/content/test/browser_customize_popupNotification.js
+++ b/browser/base/content/test/browser_customize_popupNotification.js
@@ -5,16 +5,18 @@ http://creativecommons.org/publicdomain/
function test() {
waitForExplicitFinish();
var newWin = openDialog(location, "", "chrome,all,dialog=no", "about:blank");
registerCleanupFunction(function () {
newWin.close();
});
newWin.addEventListener("load", function test_win_onLoad() {
+ newWin.removeEventListener("load", test_win_onLoad, false);
+
// Remove the URL bar
newWin.gURLBar.parentNode.removeChild(newWin.gURLBar);
waitForFocus(function () {
let PN = newWin.PopupNotifications;
try {
let notification = PN.show(newWin.gBrowser.selectedBrowser, "some-notification", "Some message");
ok(notification, "showed the notification");
deleted file mode 100644
--- a/browser/base/content/test/browser_inspector_domPanel.js
+++ /dev/null
@@ -1,171 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Inspector DOM Panel Tests.
- *
- * The Initial Developer of the Original Code is
- * The Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2010
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Rob Campbell <rcampbell@mozilla.com>
- * Mihai Șucan <mihai.sucan@gmail.com>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-let doc;
-let testGen;
-let newProperty;
-
-function createDocument()
-{
- doc.body.innerHTML = '<div id="first" style="{ margin: 10em; ' +
- 'font-size: 14pt; font-family: helvetica, sans-serif; color: #AAA}">\n' +
- '<h1>Some header text</h1>\n' +
- '<p id="salutation" style="{font-size: 12pt}">hi.</p>\n' +
- '<p id="body" style="{font-size: 12pt}">I am a test-case. This text exists ' +
- 'solely to provide some things to <span style="{color: yellow}">' +
- 'highlight</span> and <span style="{font-weight: bold}">count</span> ' +
- 'DOM list-items in the box at right. If you are reading this, ' +
- 'you should go do something else instead. Maybe read a book. Or better ' +
- 'yet, write some test-cases for another bit of code. ' +
- '<span style="{font-style: italic}">Maybe more inspector test-cases!</span></p>\n' +
- '<p id="closing">end transmission</p>\n' +
- '</div>';
- doc.title = "Inspector DOM Test";
- Services.obs.addObserver(runDOMTests, "inspector-opened", false);
- InspectorUI.openInspectorUI();
-}
-
-function nodeGenerator()
-{
- let body = doc.body;
- newProperty = "rand" + Date.now();
- body[newProperty] = Math.round(Math.random() * 100);
- InspectorUI.inspectNode(body);
- yield;
-
- let h1 = doc.querySelector("h1");
- newProperty = "rand2" + Date.now();
- h1[newProperty] = "test" + Math.random();
- InspectorUI.inspectNode(h1);
- yield;
-
- let first = doc.getElementById("first");
- newProperty = "rand3" + Date.now();
- first[newProperty] = null;
- InspectorUI.inspectNode(first);
- yield;
-
- let closing = doc.getElementById("closing");
- newProperty = "bazbaz" + Date.now();
- closing[newProperty] = false;
- InspectorUI.inspectNode(closing);
- yield;
-}
-
-function runDOMTests()
-{
- InspectorUI._log("runDOMtests");
- Services.obs.removeObserver(runDOMTests, "inspector-opened", false);
- document.addEventListener("popupshown", performTestComparisons, false);
- InspectorUI.stopInspecting();
- testGen = nodeGenerator();
- testGen.next();
-}
-
-function findInDOMPanel(aString)
-{
- let treeView = InspectorUI.domTreeView;
- let row;
-
- for (let i = 0, n = treeView.rowCount; i < n; i++) {
- row = treeView.getCellText(i, 0);
- if (row && row.indexOf(aString) != -1) {
- return true;
- }
- }
-
- return false;
-}
-
-function performTestComparisons(evt)
-{
- InspectorUI._log("performTestComparisons");
- if (evt.target.id != "highlighter-panel")
- return true;
-
- let selection = InspectorUI.selection;
-
- ok(selection, "selection");
- ok(InspectorUI.isDOMPanelOpen, "DOM panel is open?");
- ok(InspectorUI.highlighter.isHighlighting, "panel is highlighting");
-
- let value = selection[newProperty];
- if (typeof value == "string") {
- value = '"' + value + '"';
- }
-
- ok(findInDOMPanel(newProperty + ': ' + value),
- "domPanel shows the correct value for " + newProperty);
-
- ok(findInDOMPanel('tagName: "' + selection.tagName + '"'),
- "domPanel shows the correct tagName");
-
- if (selection.id) {
- ok(findInDOMPanel('id: "' + selection.id + '"'),
- "domPanel shows the correct id");
- }
-
- try {
- testGen.next();
- } catch(StopIteration) {
- document.removeEventListener("popupshown", performTestComparisons, false);
- finishUp();
- }
-}
-
-function finishUp() {
- InspectorUI.closeInspectorUI();
- gBrowser.removeCurrentTab();
- finish();
-}
-
-function test()
-{
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function() {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
- doc = content.document;
- waitForFocus(createDocument, content);
- }, true);
-
- content.location = "data:text/html,basic tests for inspector";
-}
-
--- a/browser/base/content/test/browser_inspector_highlighter.js
+++ b/browser/base/content/test/browser_inspector_highlighter.js
@@ -92,21 +92,26 @@ function runSelectionTests()
function performTestComparisons(evt)
{
if (evt.target.id != "highlighter-panel")
return true;
document.removeEventListener("popupshown", performTestComparisons, false);
is(h1, InspectorUI.selection, "selection matches node");
ok(InspectorUI.highlighter.isHighlighting, "panel is highlighting");
is(InspectorUI.highlighter.highlitNode, h1, "highlighter matches selection");
- executeSoon(finishUp);
+
+ Services.obs.addObserver(finishUp, "inspector-closed", false);
+ InspectorUI.closeInspectorUI();
}
function finishUp() {
- InspectorUI.closeInspectorUI();
+ Services.obs.removeObserver(finishUp, "inspector-closed", false);
+
+ ok(!InspectorUI.highlighter.isHighlighting, "panel is not highlighting");
+ doc = h1 = null;
gBrowser.removeCurrentTab();
finish();
}
function test()
{
waitForExplicitFinish();
gBrowser.selectedTab = gBrowser.addTab();
--- a/browser/base/content/test/browser_inspector_initialization.js
+++ b/browser/base/content/test/browser_inspector_initialization.js
@@ -49,26 +49,22 @@ function startInspectorTests()
function runInspectorTests()
{
Services.obs.removeObserver(runInspectorTests, "inspector-opened", false);
Services.obs.addObserver(finishInspectorTests, "inspector-closed", false);
let iframe = document.getElementById("inspector-tree-iframe");
is(InspectorUI.treeIFrame, iframe, "Inspector IFrame matches");
ok(InspectorUI.inspecting, "Inspector is highlighting");
ok(InspectorUI.isTreePanelOpen, "Inspector Tree Panel is open");
- ok(InspectorUI.isStylePanelOpen, "Inspector Style Panel is open");
- ok(InspectorUI.isDOMPanelOpen, "Inspector DOM Panel is open");
InspectorUI.closeInspectorUI();
}
function finishInspectorTests()
{
Services.obs.removeObserver(finishInspectorTests, "inspector-closed", false);
- ok(!InspectorUI.isDOMPanelOpen, "Inspector DOM Panel is closed");
- ok(!InspectorUI.isStylePanelOpen, "Inspector Style Panel is closed");
ok(!InspectorUI.isTreePanelOpen, "Inspector Tree Panel is closed");
ok(!InspectorUI.inspecting, "Inspector is not highlighting");
gBrowser.removeCurrentTab();
finish();
}
function test()
{
deleted file mode 100644
--- a/browser/base/content/test/browser_inspector_stylePanel.js
+++ /dev/null
@@ -1,124 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Inspector Style Panel Tests.
- *
- * The Initial Developer of the Original Code is
- * The Mozilla Foundation.
- * Portions created by the Initial Developer are Copyright (C) 2010
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Rob Campbell <rcampbell@mozilla.com> (original author)
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-let doc;
-let spans;
-let testGen;
-
-function createDocument()
-{
- doc.body.innerHTML = '<div id="first" style="{ margin: 10em; ' +
- 'font-size: 14pt; font-family: helvetica, sans-serif; color: #AAA}">\n' +
- '<h1>Some header text</h1>\n' +
- '<p id="salutation" style="{font-size: 12pt}">hi.</p>\n' +
- '<p id="body" style="{font-size: 12pt}">I am a test-case. This text exists ' +
- 'solely to provide some things to <span style="{color: yellow}">' +
- 'highlight</span> and <span style="{font-weight: bold}">count</span> ' +
- 'style list-items in the box at right. If you are reading this, ' +
- 'you should go do something else instead. Maybe read a book. Or better ' +
- 'yet, write some test-cases for another bit of code. ' +
- '<span style="{font-style: italic}">Maybe more inspector test-cases!</span></p>\n' +
- '<p id="closing">end transmission</p>\n' +
- '</div>';
- doc.title = "Inspector Style Test";
- setupStyleTests();
-}
-
-function setupStyleTests()
-{
- spans = doc.querySelectorAll("span");
- ok(spans, "captain, we have the spans");
- Services.obs.addObserver(runStyleTests, "inspector-opened", false);
- InspectorUI.openInspectorUI();
-}
-
-function spanGenerator()
-{
- for (var i = 0; i < spans.length; ++i) {
- InspectorUI.inspectNode(spans[i]);
- yield;
- }
-}
-
-function runStyleTests()
-{
- Services.obs.removeObserver(runStyleTests, "inspector-opened", false);
- document.addEventListener("popupshown", performTestComparisons, false);
- InspectorUI.stopInspecting();
- testGen = spanGenerator();
- testGen.next();
-}
-
-function performTestComparisons(evt)
-{
- if (evt.target.id != "highlighter-panel")
- return true;
-
- ok(InspectorUI.selection, "selection");
- ok(InspectorUI.isStylePanelOpen, "style panel is open?");
- ok(InspectorUI.highlighter.isHighlighting, "panel is highlighting");
- ok(InspectorUI.styleBox.itemCount > 0, "styleBox has items");
-
- try {
- testGen.next();
- } catch(StopIteration) {
- document.removeEventListener("popupshown", performTestComparisons, false);
- finishUp();
- }
-}
-
-function finishUp() {
- InspectorUI.closeInspectorUI();
- gBrowser.removeCurrentTab();
- finish();
-}
-
-function test()
-{
- waitForExplicitFinish();
- gBrowser.selectedTab = gBrowser.addTab();
- gBrowser.selectedBrowser.addEventListener("load", function() {
- gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
- doc = content.document;
- waitForFocus(createDocument, content);
- }, true);
-
- content.location = "data:text/html,basic tests for inspector";
-}
-
--- a/browser/base/content/test/browser_inspector_tab_switch.js
+++ b/browser/base/content/test/browser_inspector_tab_switch.js
@@ -55,93 +55,93 @@ function inspectorTabOpen1()
function inspectorUIOpen1()
{
Services.obs.removeObserver(inspectorUIOpen1, "inspector-opened", false);
// Make sure the inspector is open.
ok(InspectorUI.inspecting, "Inspector is highlighting");
ok(InspectorUI.isTreePanelOpen, "Inspector Tree Panel is open");
- ok(InspectorUI.isStylePanelOpen, "Inspector Style Panel is open");
ok(!InspectorStore.isEmpty(), "InspectorStore is not empty");
is(InspectorStore.length, 1, "InspectorStore.length = 1");
// Highlight a node.
div = content.document.getElementsByTagName("div")[0];
InspectorUI.inspectNode(div);
is(InspectorUI.selection, div, "selection matches the div element");
// Open the second tab.
tab2 = gBrowser.addTab();
gBrowser.selectedTab = tab2;
+
gBrowser.selectedBrowser.addEventListener("load", function(evt) {
gBrowser.selectedBrowser.removeEventListener(evt.type, arguments.callee,
true);
waitForFocus(inspectorTabOpen2, content);
}, true);
content.location = "data:text/html,<p>tab 2: the inspector should close now";
}
function inspectorTabOpen2()
{
// Make sure the inspector is closed.
ok(!InspectorUI.inspecting, "Inspector is not highlighting");
ok(!InspectorUI.isPanelOpen, "Inspector Tree Panel is closed");
- ok(!InspectorUI.isStylePanelOpen, "Inspector Style Panel is closed");
is(InspectorStore.length, 1, "InspectorStore.length = 1");
// Activate the inspector again.
+ executeSoon(function() {
Services.obs.addObserver(inspectorUIOpen2, "inspector-opened", false);
- InspectorUI.openInspectorUI();
+ InspectorUI.openInspectorUI();
+ });
}
function inspectorUIOpen2()
{
Services.obs.removeObserver(inspectorUIOpen2, "inspector-opened", false);
// Make sure the inspector is open.
ok(InspectorUI.inspecting, "Inspector is highlighting");
ok(InspectorUI.isTreePanelOpen, "Inspector Tree Panel is open");
- ok(InspectorUI.isStylePanelOpen, "Inspector Style Panel is open");
is(InspectorStore.length, 2, "InspectorStore.length = 2");
// Disable highlighting.
InspectorUI.toggleInspection();
ok(!InspectorUI.inspecting, "Inspector is not highlighting");
// Switch back to tab 1.
- Services.obs.addObserver(inspectorFocusTab1, "inspector-opened", false);
- gBrowser.selectedTab = tab1;
+ executeSoon(function() {
+ Services.obs.addObserver(inspectorFocusTab1, "inspector-opened", false);
+ gBrowser.selectedTab = tab1;
+ });
}
function inspectorFocusTab1()
{
Services.obs.removeObserver(inspectorFocusTab1, "inspector-opened", false);
// Make sure the inspector is still open.
ok(InspectorUI.inspecting, "Inspector is highlighting");
ok(InspectorUI.isTreePanelOpen, "Inspector Tree Panel is open");
- ok(InspectorUI.isStylePanelOpen, "Inspector Style Panel is open");
is(InspectorStore.length, 2, "InspectorStore.length = 2");
is(InspectorUI.selection, div, "selection matches the div element");
// Switch back to tab 2.
Services.obs.addObserver(inspectorFocusTab2, "inspector-opened", false);
gBrowser.selectedTab = tab2;
}
function inspectorFocusTab2()
{
Services.obs.removeObserver(inspectorFocusTab2, "inspector-opened", false);
// Make sure the inspector is still open.
ok(!InspectorUI.inspecting, "Inspector is not highlighting");
ok(InspectorUI.isTreePanelOpen, "Inspector Tree Panel is open");
- ok(InspectorUI.isStylePanelOpen, "Inspector Style Panel is open");
is(InspectorStore.length, 2, "InspectorStore.length = 2");
isnot(InspectorUI.selection, div, "selection does not match the div element");
// Remove tab 1.
tab1window = gBrowser.getBrowserForTab(tab1).contentWindow;
tab1window.addEventListener("pagehide", inspectorTabUnload1, false);
gBrowser.removeTab(tab1);
}
@@ -149,17 +149,16 @@ function inspectorFocusTab2()
function inspectorTabUnload1(evt)
{
tab1window.removeEventListener(evt.type, arguments.callee, false);
tab1window = tab1 = tab2 = div = null;
// Make sure the Inspector is still open and that the state is correct.
ok(!InspectorUI.inspecting, "Inspector is not highlighting");
ok(InspectorUI.isTreePanelOpen, "Inspector Tree Panel is open");
- ok(InspectorUI.isStylePanelOpen, "Inspector Style Panel is open");
is(InspectorStore.length, 1, "InspectorStore.length = 1");
InspectorUI.closeInspectorUI();
gBrowser.removeCurrentTab();
finish();
}
function test()
--- a/browser/base/content/test/browser_page_style_menu.js
+++ b/browser/base/content/test/browser_page_style_menu.js
@@ -1,14 +1,17 @@
function test() {
waitForExplicitFinish();
var tab = gBrowser.addTab();
gBrowser.selectedTab = tab;
- tab.linkedBrowser.addEventListener("load", checkPageStyleMenu, true);
+ tab.linkedBrowser.addEventListener("load", function () {
+ tab.linkedBrowser.removeEventListener("load", arguments.callee, true);
+ checkPageStyleMenu();
+ }, true);
let rootDir = getRootDirectory(gTestPath);
content.location = rootDir + "page_style_sample.html";
}
function checkPageStyleMenu() {
var menupopup = document.getElementById("pageStyleMenu")
.getElementsByTagName("menupopup")[0];
stylesheetFillPopup(menupopup);
--- a/browser/base/content/test/browser_scratchpad_files.js
+++ b/browser/base/content/test/browser_scratchpad_files.js
@@ -1,16 +1,12 @@
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cu = Components.utils;
-
Cu.import("resource://gre/modules/NetUtil.jsm");
Cu.import("resource://gre/modules/FileUtils.jsm");
// Reference to the Scratchpad chrome window object.
let gScratchpadWindow;
// Reference to the Scratchpad object.
let gScratchpad;
--- a/browser/base/content/test/browser_tabMatchesInAwesomebar.js
+++ b/browser/base/content/test/browser_tabMatchesInAwesomebar.js
@@ -31,18 +31,16 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
-
const TEST_URL_BASES = [
"http://example.org/browser/browser/base/content/test/dummy_page.html#tabmatch",
"http://example.org/browser/browser/base/content/test/moz.png#tabmatch"
];
var gPrivateBrowsing = Cc["@mozilla.org/privatebrowsing;1"].
getService(Ci.nsIPrivateBrowsingService);
var gController = Cc["@mozilla.org/autocomplete/controller;1"].
--- a/browser/base/content/test/browser_tabfocus.js
+++ b/browser/base/content/test/browser_tabfocus.js
@@ -19,16 +19,19 @@ function test() {
var loadCount = 0;
function check()
{
// wait for both tabs to load
if (++loadCount != 2)
return;
+ browser1.removeEventListener("load", check, true);
+ browser2.removeEventListener("load", check, true);
+
window.focus();
_browser_tabfocus_test_lastfocus = gURLBar;
_browser_tabfocus_test_lastfocuswindow = window;
window.addEventListener("focus", _browser_tabfocus_test_eventOccured, true);
window.addEventListener("blur", _browser_tabfocus_test_eventOccured, true);
@@ -134,18 +137,18 @@ function test() {
EventUtils.synthesizeKey("VK_F6", { });
is(fm.focusedWindow, window, "switch document forward again with f6");
browser1.style.MozUserFocus = "ignore";
browser1.clientWidth;
EventUtils.synthesizeKey("VK_F6", { });
is(fm.focusedWindow, window, "switch document forward again with f6 when browser non-focusable");
- window.addEventListener("focus", _browser_tabfocus_test_eventOccured, true);
- window.addEventListener("blur", _browser_tabfocus_test_eventOccured, true);
+ window.removeEventListener("focus", _browser_tabfocus_test_eventOccured, true);
+ window.removeEventListener("blur", _browser_tabfocus_test_eventOccured, true);
// next, check whether navigating forward, focusing the urlbar and then
// navigating back maintains the focus in the urlbar.
browser1.addEventListener("pageshow", _browser_tabfocus_navigation_test_eventOccured, true);
button1.focus();
browser1.contentWindow.location = testPage3;
}
@@ -181,16 +184,17 @@ function _browser_tabfocus_navigation_te
if (event.target instanceof Document) {
var contentwin = event.target.defaultView;
if (contentwin.location.toString().indexOf("3") > 0) {
// just moved forward, so focus the urlbar and go back
gURLBar.focus();
setTimeout(function () contentwin.history.back(), 0);
}
else if (contentwin.location.toString().indexOf("2") > 0) {
+ event.currentTarget.removeEventListener("pageshow", _browser_tabfocus_navigation_test_eventOccured, true);
is(window.document.activeElement, gURLBar.inputField, "urlbar still focused after navigating back");
gBrowser.removeCurrentTab();
gBrowser.removeCurrentTab();
finish();
}
}
}
--- a/browser/base/content/test/browser_typeAheadFind.js
+++ b/browser/base/content/test/browser_typeAheadFind.js
@@ -37,16 +37,17 @@
let testWindow = null;
function test() {
waitForExplicitFinish();
testWindow = OpenBrowserWindow();
testWindow.addEventListener("load", function() {
+ testWindow.removeEventListener("load", arguments.callee, false);
ok(true, "Load listener called");
executeSoon(function() {
let selectedBrowser = testWindow.gBrowser.selectedBrowser;
selectedBrowser.addEventListener("pageshow", function() {
selectedBrowser.removeEventListener("pageshow", arguments.callee,
false);
ok(true, "pageshow listener called");
--- a/browser/base/content/test/browser_visibleTabs_bookmarkAllTabs.js
+++ b/browser/base/content/test/browser_visibleTabs_bookmarkAllTabs.js
@@ -86,17 +86,18 @@ function test() {
is(origTab.hidden, false, "and it's not hidden -- visible!");
finish();
}, true);
}
function Disabled() {
document.popupNode = gBrowser.selectedTab;
TabContextMenu.updateContextMenu(document.getElementById("tabContextMenu"));
- let command = document.getElementById("Browser:BookmarkAllTabs");
- return command.hasAttribute("disabled") && command.getAttribute("disabled") === "true";
+ TabContextMenu.contextTab = null;
+ return document.getElementById("Browser:BookmarkAllTabs").getAttribute("disabled") == "true";
}
function Hidden() {
document.popupNode = gBrowser.selectedTab;
TabContextMenu.updateContextMenu(document.getElementById("tabContextMenu"));
+ TabContextMenu.contextTab = null;
return document.getElementById("context_bookmarkAllTabs").hidden;
}
--- a/browser/base/content/test/browser_visibleTabs_contextMenu.js
+++ b/browser/base/content/test/browser_visibleTabs_contextMenu.js
@@ -39,51 +39,49 @@ function test() {
// There should be one tab when we start the test
let [origTab] = gBrowser.visibleTabs;
is(gBrowser.visibleTabs.length, 1, "there is one visible tab");
let testTab = gBrowser.addTab();
is(gBrowser.visibleTabs.length, 2, "there are now two visible tabs");
// Check the context menu with two tabs
popup(origTab);
- is(TabContextMenu.contextTab, origTab, "TabContextMenu context is the original tab");
is(document.getElementById("context_closeTab").disabled, false, "Close Tab is enabled");
is(document.getElementById("context_reloadAllTabs").disabled, false, "Reload All Tabs is enabled");
// Hide the original tab.
gBrowser.selectedTab = testTab;
gBrowser.showOnlyTheseTabs([testTab]);
is(gBrowser.visibleTabs.length, 1, "now there is only one visible tab");
// Check the context menu with one tab.
popup(testTab);
- is(TabContextMenu.contextTab, testTab, "TabContextMenu context is the test tab");
is(document.getElementById("context_closeTab").disabled, false, "Close Tab is enabled when more than one tab exists");
is(document.getElementById("context_reloadAllTabs").disabled, true, "Reload All Tabs is disabled");
// Add a tab that will get pinned
// So now there's one pinned tab, one visible unpinned tab, and one hidden tab
let pinned = gBrowser.addTab();
gBrowser.pinTab(pinned);
is(gBrowser.visibleTabs.length, 2, "now there are two visible tabs");
// Check the context menu on the unpinned visible tab
popup(testTab);
- is(TabContextMenu.contextTab, testTab, "TabContextMenu context is again the test tab");
is(document.getElementById("context_closeOtherTabs").disabled, true, "Close Other Tabs is disabled");
// Show all tabs
let allTabs = [tab for each (tab in gBrowser.tabs)];
gBrowser.showOnlyTheseTabs(allTabs);
// Check the context menu now
popup(testTab);
- is(TabContextMenu.contextTab, testTab, "TabContextMenu context is yet again the test tab");
is(document.getElementById("context_closeOtherTabs").disabled, false, "Close Other Tabs is enabled");
gBrowser.removeTab(testTab);
gBrowser.removeTab(pinned);
}
function popup(tab) {
document.popupNode = tab;
TabContextMenu.updateContextMenu(document.getElementById("tabContextMenu"));
-}
\ No newline at end of file
+ is(TabContextMenu.contextTab, tab, "TabContextMenu context is the expected tab");
+ TabContextMenu.contextTab = null;
+}
--- a/browser/base/content/test/tabview/Makefile.in
+++ b/browser/base/content/test/tabview/Makefile.in
@@ -54,16 +54,17 @@ include $(topsrcdir)/config/rules.mk
browser_tabview_bug587351.js \
browser_tabview_bug587503.js \
browser_tabview_bug587990.js \
browser_tabview_bug588265.js \
browser_tabview_bug589324.js \
browser_tabview_bug590606.js \
browser_tabview_bug591706.js \
browser_tabview_bug594958.js \
+ browser_tabview_bug595020.js \
browser_tabview_bug595191.js \
browser_tabview_bug595436.js \
browser_tabview_bug595518.js \
browser_tabview_bug595521.js \
browser_tabview_bug595560.js \
browser_tabview_bug595601.js \
browser_tabview_bug595804.js \
browser_tabview_bug595930.js \
@@ -135,20 +136,23 @@ include $(topsrcdir)/config/rules.mk
browser_tabview_bug641802.js \
browser_tabview_bug642793.js \
browser_tabview_bug643392.js \
browser_tabview_bug644097.js \
browser_tabview_bug645653.js \
browser_tabview_bug648882.js \
browser_tabview_bug649006.js \
browser_tabview_bug649307.js \
+ browser_tabview_bug649319.js \
browser_tabview_bug650573.js \
browser_tabview_bug651311.js \
browser_tabview_bug654941.js \
+ browser_tabview_bug655269.js \
browser_tabview_bug656778.js \
+ browser_tabview_bug656913.js \
browser_tabview_dragdrop.js \
browser_tabview_exit_button.js \
browser_tabview_expander.js \
browser_tabview_firstrun_pref.js \
browser_tabview_group.js \
browser_tabview_launch.js \
browser_tabview_multiwindow_search.js \
browser_tabview_orphaned_tabs.js \
new file mode 100644
--- /dev/null
+++ b/browser/base/content/test/tabview/browser_tabview_bug595020.js
@@ -0,0 +1,37 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
+
+let stateStartup = {windows:[
+ {tabs:[{entries:[{url:"about:home"}]}], extData:{"tabview-last-session-group-name":"title"}}
+]};
+
+function test() {
+ let assertWindowTitle = function (win, title) {
+ let browser = win.gBrowser.tabs[0].linkedBrowser;
+ let winTitle = win.gBrowser.getWindowTitleForBrowser(browser);
+ is(winTitle.indexOf(title), 0, "title starts with '" + title + "'");
+ };
+
+ let testGroupNameChange = function (win) {
+ showTabView(function () {
+ let cw = win.TabView.getContentWindow();
+ let groupItem = cw.GroupItems.groupItems[0];
+ groupItem.setTitle("new-title");
+
+ hideTabView(function () {
+ assertWindowTitle(win, "new-title");
+ waitForFocus(finish);
+ }, win);
+ }, win);
+ };
+
+ waitForExplicitFinish();
+
+ newWindowWithState(stateStartup, function (win) {
+ registerCleanupFunction(function () win.close());
+ assertWindowTitle(win, "title");
+ testGroupNameChange(win);
+ });
+}
--- a/browser/base/content/test/tabview/browser_tabview_bug595804.js
+++ b/browser/base/content/test/tabview/browser_tabview_bug595804.js
@@ -77,16 +77,18 @@ function zoomInAndOut(transitionsExpecte
};
let onShownAgain = function() {
contentWindow.removeEventListener("tabviewshown", onShownAgain, false);
if (transitionsExpected)
ok(transitioned >= 0, "There can be transitions");
else
ok(!transitioned, "There should have been no transitions");
+
+ contentWindow.document.removeEventListener("transitionend", onTransitionEnd, false);
callback();
};
contentWindow.addEventListener("tabviewhidden", onHidden, false);
contentWindow.addEventListener("tabviewshown", onShownAgain, false);
// get this party started by hiding tab view
TabView.toggle();
--- a/browser/base/content/test/tabview/browser_tabview_bug598375.js
+++ b/browser/base/content/test/tabview/browser_tabview_bug598375.js
@@ -6,14 +6,16 @@ function test() {
newWindowWithTabView(function (win) {
registerCleanupFunction(function () win.close());
let cw = win.TabView.getContentWindow();
let groupItem = cw.GroupItems.groupItems[0];
groupItem.setBounds(new cw.Rect(cw.innerWidth - 200, 0, 200, 200));
- whenTabViewIsHidden(finish, win);
+ whenTabViewIsHidden(function () waitForFocus(finish), win);
- let button = cw.document.getElementById("exit-button");
- EventUtils.synthesizeMouseAtCenter(button, {}, cw);
+ waitForFocus(function () {
+ let button = cw.document.getElementById("exit-button");
+ EventUtils.synthesizeMouseAtCenter(button, {}, cw);
+ }, cw);
});
}
--- a/browser/base/content/test/tabview/browser_tabview_bug625195.js
+++ b/browser/base/content/test/tabview/browser_tabview_bug625195.js
@@ -44,10 +44,12 @@ function test() {
let newGroup = contentWindow.GroupItems.newGroup();
newGroup.newTab();
});
}
function popup(tab) {
document.popupNode = tab;
TabContextMenu.updateContextMenu(document.getElementById("tabContextMenu"));
+ is(TabContextMenu.contextTab, tab, "TabContextMenu context is the expected tab");
+ TabContextMenu.contextTab = null;
}
--- a/browser/base/content/test/tabview/browser_tabview_bug626791.js
+++ b/browser/base/content/test/tabview/browser_tabview_bug626791.js
@@ -134,46 +134,45 @@ function test() {
next();
});
}
let tests = [testNameGroup, testDragToCreateGroup, testCreateOrphan,
testDragToCreateOrphan, testReAddingAfterRemoval];
let next = function () {
+ if (win)
+ win.close();
+
let test = tests.shift();
if (!test) {
finish();
return;
}
- if (win)
- win.close();
-
TabView.firstUseExperienced = false;
let onLoad = function (newWin) {
win = newWin;
removeToolbarButton();
- }
+ };
let onShow = function () {
cw = win.TabView.getContentWindow();
let groupItem = cw.GroupItems.groupItems[0];
groupItem.setSize(200, 200, true);
groupItem.setUserSize();
SimpleTest.waitForFocus(function () {
assertToolbarButtonNotExists();
test();
}, cw);
- }
+ };
newWindowWithTabView(onShow, onLoad);
}
waitForExplicitFinish();
- registerCleanupFunction(function () win && win.close());
next();
}
--- a/browser/base/content/test/tabview/browser_tabview_bug627288.js
+++ b/browser/base/content/test/tabview/browser_tabview_bug627288.js
@@ -74,20 +74,17 @@ function test() {
cw = TabView.getContentWindow();
testReconnectWithSameUrl();
});
}
// ----------
function whenTabAttrModified(tab, callback) {
let onModified = function (event) {
- if (tab === event.target) {
- container.removeEventListener('TabAttrModified', onModified, false);
- // we need executeSoon here because the tabItem also listens for the
- // onTabAttrModified event. so this is to make sure the tabItem logic
- // is executed before the test logic.
- executeSoon(callback);
- }
+ tab.removeEventListener(event.type, onModified, false);
+ // we need executeSoon here because the tabItem also listens for the
+ // TabAttrModified event. so this is to make sure the tabItem logic
+ // is executed before the test logic.
+ executeSoon(callback);
}
- let container = gBrowser.tabContainer;
- container.addEventListener('TabAttrModified', onModified, false);
+ tab.addEventListener("TabAttrModified", onModified, false);
}
--- a/browser/base/content/test/tabview/browser_tabview_bug628061.js
+++ b/browser/base/content/test/tabview/browser_tabview_bug628061.js
@@ -21,17 +21,33 @@ let state = {
'{"1":{"bounds":{"left":15,"top":5,"width":280,"height":232},"id":1},' +
'"2":{"bounds":{"left":309,"top":5,"width":267,"height":226},"id":2}}'
}
}]
};
function test() {
waitForExplicitFinish();
+ testOne();
+}
+function testOne() {
+ newWindowWithTabView(
+ function(win) {
+ testTwo();
+ win.close();
+ },
+ function(win) {
+ registerCleanupFunction(function() win.close());
+ is(win.document.getElementById("tabviewGroupsNumber").getAttribute("groups"),
+ "1", "There is one group");
+ });
+}
+
+function testTwo() {
newWindowWithState(state, function(win) {
registerCleanupFunction(function() win.close());
- is(win.document.getElementById("tabviewGroupsNumber").getAttribute("groups"),
+ is(win.document.getElementById("tabviewGroupsNumber").getAttribute("groups"),
"2", "There are two groups");
waitForFocus(finish);
});
}
--- a/browser/base/content/test/tabview/browser_tabview_bug630102.js
+++ b/browser/base/content/test/tabview/browser_tabview_bug630102.js
@@ -1,64 +1,52 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
function test() {
- waitForExplicitFinish();
+ let win, contentWindow, originalTab, newTab1, newTab2;
- let originalTab = gBrowser.visibleTabs[0];
- let newTab1 = gBrowser.addTab("about:blank", { skipAnimation: true });
- let newTab2 = gBrowser.addTab("about:blank", { skipAnimation: true });
-
- gBrowser.pinTab(newTab1);
-
- let contentWindow;
-
- let partOne = function() {
- window.removeEventListener("tabviewshown", partOne, false);
-
- contentWindow = document.getElementById("tab-view").contentWindow;
- is(contentWindow.GroupItems.groupItems.length, 1, "There is only one group item");
-
+ let partOne = function () {
let groupItem = contentWindow.GroupItems.groupItems[0];
let tabItems = groupItem.getChildren();
is(tabItems.length, 2, "There are two tab items in that group item");
is(tabItems[0].tab, originalTab, "The first tab item is linked to the first tab");
is(tabItems[1].tab, newTab2, "The second tab item is linked to the second tab");
- window.addEventListener("tabviewhidden", partTwo, false);
- TabView.toggle();
- };
-
- let partTwo = function() {
- window.removeEventListener("tabviewhidden", partTwo, false);
-
- gBrowser.unpinTab(newTab1);
-
- window.addEventListener("tabviewshown", partThree, false);
- TabView.toggle();
+ hideTabView(partTwo, win);
};
- let partThree = function() {
- window.removeEventListener("tabviewshown", partThree, false);
+ let partTwo = function () {
+ win.gBrowser.unpinTab(newTab1);
+ showTabView(partThree, win);
+ };
+ let partThree = function () {
let tabItems = contentWindow.GroupItems.groupItems[0].getChildren();
is(tabItems.length, 3, "There are three tab items in that group item");
- is(tabItems[0].tab, gBrowser.visibleTabs[0], "The first tab item is linked to the first tab");
- is(tabItems[1].tab, gBrowser.visibleTabs[1], "The second tab item is linked to the second tab");
- is(tabItems[2].tab, gBrowser.visibleTabs[2], "The third tab item is linked to the third tab");
-
- window.addEventListener("tabviewhidden", endGame, false);
- TabView.toggle();
- };
-
- let endGame = function() {
- window.removeEventListener("tabviewhidden", endGame, false);
-
- gBrowser.removeTab(newTab1);
- gBrowser.removeTab(newTab2);
+ is(tabItems[0].tab, win.gBrowser.tabs[0], "The first tab item is linked to the first tab");
+ is(tabItems[1].tab, win.gBrowser.tabs[1], "The second tab item is linked to the second tab");
+ is(tabItems[2].tab, win.gBrowser.tabs[2], "The third tab item is linked to the third tab");
finish();
};
- window.addEventListener("tabviewshown", partOne, false);
- TabView.toggle();
+ let onLoad = function (tvwin) {
+ win = tvwin;
+ registerCleanupFunction(function () win.close());
+
+ for (let i = 0; i < 2; i++)
+ win.gBrowser.loadOneTab("about:blank", {inBackground: true});
+
+ [originalTab, newTab1, newTab2] = win.gBrowser.tabs;
+ win.gBrowser.pinTab(newTab1);
+ };
+
+ let onShow = function () {
+ contentWindow = win.TabView.getContentWindow();
+ is(contentWindow.GroupItems.groupItems.length, 1, "There is only one group item");
+
+ partOne();
+ };
+
+ waitForExplicitFinish();
+ newWindowWithTabView(onShow, onLoad);
}
new file mode 100644
--- /dev/null
+++ b/browser/base/content/test/tabview/browser_tabview_bug649319.js
@@ -0,0 +1,88 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+function test() {
+ waitForExplicitFinish();
+
+ newWindowWithTabView(function (win) {
+ registerCleanupFunction(function () win.close());
+ waitForFocus(function () testScenarios(win));
+ });
+}
+
+function testScenarios(win) {
+ let simulateDragDrop = function (target) {
+ EventUtils.synthesizeMouseAtCenter(target, {type: "mousedown"}, cw);
+ EventUtils.synthesizeMouse(target, 40, 20, {type: "mousemove"}, cw);
+ EventUtils.synthesizeMouse(target, 80, 20, {type: "mouseup"}, cw);
+ }
+
+ let dragOutOfGroup = function (target) {
+ EventUtils.synthesizeMouseAtCenter(target, {type: "mousedown"}, cw);
+ EventUtils.synthesizeMouse(target, 600, 5, {type: "mousemove"}, cw);
+ EventUtils.synthesizeMouse(target, 600, 5, {type: "mouseup"}, cw);
+ }
+
+ let dragIntoGroup = function (target) {
+ EventUtils.synthesizeMouseAtCenter(target, {type: "mousedown"}, cw);
+ EventUtils.synthesizeMouse(target, -200, 5, {type: "mousemove"}, cw);
+ EventUtils.synthesizeMouse(target, -200, 5, {type: "mouseup"}, cw);
+ }
+
+ let assertActiveOrphan = function (tabItem) {
+ ok(!cw.GroupItems.getActiveGroupItem(), "no groupItem is active");
+ is(cw.UI.getActiveTab(), tabItem, "orphan tab is active");
+ is(cw.UI.getActiveOrphanTab(), tabItem, "orphan tab is active");
+ }
+
+ let cw = win.TabView.getContentWindow();
+ let groupItem = cw.GroupItems.groupItems[0];
+ let groupItem2 = createGroupItemWithBlankTabs(win, 400, 300, 20, 4);
+
+ // move group
+ cw.UI.setActive(groupItem);
+ simulateDragDrop(groupItem2.container);
+ is(cw.GroupItems.getActiveGroupItem(), groupItem2, "second groupItem is active");
+ is(cw.UI.getActiveTab(), groupItem2.getChild(0), "second groupItem's first tab is active");
+
+ // resize group
+ cw.UI.setActive(groupItem);
+ let tabItem = groupItem2.getChild(2);
+ groupItem2.setActiveTab(tabItem);
+ simulateDragDrop(groupItem2.$resizer[0]);
+ is(cw.GroupItems.getActiveGroupItem(), groupItem2, "second groupItem is active");
+ is(cw.UI.getActiveTab(), tabItem, "second groupItem's third tab is active");
+
+ // create orphan
+ tabItem = groupItem2.getChild(0);
+ dragOutOfGroup(tabItem.container);
+
+ // move orphan
+ cw.UI.setActive(groupItem2);
+ simulateDragDrop(tabItem.container);
+ assertActiveOrphan(tabItem);
+
+ // resize orphan
+ cw.UI.setActive(groupItem2);
+ let $resizer = cw.iQ('.iq-resizable-handle', tabItem.container);
+ simulateDragDrop($resizer[0]);
+ assertActiveOrphan(tabItem);
+
+ // drag back into group
+ dragIntoGroup(tabItem.container);
+ cw.UI.setActive(groupItem);
+ cw.UI.setActive(groupItem2);
+ is(cw.UI.getActiveTab(), tabItem, "the dropped tab is active");
+
+ // hide + unhide groupItem
+ hideGroupItem(groupItem2, function () {
+ is(cw.GroupItems.getActiveGroupItem(), groupItem, "first groupItem is active");
+
+ unhideGroupItem(groupItem2, function () {
+ is(cw.GroupItems.getActiveGroupItem(), groupItem2, "second groupItem is active");
+ is(cw.UI.getActiveTab(), tabItem, "the dropped tab is active");
+
+ finish();
+ });
+ });
+}
new file mode 100644
--- /dev/null
+++ b/browser/base/content/test/tabview/browser_tabview_bug655269.js
@@ -0,0 +1,20 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+function test() {
+ waitForExplicitFinish();
+
+ newWindowWithTabView(function (win) {
+ let cw = win.TabView.getContentWindow();
+ let tabItem = win.gBrowser.tabs[0]._tabViewTabItem;
+
+ tabItem.addSubscriber(tabItem, "savedCachedImageData", function () {
+ tabItem.removeSubscriber(tabItem, "savedCachedImageData");
+
+ ok(cw.UI.isDOMWindowClosing, "dom window is closing");
+ waitForFocus(finish);
+ });
+
+ win.close();
+ });
+}
new file mode 100644
--- /dev/null
+++ b/browser/base/content/test/tabview/browser_tabview_bug656913.js
@@ -0,0 +1,45 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+// ----------
+function test() {
+ waitForExplicitFinish();
+
+ let urlBase = "http://mochi.test:8888/browser/browser/base/content/test/tabview/";
+ let newTab = gBrowser.addTab(urlBase + "search1.html");
+
+ registerCleanupFunction(function() {
+ if (gBrowser.tabs[1])
+ gBrowser.removeTab(gBrowser.tabs[1]);
+ TabView.hide();
+ });
+
+ afterAllTabsLoaded(function() {
+ showTabView(function() {
+ hideTabView(function() {
+ newTab.linkedBrowser.loadURI(urlBase + "dummy_page.html");
+
+ newWindowWithTabView(function(win) {
+ registerCleanupFunction(function() win.close());
+
+ let contentWindow = win.TabView.getContentWindow();
+
+ EventUtils.synthesizeKey("d", { }, contentWindow);
+ EventUtils.synthesizeKey("u", { }, contentWindow);
+ EventUtils.synthesizeKey("m", { }, contentWindow);
+
+ let resultsElement = contentWindow.document.getElementById("results");
+ let childElements = resultsElement.childNodes;
+
+ is(childElements.length, 1, "There is one result element");
+ is(childElements[0].childNodes[1].textContent,
+ "This is a dummy test page",
+ "The label matches the title of dummy page");
+
+ finish();
+ });
+ });
+ });
+ });
+}
+
--- a/browser/base/content/test/tabview/browser_tabview_multiwindow_search.js
+++ b/browser/base/content/test/tabview/browser_tabview_multiwindow_search.js
@@ -4,21 +4,23 @@
let newWindows = [];
function test() {
waitForExplicitFinish();
let windowOne = openDialog(location, "", "chrome,all,dialog=no", "data:text/html,");
let windowTwo;
windowOne.addEventListener("load", function() {
+ windowOne.removeEventListener("load", arguments.callee, false);
windowOne.gBrowser.selectedBrowser.addEventListener("load", function() {
windowOne.gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
windowTwo = openDialog(location, "", "chrome,all,dialog=no", "http://mochi.test:8888/");
windowTwo.addEventListener("load", function() {
+ windowTwo.removeEventListener("load", arguments.callee, false);
windowTwo.gBrowser.selectedBrowser.addEventListener("load", function() {
windowTwo.gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
newWindows = [ windowOne, windowTwo ];
// show the tab view
window.addEventListener("tabviewshown", onTabViewWindowLoaded, false);
ok(!TabView.isVisible(), "Tab View is hidden");
@@ -140,9 +142,9 @@ function whenWindowObservesOnce(win, top
if (origWin && theWin != origWin)
return;
if(aTopic == origTopic) {
windowWatcher.unregisterNotification(windowObserver);
origFunc.apply(this, []);
}
}
windowWatcher.registerNotification(windowObserver);
-}
\ No newline at end of file
+}
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -1283,17 +1283,19 @@
</binding>
<binding id="promobox">
<content>
<xul:hbox class="panel-promo-box" align="start" flex="1">
<xul:hbox align="center" flex="1">
<xul:image class="panel-promo-icon"/>
<xul:description anonid="promo-message" class="panel-promo-message" flex="1">
- placeholder <xul:description anonid="promo-link" class="plain text-link inline-link"/>
+ placeholder <xul:description anonid="promo-link"
+ class="plain text-link inline-link"
+ onclick="document.getBindingParent(this).onLinkClick();"/>
</xul:description>
</xul:hbox>
<xul:toolbarbutton class="panel-promo-closebutton"
oncommand="document.getBindingParent(this).onCloseButtonCommand();"
tooltiptext="&closeNotification.tooltip;"/>
</xul:hbox>
</content>
@@ -1356,16 +1358,24 @@
]]></getter>
</property>
<method name="onCloseButtonCommand">
<body><![CDATA[
this._viewsLeft = 0;
this.hidden = true;
]]></body>
</method>
+ <method name="onLinkClick">
+ <body><![CDATA[
+ // Open a new selected tab and close the current panel.
+ gBrowser.loadOneTab(this._promolink.getAttribute("href"),
+ { inBackground: false });
+ this._panel.hidePopup();
+ ]]></body>
+ </method>
<method name="handleEvent">
<parameter name="event"/>
<body><![CDATA[
if (event.type != "popupshowing" || event.target != this._panel)
return;
// A previous notification may have unhidden this.
this.hidden = true;
--- a/browser/components/feeds/src/FeedWriter.js
+++ b/browser/components/feeds/src/FeedWriter.js
@@ -42,16 +42,19 @@
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cr = Components.results;
const Cu = Components.utils;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+const FEEDWRITER_CID = Components.ID("{49bb6593-3aff-4eb3-a068-2712c28bd58e}");
+const FEEDWRITER_CONTRACTID = "@mozilla.org/browser/feeds/result-writer;1";
+
function LOG(str) {
var prefB = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch);
var shouldLog = false;
try {
shouldLog = prefB.getBoolPref("feeds.log");
}
@@ -1372,24 +1375,19 @@ FeedWriter.prototype = {
var codeStr = "menuItem.setAttribute('image', dataURL);";
Cu.evalInSandbox(codeStr, self._contentSandbox);
self._contentSandbox.menuItem = null;
self._contentSandbox.dataURL = null;
}
});
},
- // nsIClassInfo
- getInterfaces: function FW_getInterfaces(countRef) {
- var interfaces = [Ci.nsIFeedWriter, Ci.nsIClassInfo, Ci.nsISupports];
- countRef.value = interfaces.length;
- return interfaces;
- },
- getHelperForLanguage: function FW_getHelperForLanguage(language) null,
- classID: Components.ID("{49bb6593-3aff-4eb3-a068-2712c28bd58e}"),
- implementationLanguage: Ci.nsIProgrammingLanguage.JAVASCRIPT,
- flags: Ci.nsIClassInfo.DOM_OBJECT,
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIFeedWriter, Ci.nsIClassInfo,
+ classID: FEEDWRITER_CID,
+ classInfo: XPCOMUtils.generateCI({classID: FEEDWRITER_CID,
+ contractID: FEEDWRITER_CONTRACTID,
+ interfaces: [Ci.nsIFeedWriter],
+ flags: Ci.nsIClassInfo.DOM_OBJECT}),
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIFeedWriter,
Ci.nsIDOMEventListener, Ci.nsIObserver,
Ci.nsINavHistoryObserver])
};
var NSGetFactory = XPCOMUtils.generateNSGetFactory([FeedWriter]);
--- a/browser/components/feeds/src/WebContentConverter.js
+++ b/browser/components/feeds/src/WebContentConverter.js
@@ -906,43 +906,32 @@ WebContentConverterRegistrar.prototype =
* See nsIFactory
*/
createInstance: function WCCR_createInstance(outer, iid) {
if (outer != null)
throw Cr.NS_ERROR_NO_AGGREGATION;
return this.QueryInterface(iid);
},
- /**
- * See nsIClassInfo
- */
- getInterfaces: function WCCR_getInterfaces(countRef) {
- var interfaces =
- [Ci.nsIWebContentConverterService, Ci.nsIWebContentHandlerRegistrar,
- Ci.nsIObserver, Ci.nsIClassInfo, Ci.nsIFactory, Ci.nsISupports];
- countRef.value = interfaces.length;
- return interfaces;
- },
- getHelperForLanguage: function WCCR_getHelperForLanguage(language) {
- return null;
- },
classID: WCCR_CLASSID,
- implementationLanguage: Ci.nsIProgrammingLanguage.JAVASCRIPT,
- flags: Ci.nsIClassInfo.DOM_OBJECT,
-
+ classInfo: XPCOMUtils.generateCI({classID: WCCR_CLASSID,
+ contractID: WCCR_CONTRACTID,
+ interfaces: [Ci.nsIWebContentConverterService,
+ Ci.nsIWebContentHandlerRegistrar,
+ Ci.nsIObserver, Ci.nsIFactory],
+ flags: Ci.nsIClassInfo.DOM_OBJECT}),
+
/**
* See nsISupports
*/
QueryInterface: XPCOMUtils.generateQI(
[Ci.nsIWebContentConverterService,
Ci.nsIWebContentHandlerRegistrar,
Ci.nsIObserver,
- Ci.nsIClassInfo,
- Ci.nsIFactory,
- Ci.nsISupports]),
+ Ci.nsIFactory]),
_xpcom_categories: [{
category: "app-startup",
service: true
}]
};
var NSGetFactory = XPCOMUtils.generateNSGetFactory([WebContentConverterRegistrar]);
--- a/browser/components/places/content/browserPlacesViews.js
+++ b/browser/components/places/content/browserPlacesViews.js
@@ -648,16 +648,21 @@ PlacesViewBase.prototype = {
uninit: function PVB_uninit() {
if (this._result) {
this._result.removeObserver(this);
this._resultNode.containerOpen = false;
this._resultNode = null;
this._result = null;
}
+ if (this._controller) {
+ this._viewElt.controllers.removeController(this._controller);
+ this._controller = null;
+ }
+
delete this._viewElt._placesView;
},
get isRTL() {
if ("_isRTL" in this)
return this._isRTL;
return this._isRTL = document.defaultView
--- a/browser/components/places/tests/browser/browser_library_panel_leak.js
+++ b/browser/components/places/tests/browser/browser_library_panel_leak.js
@@ -53,46 +53,38 @@ const TEST_URI = "http://www.mozilla.org
let ww = Cc["@mozilla.org/embedcomp/window-watcher;1"].
getService(Ci.nsIWindowWatcher);
function windowObserver(aSubject, aTopic, aData) {
if (aTopic != "domwindowopened")
return;
ww.unregisterNotification(windowObserver);
let organizer = aSubject.QueryInterface(Ci.nsIDOMWindow);
- organizer.addEventListener("load", function onLoad(event) {
- organizer.removeEventListener("load", onLoad, false);
- executeSoon(function () {
- let contentTree = organizer.document.getElementById("placeContent");
- isnot(contentTree, null, "Sanity check: placeContent tree should exist");
- isnot(organizer.PlacesOrganizer, null, "Sanity check: PlacesOrganizer should exist");
- isnot(organizer.gEditItemOverlay, null, "Sanity check: gEditItemOverlay should exist");
+ waitForFocus(function () {
+ let contentTree = organizer.document.getElementById("placeContent");
+ isnot(contentTree, null, "Sanity check: placeContent tree should exist");
+ isnot(organizer.PlacesOrganizer, null, "Sanity check: PlacesOrganizer should exist");
+ isnot(organizer.gEditItemOverlay, null, "Sanity check: gEditItemOverlay should exist");
- if (!organizer.gEditItemOverlay._initialized){
- // The overlay is initialized on focus, we wait for it to be fully operational.
- setTimeout(arguments.callee, 10);
- return;
- }
+ ok(organizer.gEditItemOverlay._initialized, "gEditItemOverlay is initialized");
+ isnot(organizer.gEditItemOverlay.itemId, -1, "Editing a bookmark");
- isnot(organizer.gEditItemOverlay.itemId, -1, "Editing a bookmark");
- // Select History in the left pane.
- organizer.PlacesOrganizer.selectLeftPaneQuery('History');
- // Select the first history entry.
- let selection = contentTree.view.selection;
- selection.clearSelection();
- selection.rangedSelect(0, 0, true);
- // Check the panel is editing the history entry.
- is(organizer.gEditItemOverlay.itemId, -1, "Editing an history entry");
- // Close Library window.
- organizer.close();
- // Clean up history.
- PlacesUtils.history.QueryInterface(Ci.nsIBrowserHistory).removeAllPages();
- finish();
- });
- }, false);
+ // Select History in the left pane.
+ organizer.PlacesOrganizer.selectLeftPaneQuery('History');
+ // Select the first history entry.
+ let selection = contentTree.view.selection;
+ selection.clearSelection();
+ selection.rangedSelect(0, 0, true);
+ // Check the panel is editing the history entry.
+ is(organizer.gEditItemOverlay.itemId, -1, "Editing an history entry");
+ // Close Library window.
+ organizer.close();
+ // Clean up history.
+ waitForClearHistory(finish);
+ }, organizer);
}
function test() {
waitForExplicitFinish();
// Add an history entry.
ok(PlacesUtils, "checking PlacesUtils, running in chrome context?");
PlacesUtils.history.addVisit(PlacesUtils._uri(TEST_URI), Date.now() * 1000,
null, PlacesUtils.history.TRANSITION_TYPED,
@@ -100,8 +92,19 @@ function test() {
ww.registerNotification(windowObserver);
ww.openWindow(null,
"chrome://browser/content/places/places.xul",
"",
"chrome,toolbar=yes,dialog=no,resizable",
null);
}
+
+function waitForClearHistory(aCallback) {
+ let observer = {
+ observe: function(aSubject, aTopic, aData) {
+ Services.obs.removeObserver(this, PlacesUtils.TOPIC_EXPIRATION_FINISHED);
+ aCallback(aSubject, aTopic, aData);
+ }
+ };
+ Services.obs.addObserver(observer, PlacesUtils.TOPIC_EXPIRATION_FINISHED, false);
+ PlacesUtils.bhistory.removeAllPages();
+}
--- a/browser/components/places/tests/browser/browser_library_search.js
+++ b/browser/components/places/tests/browser/browser_library_search.js
@@ -109,19 +109,19 @@ var testCases = [
resetSearch("scopeBarFolder");
search(folderId, "dummy", "scopeBarFolder");
bmsvc.removeItem(folderId);
},
];
///////////////////////////////////////////////////////////////////////////////
-const bmsvc = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
+var bmsvc = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
getService(Ci.nsINavBookmarksService);
-const histsvc = Cc["@mozilla.org/browser/nav-history-service;1"].
+var histsvc = Cc["@mozilla.org/browser/nav-history-service;1"].
getService(Ci.nsINavHistoryService);
var libraryWin;
///////////////////////////////////////////////////////////////////////////////
/**
* Returns the default search scope for a given folder.
*
--- a/browser/components/places/tests/browser/browser_markPageAsFollowedLink.js
+++ b/browser/components/places/tests/browser/browser_markPageAsFollowedLink.js
@@ -6,18 +6,16 @@
* Tests that visits across frames are correctly represented in the database.
*/
const BASE_URL = "http://mochi.test:8888/browser/browser/components/places/tests/browser";
const PAGE_URL = BASE_URL + "/framedPage.html";
const LEFT_URL = BASE_URL + "/frameLeft.html";
const RIGHT_URL = BASE_URL + "/frameRight.html";
-Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
-
let gTabLoaded = false;
let gLeftFrameVisited = false;
let observer = {
observe: function(aSubject, aTopic, aData)
{
let url = aSubject.QueryInterface(Ci.nsIURI).spec;
if (url == LEFT_URL ) {
--- a/browser/components/places/tests/perf/browser_ui_000_data.js
+++ b/browser/components/places/tests/perf/browser_ui_000_data.js
@@ -47,26 +47,16 @@ and bookmarks.
*/
/*********************** begin header **********************/
waitForExplicitFinish();
const TEST_IDENTIFIER = "ui-perf-test";
const TEST_SUITE = "places";
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cr = Components.results;
-
-var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
- getService(Ci.nsIWindowMediator);
-var win = wm.getMostRecentWindow("navigator:browser");
-
-var ios = Cc["@mozilla.org/network/io-service;1"].
- getService(Ci.nsIIOService);
var hs = Cc["@mozilla.org/browser/nav-history-service;1"].
getService(Ci.nsINavHistoryService);
var bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
getService(Ci.nsINavBookmarksService);
function add_visit(aURI, aDate) {
var placeID = hs.addVisit(aURI,
aDate,
@@ -107,17 +97,17 @@ ptests.push({
var visit_date_microsec = Date.now() * 1000;
var day_counter = 0;
var start = Date.now();
for (var i = 0; i < days; i++) {
visit_date_microsec -= 86400 * 1000 * 1000; // remove a day
var spec = "http://example.com/" + visit_date_microsec;
for (var j = 0; j < visits_per_day; j++) {
- var uri = ios.newURI(spec + j, null, null);
+ var uri = Services.io.newURI(spec + j, null, null);
add_visit(uri, visit_date_microsec);
}
}
var duration = Date.now() - start;
var report = make_test_report("add_visits", duration);
ok(true, report);
// add bookmarks
@@ -127,17 +117,17 @@ ptests.push({
// reset visit date counter
visit_date_microsec = Date.now() * 1000;
var bookmark_counter = 0;
start = Date.now();
for (var i = 0; i < days; i++) {
visit_date_microsec -= 86400 * 1000 * 1000; // remove a day
var spec = "http://example.com/" + visit_date_microsec;
for (var j = 0; j < visits_per_day; j++) {
- var uri = ios.newURI(spec + j, null, null);
+ var uri = Services.io.newURI(spec + j, null, null);
if (bookmark_counter < bookmarks_per_day) {
add_bookmark(uri);
bookmark_counter++;
}
else
bookmark_counter = 0;
}
}
--- a/browser/components/places/tests/perf/browser_ui_bookmarks_sidebar.js
+++ b/browser/components/places/tests/perf/browser_ui_bookmarks_sidebar.js
@@ -42,26 +42,16 @@ Tests the performance of opening the boo
*/
/*********************** begin header **********************/
waitForExplicitFinish();
const TEST_IDENTIFIER = "ui-perf-test";
const TEST_SUITE = "places";
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cr = Components.results;
-
-var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
- getService(Ci.nsIWindowMediator);
-var win = wm.getMostRecentWindow("navigator:browser");
-
-var ios = Cc["@mozilla.org/network/io-service;1"].
- getService(Ci.nsIIOService);
var hs = Cc["@mozilla.org/browser/nav-history-service;1"].
getService(Ci.nsINavHistoryService);
var bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
getService(Ci.nsINavBookmarksService);
function add_visit(aURI, aDate) {
var visitId = hs.addVisit(aURI,
aDate,
--- a/browser/components/places/tests/perf/browser_ui_history_menu.js
+++ b/browser/components/places/tests/perf/browser_ui_history_menu.js
@@ -39,26 +39,16 @@
/*
Tests the performance of opening the history menu.
*/
/*********************** begin header **********************/
const TEST_IDENTIFIER = "ui-perf-test";
const TEST_SUITE = "places";
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cr = Components.results;
-
-var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
- getService(Ci.nsIWindowMediator);
-var win = wm.getMostRecentWindow("navigator:browser");
-
-var ios = Cc["@mozilla.org/network/io-service;1"].
- getService(Ci.nsIIOService);
var hs = Cc["@mozilla.org/browser/nav-history-service;1"].
getService(Ci.nsINavHistoryService);
var bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
getService(Ci.nsINavBookmarksService);
var historyMenu = document.getElementById("history-menu");
var historyPopup = document.getElementById("goPopup");
--- a/browser/components/places/tests/perf/browser_ui_history_sidebar.js
+++ b/browser/components/places/tests/perf/browser_ui_history_sidebar.js
@@ -42,25 +42,16 @@ sidebar in all the available views.
*/
/*********************** begin header **********************/
waitForExplicitFinish();
const TEST_IDENTIFIER = "ui-perf-test";
const TEST_SUITE = "places";
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cr = Components.results;
-
-var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
- getService(Ci.nsIWindowMediator);
-var win = wm.getMostRecentWindow("navigator:browser");
-var ios = Cc["@mozilla.org/network/io-service;1"].
- getService(Ci.nsIIOService);
var hs = Cc["@mozilla.org/browser/nav-history-service;1"].
getService(Ci.nsINavHistoryService);
var bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
getService(Ci.nsINavBookmarksService);
var sidebar = document.getElementById("sidebar");
function add_visit(aURI, aDate) {
--- a/browser/components/places/tests/perf/browser_ui_history_sidebar_2.js
+++ b/browser/components/places/tests/perf/browser_ui_history_sidebar_2.js
@@ -42,25 +42,16 @@ sidebar in all the available views.
*/
/*********************** begin header **********************/
waitForExplicitFinish();
const TEST_IDENTIFIER = "ui-perf-test";
const TEST_SUITE = "places";
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cr = Components.results;
-
-var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
- getService(Ci.nsIWindowMediator);
-var win = wm.getMostRecentWindow("navigator:browser");
-var ios = Cc["@mozilla.org/network/io-service;1"].
- getService(Ci.nsIIOService);
var hs = Cc["@mozilla.org/browser/nav-history-service;1"].
getService(Ci.nsINavHistoryService);
var bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
getService(Ci.nsINavBookmarksService);
var sidebar = document.getElementById("sidebar");
function add_visit(aURI, aDate) {
--- a/browser/components/places/tests/perf/browser_ui_history_sidebar_3.js
+++ b/browser/components/places/tests/perf/browser_ui_history_sidebar_3.js
@@ -42,25 +42,16 @@ sidebar in all the available views.
*/
/*********************** begin header **********************/
waitForExplicitFinish();
const TEST_IDENTIFIER = "ui-perf-test";
const TEST_SUITE = "places";
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cr = Components.results;
-
-var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
- getService(Ci.nsIWindowMediator);
-var win = wm.getMostRecentWindow("navigator:browser");
-var ios = Cc["@mozilla.org/network/io-service;1"].
- getService(Ci.nsIIOService);
var hs = Cc["@mozilla.org/browser/nav-history-service;1"].
getService(Ci.nsINavHistoryService);
var bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
getService(Ci.nsINavBookmarksService);
var sidebar = document.getElementById("sidebar");
function add_visit(aURI, aDate) {
--- a/browser/components/places/tests/perf/browser_ui_locationbar.js
+++ b/browser/components/places/tests/perf/browser_ui_locationbar.js
@@ -41,34 +41,22 @@ Tests the performance of opening the loc
*/
/*********************** begin header **********************/
waitForExplicitFinish();
const TEST_IDENTIFIER = "ui-perf-test";
const TEST_SUITE = "places";
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cr = Components.results;
-
-var wm = Cc["@mozilla.org/appshell/window-mediator;1"].
- getService(Ci.nsIWindowMediator);
-var win = wm.getMostRecentWindow("navigator:browser");
-
-var ios = Cc["@mozilla.org/network/io-service;1"].
- getService(Ci.nsIIOService);
var hs = Cc["@mozilla.org/browser/nav-history-service;1"].
getService(Ci.nsINavHistoryService);
var bs = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
getService(Ci.nsINavBookmarksService);
-var prefs = Cc["@mozilla.org/preferences-service;1"].
- getService(Ci.nsIPrefBranch);
-var maxResults = prefs.getIntPref("browser.urlbar.maxRichResults");
+var maxResults = Services.prefs.getIntPref("browser.urlbar.maxRichResults");
var onSearchComplete = gURLBar.onSearchComplete;
function add_visit(aURI, aDate) {
var visitId = hs.addVisit(aURI,
aDate,
null, // no referrer
hs.TRANSITION_TYPED, // user typed in URL bar
false, // not redirect
--- a/browser/components/places/tests/unit/test_bookmarks_html.js
+++ b/browser/components/places/tests/unit/test_bookmarks_html.js
@@ -16,285 +16,386 @@
* The Original Code is mozilla.com code.
*
* The Initial Developer of the Original Code is the Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2007
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Dietrich Ayala <dietrich@mozilla.com>
+ * Marco Bonardo <mak77@bonardo.net>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-// get history service
-try {
- var histsvc = Cc["@mozilla.org/browser/nav-history-service;1"].getService(Ci.nsINavHistoryService);
-} catch(ex) {
- do_throw("Could not get nav-history-service\n");
-}
-
-// Get bookmark service
-try {
- var bmsvc = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].getService(Ci.nsINavBookmarksService);
-} catch(ex) {
- do_throw("Could not get nav-bookmarks-service\n");
-}
-
-// Get annotation service
-try {
- var annosvc = Cc["@mozilla.org/browser/annotation-service;1"].getService(Ci.nsIAnnotationService);
-} catch(ex) {
- do_throw("Could not get annotation service\n");
-}
-
-// Get livemark service
-try {
- var livemarksvc = Cc["@mozilla.org/browser/livemark-service;2"].getService(Ci.nsILivemarkService);
-} catch(ex) {
- do_throw("Could not get livemark service\n");
-}
-
-// Get favicon service
-try {
- var iconsvc = Cc["@mozilla.org/browser/favicon-service;1"].getService(Ci.nsIFaviconService);
-} catch(ex) {
- do_throw("Could not get favicon service\n");
-}
+// An object representing the contents of bookmarks.preplaces.html.
+let test_bookmarks = {
+ menu: [
+ { title: "Mozilla Firefox",
+ children: [
+ { title: "Help and Tutorials",
+ url: "http://en-us.www.mozilla.com/en-US/firefox/help/",
+ icon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHWSURBVHjaYvz//z8DJQAggJiQOe/fv2fv7Oz8rays/N+VkfG/iYnJfyD/1+rVq7ffu3dPFpsBAAHEAHIBCJ85c8bN2Nj4vwsDw/8zQLwKiO8CcRoQu0DxqlWrdsHUwzBAAIGJmTNnPgYa9j8UqhFElwPxf2MIDeIrKSn9FwSJoRkAEEAM0DD4DzMAyPi/G+QKY4hh5WAXGf8PDQ0FGwJ22d27CjADAAIIrLmjo+MXA9R2kAHvGBA2wwx6B8W7od6CeQcggKCmCEL8bgwxYCbUIGTDVkHDBia+CuotgACCueD3TDQN75D4xmAvCoK9ARMHBzAw0AECiBHkAlC0Mdy7x9ABNA3obAZXIAa6iKEcGlMVQHwWyjYuL2d4v2cPg8vZswx7gHyAAAK7AOif7SAbOqCmn4Ha3AHFsIDtgPq/vLz8P4MSkJ2W9h8ggBjevXvHDo4FQUQg/kdypqCg4H8lUIACnQ/SOBMYI8bAsAJFPcj1AAEEjwVQqLpAbXmH5BJjqI0gi9DTAAgDBBCcAVLkgmQ7yKCZxpCQxqUZhAECCJ4XgMl493ug21ZD+aDAXH0WLM4A9MZPXJkJIIAwTAR5pQMalaCABQUULttBGCCAGCnNzgABBgAMJ5THwGvJLAAAAABJRU5ErkJggg=="
+ },
+ { title: "Customize Firefox",
+ url: "http://en-us.www.mozilla.com/en-US/firefox/customize/",
+ icon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHWSURBVHjaYvz//z8DJQAggJiQOe/fv2fv7Oz8rays/N+VkfG/iYnJfyD/1+rVq7ffu3dPFpsBAAHEAHIBCJ85c8bN2Nj4vwsDw/8zQLwKiO8CcRoQu0DxqlWrdsHUwzBAAIGJmTNnPgYa9j8UqhFElwPxf2MIDeIrKSn9FwSJoRkAEEAM0DD4DzMAyPi/G+QKY4hh5WAXGf8PDQ0FGwJ22d27CjADAAIIrLmjo+MXA9R2kAHvGBA2wwx6B8W7od6CeQcggKCmCEL8bgwxYCbUIGTDVkHDBia+CuotgACCueD3TDQN75D4xmAvCoK9ARMHBzAw0AECiBHkAlC0Mdy7x9ABNA3obAZXIAa6iKEcGlMVQHwWyjYuL2d4v2cPg8vZswx7gHyAAAK7AOif7SAbOqCmn4Ha3AHFsIDtgPq/vLz8P4MSkJ2W9h8ggBjevXvHDo4FQUQg/kdypqCg4H8lUIACnQ/SOBMYI8bAsAJFPcj1AAEEjwVQqLpAbXmH5BJjqI0gi9DTAAgDBBCcAVLkgmQ7yKCZxpCQxqUZhAECCJ4XgMl493ug21ZD+aDAXH0WLM4A9MZPXJkJIIAwTAR5pQMalaCABQUULttBGCCAGCnNzgABBgAMJ5THwGvJLAAAAABJRU5ErkJggg=="
+ },
+ { title: "Get Involved",
+ url: "http://en-us.www.mozilla.com/en-US/firefox/community/",
+ icon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHWSURBVHjaYvz//z8DJQAggJiQOe/fv2fv7Oz8rays/N+VkfG/iYnJfyD/1+rVq7ffu3dPFpsBAAHEAHIBCJ85c8bN2Nj4vwsDw/8zQLwKiO8CcRoQu0DxqlWrdsHUwzBAAIGJmTNnPgYa9j8UqhFElwPxf2MIDeIrKSn9FwSJoRkAEEAM0DD4DzMAyPi/G+QKY4hh5WAXGf8PDQ0FGwJ22d27CjADAAIIrLmjo+MXA9R2kAHvGBA2wwx6B8W7od6CeQcggKCmCEL8bgwxYCbUIGTDVkHDBia+CuotgACCueD3TDQN75D4xmAvCoK9ARMHBzAw0AECiBHkAlC0Mdy7x9ABNA3obAZXIAa6iKEcGlMVQHwWyjYuL2d4v2cPg8vZswx7gHyAAAK7AOif7SAbOqCmn4Ha3AHFsIDtgPq/vLz8P4MSkJ2W9h8ggBjevXvHDo4FQUQg/kdypqCg4H8lUIACnQ/SOBMYI8bAsAJFPcj1AAEEjwVQqLpAbXmH5BJjqI0gi9DTAAgDBBCcAVLkgmQ7yKCZxpCQxqUZhAECCJ4XgMl493ug21ZD+aDAXH0WLM4A9MZPXJkJIIAwTAR5pQMalaCABQUULttBGCCAGCnNzgABBgAMJ5THwGvJLAAAAABJRU5ErkJggg=="
+ },
+ { title: "About Us",
+ url: "http://en-us.www.mozilla.com/en-US/about/",
+ icon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHWSURBVHjaYvz//z8DJQAggJiQOe/fv2fv7Oz8rays/N+VkfG/iYnJfyD/1+rVq7ffu3dPFpsBAAHEAHIBCJ85c8bN2Nj4vwsDw/8zQLwKiO8CcRoQu0DxqlWrdsHUwzBAAIGJmTNnPgYa9j8UqhFElwPxf2MIDeIrKSn9FwSJoRkAEEAM0DD4DzMAyPi/G+QKY4hh5WAXGf8PDQ0FGwJ22d27CjADAAIIrLmjo+MXA9R2kAHvGBA2wwx6B8W7od6CeQcggKCmCEL8bgwxYCbUIGTDVkHDBia+CuotgACCueD3TDQN75D4xmAvCoK9ARMHBzAw0AECiBHkAlC0Mdy7x9ABNA3obAZXIAa6iKEcGlMVQHwWyjYuL2d4v2cPg8vZswx7gHyAAAK7AOif7SAbOqCmn4Ha3AHFsIDtgPq/vLz8P4MSkJ2W9h8ggBjevXvHDo4FQUQg/kdypqCg4H8lUIACnQ/SOBMYI8bAsAJFPcj1AAEEjwVQqLpAbXmH5BJjqI0gi9DTAAgDBBCcAVLkgmQ7yKCZxpCQxqUZhAECCJ4XgMl493ug21ZD+aDAXH0WLM4A9MZPXJkJIIAwTAR5pQMalaCABQUULttBGCCAGCnNzgABBgAMJ5THwGvJLAAAAABJRU5ErkJggg=="
+ },
+ ],
+ },
+ { title: "test",
+ description: "folder test comment",
+ dateAdded: 1177541020000000,
+ lastModified: 1177541050000000,
+ children: [
+ { title: "test post keyword",
+ description: "item description",
+ dateAdded: 1177375336000000,
+ lastModified: 1177375423000000,
+ keyword: "test",
+ sidebar: true,
+ postData: "hidden1%3Dbar&text1%3D%25s",
+ charset: "ISO-8859-1",
+ },
+ ]
+ },
+ ],
+ toolbar: [
+ { title: "Getting Started",
+ url: "http://en-us.www.mozilla.com/en-US/firefox/central/",
+ icon: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHWSURBVHjaYvz//z8DJQAggJiQOe/fv2fv7Oz8rays/N+VkfG/iYnJfyD/1+rVq7ffu3dPFpsBAAHEAHIBCJ85c8bN2Nj4vwsDw/8zQLwKiO8CcRoQu0DxqlWrdsHUwzBAAIGJmTNnPgYa9j8UqhFElwPxf2MIDeIrKSn9FwSJoRkAEEAM0DD4DzMAyPi/G+QKY4hh5WAXGf8PDQ0FGwJ22d27CjADAAIIrLmjo+MXA9R2kAHvGBA2wwx6B8W7od6CeQcggKCmCEL8bgwxYCbUIGTDVkHDBia+CuotgACCueD3TDQN75D4xmAvCoK9ARMHBzAw0AECiBHkAlC0Mdy7x9ABNA3obAZXIAa6iKEcGlMVQHwWyjYuL2d4v2cPg8vZswx7gHyAAAK7AOif7SAbOqCmn4Ha3AHFsIDtgPq/vLz8P4MSkJ2W9h8ggBjevXvHDo4FQUQg/kdypqCg4H8lUIACnQ/SOBMYI8bAsAJFPcj1AAEEjwVQqLpAbXmH5BJjqI0gi9DTAAgDBBCcAVLkgmQ7yKCZxpCQxqUZhAECCJ4XgMl493ug21ZD+aDAXH0WLM4A9MZPXJkJIIAwTAR5pQMalaCABQUULttBGCCAGCnNzgABBgAMJ5THwGvJLAAAAABJRU5ErkJggg=="
+ },
+ { title: "Latest Headlines",
+ description: "Livemark test comment",
+ url: "http://en-us.fxfeeds.mozilla.com/en-US/firefox/livebookmarks/",
+ feedUrl: "http://en-us.fxfeeds.mozilla.com/en-US/firefox/headlines.xml",
+ }
+ ],
+ unfiled: [
+ { title: "Example.tld",
+ url: "http://example.tld/",
+ },
+ ],
+};
-// Get io service
-try {
- var iosvc = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
-} catch (ex) {
- do_throw("Could not get io service\n");
-}
+// Pre-Places bookmarks.html file pointer.
+let gBookmarksFileOld;
+// Places bookmarks.html file pointer.
+let gBookmarksFileNew;
-const DESCRIPTION_ANNO = "bookmarkProperties/description";
-const LOAD_IN_SIDEBAR_ANNO = "bookmarkProperties/loadInSidebar";
-const POST_DATA_ANNO = "bookmarkProperties/POSTData";
+let importer = Cc["@mozilla.org/browser/places/import-export-service;1"].
+ getService(Ci.nsIPlacesImportExportService);
-const TEST_FAVICON_PAGE_URL = "http://en-US.www.mozilla.com/en-US/firefox/central/";
-const TEST_FAVICON_DATA_URL = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHWSURBVHjaYvz//z8DJQAggJiQOe/fv2fv7Oz8rays/N+VkfG/iYnJfyD/1+rVq7ffu3dPFpsBAAHEAHIBCJ85c8bN2Nj4vwsDw/8zQLwKiO8CcRoQu0DxqlWrdsHUwzBAAIGJmTNnPgYa9j8UqhFElwPxf2MIDeIrKSn9FwSJoRkAEEAM0DD4DzMAyPi/G+QKY4hh5WAXGf8PDQ0FGwJ22d27CjADAAIIrLmjo+MXA9R2kAHvGBA2wwx6B8W7od6CeQcggKCmCEL8bgwxYCbUIGTDVkHDBia+CuotgACCueD3TDQN75D4xmAvCoK9ARMHBzAw0AECiBHkAlC0Mdy7x9ABNA3obAZXIAa6iKEcGlMVQHwWyjYuL2d4v2cPg8vZswx7gHyAAAK7AOif7SAbOqCmn4Ha3AHFsIDtgPq/vLz8P4MSkJ2W9h8ggBjevXvHDo4FQUQg/kdypqCg4H8lUIACnQ/SOBMYI8bAsAJFPcj1AAEEjwVQqLpAbXmH5BJjqI0gi9DTAAgDBBCcAVLkgmQ7yKCZxpCQxqUZhAECCJ4XgMl493ug21ZD+aDAXH0WLM4A9MZPXJkJIIAwTAR5pQMalaCABQUULttBGCCAGCnNzgABBgAMJ5THwGvJLAAAAABJRU5ErkJggg==";
+function run_test()
+{
+ // Avoid creating smart bookmarks during the test.
+ Services.prefs.setIntPref("browser.places.smartBookmarksVersion", -1);
-// main
-function run_test() {
- // get places import/export service
- var importer = Cc["@mozilla.org/browser/places/import-export-service;1"].getService(Ci.nsIPlacesImportExportService);
-
- // avoid creating the places smart folder during tests
- Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch).
- setIntPref("browser.places.smartBookmarksVersion", -1);
+ // File pointer to legacy bookmarks file.
+ gBookmarksFileOld = do_get_file("bookmarks.preplaces.html");
- // file pointer to legacy bookmarks file
- var bookmarksFileOld = do_get_file("bookmarks.preplaces.html");
- // file pointer to a new places-exported bookmarks file
- var bookmarksFileNew = Services.dirsvc.get("ProfD", Ci.nsILocalFile);
- bookmarksFileNew.append("bookmarks.exported.html");
+ // File pointer to a new Places-exported bookmarks file.
+ gBookmarksFileNew = Services.dirsvc.get("ProfD", Ci.nsILocalFile);
+ gBookmarksFileNew.append("bookmarks.exported.html");
+ if (gBookmarksFileNew.exists()) {
+ gBookmarksFileNew.remove(false);
+ }
+ gBookmarksFileNew.create(Ci.nsILocalFile.NORMAL_FILE_TYPE, 0600);
+ if (!gBookmarksFileNew.exists()) {
+ do_throw("couldn't create file: bookmarks.exported.html");
+ }
- // create bookmarks.exported.html
- if (bookmarksFileNew.exists())
- bookmarksFileNew.remove(false);
- bookmarksFileNew.create(Ci.nsILocalFile.NORMAL_FILE_TYPE, 0600);
- if (!bookmarksFileNew.exists())
- do_throw("couldn't create file: bookmarks.exported.html");
-
+ // This test must be the first one, since it setups the new bookmarks.html.
// Test importing a pre-Places canonical bookmarks file.
// 1. import bookmarks.preplaces.html
// 2. run the test-suite
// Note: we do not empty the db before this import to catch bugs like 380999
try {
- importer.importHTMLFromFile(bookmarksFileOld, true);
+ importer.importHTMLFromFile(gBookmarksFileOld, true);
} catch(ex) { do_throw("couldn't import legacy bookmarks file: " + ex); }
- testCanonicalBookmarks(bmsvc.bookmarksMenuFolder);
+
+ testImportedBookmarks();
+
+ // Prepare for next tests.
+ try {
+ importer.exportHTMLToFile(gBookmarksFileNew);
+ } catch(ex) { do_throw("couldn't export to file: " + ex); }
- // Test exporting a Places canonical bookmarks file.
- // 1. export to bookmarks.exported.html
- // 2. empty bookmarks db
- // 3. import bookmarks.exported.html
- // 4. run the test-suite
+ remove_all_bookmarks();
+ run_next_test();
+}
+
+add_test(function test_import_new()
+{
+ // Test importing a Places bookmarks.html file.
+ // 1. import bookmarks.exported.html
+ // 2. run the test-suite
+
try {
- importer.exportHTMLToFile(bookmarksFileNew);
- } catch(ex) { do_throw("couldn't export to file: " + ex); }
- bmsvc.removeFolderChildren(bmsvc.bookmarksMenuFolder);
- bmsvc.removeFolderChildren(bmsvc.toolbarFolder);
+ importer.importHTMLFromFile(gBookmarksFileNew, true);
+ } catch(ex) { do_throw("couldn't import the exported file: " + ex); }
+
+ testImportedBookmarks();
+
+ remove_all_bookmarks();
+ run_next_test();
+});
+
+add_test(function test_emptytitle_export()
+{
+ // Test exporting and importing with an empty-titled bookmark.
+ // 1. import bookmarks
+ // 1. create an empty-titled bookmark.
+ // 2. export to bookmarks.exported.html
+ // 3. empty bookmarks db
+ // 4. import bookmarks.exported.html
+ // 5. run the test-suite
+
try {
- importer.importHTMLFromFile(bookmarksFileNew, true);
+ importer.importHTMLFromFile(gBookmarksFileNew, true);
} catch(ex) { do_throw("couldn't import the exported file: " + ex); }
- testCanonicalBookmarks(bmsvc.bookmarksMenuFolder);
+
+ const NOTITLE_URL = "http://notitle.mozilla.org/";
+ let id = PlacesUtils.bookmarks.insertBookmark(PlacesUtils.unfiledBookmarksFolderId,
+ NetUtil.newURI(NOTITLE_URL),
+ PlacesUtils.bookmarks.DEFAULT_INDEX,
+ "");
+ test_bookmarks.unfiled.push({ title: "", url: NOTITLE_URL });
+
+ try {
+ importer.exportHTMLToFile(gBookmarksFileNew);
+ } catch(ex) { do_throw("couldn't export to file: " + ex); }
+
+ remove_all_bookmarks();
- /*
- // XXX import-to-folder tests disabled due to bug 363634
+ try {
+ importer.importHTMLFromFile(gBookmarksFileNew, true);
+ } catch(ex) { do_throw("couldn't import the exported file: " + ex); }
+
+ testImportedBookmarks();
+
+ // Cleanup.
+ test_bookmarks.unfiled.pop();
+ PlacesUtils.bookmarks.removeItem(id);
+
+ try {
+ importer.exportHTMLToFile(gBookmarksFileNew);
+ } catch(ex) { do_throw("couldn't export to file: " + ex); }
+
+ remove_all_bookmarks();
+ run_next_test();
+});
+
+add_test(function test_import_preplaces_to_folder()
+{
// Test importing a pre-Places canonical bookmarks file to a specific folder.
// 1. create a new folder
// 2. import bookmarks.preplaces.html to that folder
// 3. run the test-suite
- var testFolder = bmsvc.createFolder(bmsvc.bookmarksMenuFolder, "test-import", bmsvc.DEFAULT_INDEX);
+
+ let testFolder = PlacesUtils.bookmarks.createFolder(
+ PlacesUtils.bookmarksMenuFolderId, "test-import",
+ PlacesUtils.bookmarks.DEFAULT_INDEX
+ );
try {
- importer.importHTMLFromFileToFolder(bookmarksFileOld, testFolder, false);
+ importer.importHTMLFromFileToFolder(gBookmarksFileOld, testFolder, false);
} catch(ex) { do_throw("couldn't import the exported file to folder: " + ex); }
- testCanonicalBookmarks(testFolder);
- bmsvc.removeFolder(testFolder);
+
+ // Import-to-folder creates subfolders for toolbar and unfiled.
+ testImportedBookmarksToFolder(testFolder);
+ remove_all_bookmarks();
+ run_next_test();
+});
+
+add_test(function test_import_to_folder()
+{
// Test importing a Places canonical bookmarks file to a specific folder.
// 1. create a new folder
// 2. import bookmarks.exported.html to that folder
// 3. run the test-suite
- var testFolder = bmsvc.createFolder(bmsvc.bookmarksMenuFolder, "test-import", bmsvc.DEFAULT_INDEX);
+
+ let testFolder = PlacesUtils.bookmarks.createFolder(
+ PlacesUtils.bookmarksMenuFolderId, "test-import",
+ PlacesUtils.bookmarks.DEFAULT_INDEX
+ );
try {
- importer.importHTMLFromFileToFolder(bookmarksFileNew, testFolder, false);
+ importer.importHTMLFromFileToFolder(gBookmarksFileNew, testFolder, false);
} catch(ex) { do_throw("couldn't import the exported file to folder: " + ex); }
- testCanonicalBookmarks(testFolder);
- bmsvc.removeFolder(testFolder);
+
+ // Import-to-folder creates subfolders for toolbar and unfiled.
+ testImportedBookmarksToFolder(testFolder);
- // XXX Disabled due to bug 381129 - separators will be duplicated on re-import
+ remove_all_bookmarks();
+ run_next_test();
+});
+
+add_test(function test_import_ontop()
+{
// Test importing the exported bookmarks.html file *on top of* the existing
- // bookmarks. This tests import of IDs. If we support IDs correctly, there
- // should be no difference after the import.
+ // bookmarks.
// 1. empty bookmarks db
// 2. import the exported bookmarks file
// 3. export to file
// 3. import the exported bookmarks file
// 4. run the test-suite
- bmsvc.removeFolderChildren(bmsvc.bookmarksMenuFolder);
+
try {
- importer.importHTMLFromFile(bookmarksFileNew, true);
+ importer.importHTMLFromFile(gBookmarksFileNew, true);
} catch(ex) { do_throw("couldn't import the exported file: " + ex); }
try {
- importer.exportHTMLToFile(bookmarksFileNew);
+ importer.exportHTMLToFile(gBookmarksFileNew);
} catch(ex) { do_throw("couldn't export to file: " + ex); }
try {
- importer.importHTMLFromFile(bookmarksFileNew, true);
+ importer.importHTMLFromFile(gBookmarksFileNew, true);
} catch(ex) { do_throw("couldn't import the exported file: " + ex); }
- testCanonicalBookmarks(bmsvc.bookmarksMenuFolder);
- */
- /*
- XXX if there are new fields we add to the bookmarks HTML format
- then test them here
- Test importing a Places canonical bookmarks file
- 1. empty the bookmarks datastore
- 2. import bookmarks.places.html
- 3. run the test-suite
- 4. run the additional-test-suite
- */
+
+ testImportedBookmarks();
+
+ remove_all_bookmarks();
+ run_next_test();
+});
+
+function testImportedBookmarks()
+{
+ for (let group in test_bookmarks) {
+ let root;
+ switch (group) {
+ case "menu":
+ root = PlacesUtils.getFolderContents(PlacesUtils.bookmarksMenuFolderId).root;
+ break;
+ case "toolbar":
+ root = PlacesUtils.getFolderContents(PlacesUtils.toolbarFolderId).root;
+ break;
+ case "unfiled":
+ root = PlacesUtils.getFolderContents(PlacesUtils.unfiledBookmarksFolderId).root;
+ break;
+ }
+
+ let items = test_bookmarks[group];
+ do_check_eq(root.childCount, items.length);
+
+ items.forEach(function (item, index) checkItem(item, root.getChild(index)));
+
+ root.containerOpen = false;
+ }
+}
+
+function testImportedBookmarksToFolder(aFolder)
+{
+ root = PlacesUtils.getFolderContents(aFolder).root;
+
+ // Menu bookmarks are put directly into the folder, while other roots are
+ // imported into subfolders.
+ let rootFolderCount = test_bookmarks.menu.length;
+
+ for (let i = 0; i < root.childCount; i++) {
+ let child = root.getChild(i);
+ if (i < rootFolderCount) {
+ checkItem(test_bookmarks.menu[i], child);
+ }
+ else {
+ let container = child.QueryInterface(Ci.nsINavHistoryContainerResultNode);
+ let group = /Toolbar/.test(container.title) ? test_bookmarks.toolbar
+ : test_bookmarks.unfiled;
+ container.containerOpen = true;
+ print(container.title);
+ for (let t = 0; t < container.childCount; t++) {
+ print(group[t].title + " " + container.getChild(t).title);
+ checkItem(group[t], container.getChild(t));
+ }
+ container.containerOpen = false;
+ }
+ }
+
+ root.containerOpen = false;
}
-// Tests a bookmarks datastore that has a set of bookmarks, etc
-// that flex each supported field and feature.
-function testCanonicalBookmarks(aFolder) {
- // query to see if the deleted folder and items have been imported
- var query = histsvc.getNewQuery();
- query.setFolders([aFolder], 1);
- var result = histsvc.executeQuery(query, histsvc.getNewQueryOptions());
- var rootNode = result.root;
- rootNode.containerOpen = true;
-
- // 6-2: the toolbar folder and unfiled bookmarks folder imported to the
- // corresponding places folders
- do_check_eq(rootNode.childCount, DEFAULT_BOOKMARKS_ON_MENU + 1);
-
- // get test folder
- var testFolder = rootNode.getChild(DEFAULT_BOOKMARKS_ON_MENU);
- do_check_eq(testFolder.type, testFolder.RESULT_TYPE_FOLDER);
- do_check_eq(testFolder.title, "test");
-
- // add date
- do_check_eq(bmsvc.getItemDateAdded(testFolder.itemId)/1000000, 1177541020);
- // last modified
- do_check_eq(bmsvc.getItemLastModified(testFolder.itemId)/1000000, 1177541050);
-
- testFolder = testFolder.QueryInterface(Ci.nsINavHistoryQueryResultNode);
- do_check_eq(testFolder.hasChildren, true);
- // folder description
- do_check_true(annosvc.itemHasAnnotation(testFolder.itemId,
- DESCRIPTION_ANNO));
- do_check_eq("folder test comment",
- annosvc.getItemAnnotation(testFolder.itemId, DESCRIPTION_ANNO));
- // open test folder, and test the children
- testFolder.containerOpen = true;
- var cc = testFolder.childCount;
- // XXX Bug 380468
- // do_check_eq(cc, 2);
- do_check_eq(cc, 1);
-
- // test bookmark 1
- var testBookmark1 = testFolder.getChild(0);
- // url
- do_check_eq("http://test/post", testBookmark1.uri);
- // title
- do_check_eq("test post keyword", testBookmark1.title);
- // keyword
- do_check_eq("test", bmsvc.getKeywordForBookmark(testBookmark1.itemId));
- // sidebar
- do_check_true(annosvc.itemHasAnnotation(testBookmark1.itemId,
- LOAD_IN_SIDEBAR_ANNO));
- // add date
- do_check_eq(testBookmark1.dateAdded/1000000, 1177375336);
-
- // last modified
- do_check_eq(testBookmark1.lastModified/1000000, 1177375423);
+function checkItem(aExpected, aNode)
+{
+ let id = aNode.itemId;
+ for (prop in aExpected) {
+ switch (prop) {
+ case "title":
+ do_check_eq(aNode.title, aExpected.title);
+ break;
+ case "description":
+ do_check_eq(PlacesUtils.annotations
+ .getItemAnnotation(id, PlacesUIUtils.DESCRIPTION_ANNO),
+ aExpected.description);
+ break;
+ case "dateAdded":
+ do_check_eq(PlacesUtils.bookmarks.getItemDateAdded(id),
+ aExpected.dateAdded);
+ break;
+ case "lastModified":
+ do_check_eq(PlacesUtils.bookmarks.getItemLastModified(id),
+ aExpected.lastModified);
+ break;
+ case "url":
+ if (!PlacesUtils.livemarks.isLivemark(id))
+ do_check_eq(aNode.uri, aExpected.url);
+ break;
+ case "icon":
+ let faviconURI = PlacesUtils.favicons.getFaviconForPage(
+ NetUtil.newURI(aExpected.url)
+ );
+ let dataURL = PlacesUtils.favicons.getFaviconDataAsDataURL(faviconURI);
+ // Avoid do_check_eq for console spam.
+ do_check_true(dataURL == aExpected.icon);
+ break;
+ case "keyword":
+ break;
+ case "sidebar":
+ do_check_eq(PlacesUtils.annotations
+ .itemHasAnnotation(id, PlacesUIUtils.LOAD_IN_SIDEBAR_ANNO),
+ aExpected.sidebar);
+ break;
+ case "postData":
+ do_check_eq(PlacesUtils.annotations
+ .getItemAnnotation(id, PlacesUtils.POST_DATA_ANNO),
+ aExpected.postData);
+ break;
+ case "charset":
+ do_check_eq(PlacesUtils.history.getCharsetForURI(NetUtil.newURI(aNode.uri)),
+ aExpected.charset);
+ break;
+ case "feedUrl":
+ do_check_true(PlacesUtils.livemarks.isLivemark(id));
+ do_check_eq(PlacesUtils.livemarks.getSiteURI(id).spec,
+ aExpected.url);
+ do_check_eq(PlacesUtils.livemarks.getFeedURI(id).spec,
+ aExpected.feedUrl);
+ break;
+ case "children":
+ let folder = aNode.QueryInterface(Ci.nsINavHistoryContainerResultNode);
+ do_check_eq(folder.hasChildren, aExpected.children.length > 0);
+ folder.containerOpen = true;
+ do_check_eq(folder.childCount, aExpected.children.length);
- // post data
- do_check_true(annosvc.itemHasAnnotation(testBookmark1.itemId,
- POST_DATA_ANNO));
- do_check_eq("hidden1%3Dbar&text1%3D%25s",
- annosvc.getItemAnnotation(testBookmark1.itemId, POST_DATA_ANNO));
-
- // last charset
- var testURI = uri(testBookmark1.uri);
- do_check_eq("ISO-8859-1", histsvc.getCharsetForURI(testURI));
-
- // description
- do_check_true(annosvc.itemHasAnnotation(testBookmark1.itemId,
- DESCRIPTION_ANNO));
- do_check_eq("item description",
- annosvc.getItemAnnotation(testBookmark1.itemId,
- DESCRIPTION_ANNO));
-
- // clean up
- testFolder.containerOpen = false;
- rootNode.containerOpen = false;
+ aExpected.children.forEach(function (item, index) checkItem(item, folder.getChild(index)));
- query.setFolders([bmsvc.toolbarFolder], 1);
- result = histsvc.executeQuery(query, histsvc.getNewQueryOptions());
- // bookmarks toolbar
- var toolbar = result.root;
- toolbar.containerOpen = true;
- do_check_eq(toolbar.childCount, 2);
-
- // livemark
- var livemark = toolbar.getChild(1);
- // title
- do_check_eq("Latest Headlines", livemark.title);
- // livemark check
- do_check_true(livemarksvc.isLivemark(livemark.itemId));
- // site url
- do_check_eq("http://en-us.fxfeeds.mozilla.com/en-US/firefox/livebookmarks/",
- livemarksvc.getSiteURI(livemark.itemId).spec);
- // feed url
- do_check_eq("http://en-us.fxfeeds.mozilla.com/en-US/firefox/headlines.xml",
- livemarksvc.getFeedURI(livemark.itemId).spec);
-
- toolbar.containerOpen = false;
-
- // unfiled bookmarks
- query.setFolders([bmsvc.unfiledBookmarksFolder], 1);
- result = histsvc.executeQuery(query, histsvc.getNewQueryOptions());
- var unfiledBookmarks = result.root;
- unfiledBookmarks.containerOpen = true;
- do_check_eq(unfiledBookmarks.childCount, 1);
- unfiledBookmarks.containerOpen = false;
-
- // favicons
- var faviconURI = iconsvc.getFaviconForPage(uri(TEST_FAVICON_PAGE_URL));
- var dataURL = iconsvc.getFaviconDataAsDataURL(faviconURI);
- do_check_eq(TEST_FAVICON_DATA_URL, dataURL);
+ folder.containerOpen = false;
+ break;
+ default:
+ throw new Error("Unknown property");
+ }
+ };
}
--- a/browser/components/preferences/aboutPermissions.js
+++ b/browser/components/preferences/aboutPermissions.js
@@ -420,16 +420,17 @@ let AboutPermissions = {
Services.obs.removeObserver(this, "perm-changed", false);
Services.obs.removeObserver(this, "passwordmgr-storage-changed", false);
Services.obs.removeObserver(this, "cookie-changed", false);
Services.obs.removeObserver(this, "browser:purge-domain-data", false);
}
gSitesStmt.finalize();
gVisitStmt.finalize();
+ gPlacesDatabase.asyncClose(null);
},
observe: function (aSubject, aTopic, aData) {
switch(aTopic) {
case "perm-changed":
// Permissions changes only affect individual sites.
if (!this._selectedSite) {
break;
--- a/browser/components/preferences/tests/browser_permissions.js
+++ b/browser/components/preferences/tests/browser_permissions.js
@@ -1,12 +1,11 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
-Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/PlacesUtils.jsm");
Components.utils.import("resource://gre/modules/NetUtil.jsm");
const ABOUT_PERMISSIONS_SPEC = "about:permissions";
const TEST_URI_1 = NetUtil.newURI("http://mozilla.com/");
const TEST_URI_2 = NetUtil.newURI("http://mozilla.org/");
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_certexceptionsui.js
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_certexceptionsui.js
@@ -58,16 +58,17 @@ function test() {
function step1() {
let params = {
exceptionAdded : false,
location: INVALID_CERT_LOCATION,
handlePrivateBrowsing : true,
prefetchCert: true,
};
function testCheckbox() {
+ win.removeEventListener("load", testCheckbox, false);
Services.obs.addObserver(function (aSubject, aTopic, aData) {
Services.obs.removeObserver(arguments.callee, "cert-exception-ui-ready", false);
ok(win.gCert, "The certificate information should be available now");
let checkbox = win.document.getElementById("permanent");
ok(checkbox.hasAttribute("disabled"),
"the permanent checkbox should be disabled when handling the private browsing mode");
ok(!checkbox.hasAttribute("checked"),
@@ -83,16 +84,17 @@ function test() {
// Test the certificate excetions dialog as it is invoked from the Preferences dialog
function step2() {
let params = {
exceptionAdded : false,
location: INVALID_CERT_LOCATION,
prefetchCert: true,
};
function testCheckbox() {
+ win.removeEventListener("load", testCheckbox, false);
Services.obs.addObserver(function (aSubject, aTopic, aData) {
Services.obs.removeObserver(arguments.callee, "cert-exception-ui-ready", false);
ok(win.gCert, "The certificate information should be available now");
let checkbox = win.document.getElementById("permanent");
ok(!checkbox.hasAttribute("disabled"),
"the permanent checkbox should not be disabled when not handling the private browsing mode");
ok(checkbox.hasAttribute("checked"),
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_pageinfo.js
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_pageinfo.js
@@ -47,34 +47,38 @@ function test() {
let tab1 = gBrowser.addTab();
gBrowser.selectedTab = tab1;
let browser1 = gBrowser.getBrowserForTab(tab1);
browser1.addEventListener("load", function () {
browser1.removeEventListener("load", arguments.callee, true);
let pageInfo1 = BrowserPageInfo();
pageInfo1.addEventListener("load", function () {
+ pageInfo1.removeEventListener("load", arguments.callee, false);
let tab2 = gBrowser.addTab();
gBrowser.selectedTab = tab2;
let browser2 = gBrowser.getBrowserForTab(tab2);
browser2.addEventListener("load", function () {
browser2.removeEventListener("load", arguments.callee, true);
let pageInfo2 = BrowserPageInfo();
pageInfo2.addEventListener("load", function () {
+ pageInfo2.removeEventListener("load", arguments.callee, false);
pageInfo1.addEventListener("unload", function () {
+ pageInfo1.removeEventListener("unload", arguments.callee, false);
pageInfo1 = null;
ok(true, "Page info 1 being closed as expected");
if (!pageInfo2)
aCallBack();
}, false);
pageInfo2.addEventListener("unload", function () {
+ pageInfo2.removeEventListener("unload", arguments.callee, false);
pageInfo2 = null;
ok(true, "Page info 2 being closed as expected");
if (!pageInfo1)
aCallBack();
}, false);
pb.privateBrowsingEnabled = aPBMode;
}, false);
--- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_urlbarfocus.js
+++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_urlbarfocus.js
@@ -54,31 +54,37 @@ function test() {
"URL Bar should not be focused before entering the private browsing mode");
// ensure that the URL bar is not empty initially
isnot(gURLBar.value, "", "URL Bar should no longer be empty after leaving the private browsing mode");
// enter private browsing mode
pb.privateBrowsingEnabled = true;
browser = gBrowser.selectedBrowser;
browser.addEventListener("load", function() {
+ browser.removeEventListener("load", arguments.callee, true);
+
// setTimeout is needed here because the onload handler of about:privatebrowsing sets the focus
setTimeout(function() {
// ensure that the URL bar is focused inside the private browsing mode
is(document.commandDispatcher.focusedElement, gURLBar.inputField,
"URL Bar should be focused inside the private browsing mode");
+
// ensure that the URL bar is emptied inside the private browsing mode
is(gURLBar.value, "", "URL Bar should be empty inside the private browsing mode");
// leave private browsing mode
pb.privateBrowsingEnabled = false;
browser = gBrowser.selectedBrowser;
browser.addEventListener("load", function() {
+ browser.removeEventListener("load", arguments.callee, true);
+
// ensure that the URL bar is no longer focused after leaving the private browsing mode
isnot(document.commandDispatcher.focusedElement, gURLBar.inputField,
"URL Bar should no longer be focused after leaving the private browsing mode");
+
// ensure that the URL bar is no longer empty after leaving the private browsing mode
isnot(gURLBar.value, "", "URL Bar should no longer be empty after leaving the private browsing mode");
gBrowser.removeCurrentTab();
finish();
}, true);
}, 0);
}, true);
--- a/browser/components/sessionstore/src/nsSessionStore.js
+++ b/browser/components/sessionstore/src/nsSessionStore.js
@@ -864,17 +864,24 @@ SessionStoreService.prototype = {
delete this._statesToRestore[aWindow.__SS_restoreID];
delete aWindow.__SS_restoreID;
}
// ignore windows not tracked by SessionStore
if (!aWindow.__SSi || !this._windows[aWindow.__SSi]) {
return;
}
-
+
+ // notify that the session store will stop tracking this window so that
+ // extensions can store any data about this window in session store before
+ // that's not possible anymore
+ let event = aWindow.document.createEvent("Events");
+ event.initEvent("SSWindowClosing", true, false);
+ aWindow.dispatchEvent(event);
+
if (this.windowToFocus && this.windowToFocus == aWindow) {
delete this.windowToFocus;
}
var tabbrowser = aWindow.gBrowser;
TAB_EVENTS.forEach(function(aEvent) {
tabbrowser.tabContainer.removeEventListener(aEvent, this, true);
--- a/browser/components/sessionstore/test/browser/Makefile.in
+++ b/browser/components/sessionstore/test/browser/Makefile.in
@@ -142,16 +142,17 @@ include $(topsrcdir)/config/rules.mk
browser_615394-SSWindowState_events.js \
browser_618151.js \
browser_623779.js \
browser_624727.js \
browser_625257.js \
browser_628270.js \
browser_635418.js \
browser_636279.js \
+ browser_659591.js \
$(NULL)
ifneq ($(OS_ARCH),Darwin)
_BROWSER_TEST_FILES += \
browser_597071.js \
$(NULL)
endif
--- a/browser/components/sessionstore/test/browser/browser_394759.js
+++ b/browser/components/sessionstore/test/browser/browser_394759.js
@@ -66,16 +66,18 @@ function test() {
// make sure that the next closed window will increase getClosedWindowCount
let max_windows_undo = gPrefService.getIntPref("browser.sessionstore.max_windows_undo");
gPrefService.setIntPref("browser.sessionstore.max_windows_undo", max_windows_undo + 1);
let closedWindowCount = ss.getClosedWindowCount();
let newWin = openDialog(location, "", "chrome,all,dialog=no", testURL);
newWin.addEventListener("load", function(aEvent) {
+ newWin.removeEventListener("load", arguments.callee, false);
+
newWin.gBrowser.selectedBrowser.addEventListener("load", function(aEvent) {
newWin.gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
executeSoon(function() {
newWin.gBrowser.addTab().linkedBrowser.stop();
executeSoon(function() {
// mark the window with some unique data to be restored later on
ss.setWindowValue(newWin, uniqueKey, uniqueValue);
@@ -97,16 +99,18 @@ function test() {
"undoCloseWindow actually returned a window");
is(ss.getClosedWindowCount(), closedWindowCount,
"The reopened window was removed from Recently Closed Windows");
// SSTabRestored will fire more than once, so we need to make sure we count them
let restoredTabs = 0;
let expectedTabs = data.tabs.length;
newWin2.addEventListener("load", function(aEvent) {
+ newWin2.removeEventListener("load", arguments.callee, false);
+
newWin2.gBrowser.tabContainer.addEventListener("SSTabRestored", function(aEvent) {
if (++restoredTabs < expectedTabs)
return;
newWin2.gBrowser.tabContainer.removeEventListener("SSTabRestored", arguments.callee, true);
is(newWin2.gBrowser.tabs.length, 2,
"The window correctly restored 2 tabs");
is(newWin2.gBrowser.currentURI.spec, testURL,
@@ -155,31 +159,33 @@ function test() {
}
// hack to force window to be considered a popup (toolbar=no didn't work)
let winData = windowsToOpen.shift();
let settings = "chrome,dialog=no," +
(winData.isPopup ? "all=no" : "all");
let url = "http://window" + windowsToOpen.length + ".example.com";
let win = openDialog(location, "", settings, url);
win.addEventListener("load", function(aEvent) {
+ win.removeEventListener("load", arguments.callee, false);
+
win.gBrowser.selectedBrowser.addEventListener("DOMContentLoaded", function(aEvent) {
win.gBrowser.selectedBrowser.removeEventListener("DOMContentLoaded", arguments.callee, true);
// the window _should_ have state with a tab of url, but it doesn't
// always happend before window.close(). addTab ensure we don't treat
// this window as a stateless window
win.gBrowser.addTab();
executeSoon(function() {
win.close();
executeSoon(function() {
openWindowRec(windowsToOpen, expectedResults, recCallback);
});
});
}, true);
- }, true);
+ }, false);
}
let windowsToOpen = [{isPopup: false},
{isPopup: false},
{isPopup: true},
{isPopup: true},
{isPopup: true}];
let expectedResults = {mac: {popup: 3, normal: 0},
--- a/browser/components/sessionstore/test/browser/browser_461634.js
+++ b/browser/components/sessionstore/test/browser/browser_461634.js
@@ -43,71 +43,73 @@ function browserWindowsCount() {
++count;
}
return count;
}
function test() {
/** Test for Bug 461634 **/
is(browserWindowsCount(), 1, "Only one browser window should be open initially");
-
+
// test setup
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
waitForExplicitFinish();
-
+
const REMEMBER = Date.now(), FORGET = Math.random();
let test_state = { windows: [{ "tabs": [{ "entries": [] }], _closedTabs: [
{ state: { entries: [{ url: "http://www.example.net/" }] }, title: FORGET },
{ state: { entries: [{ url: "http://www.example.net/" }] }, title: REMEMBER },
{ state: { entries: [{ url: "http://www.example.net/" }] }, title: FORGET },
{ state: { entries: [{ url: "http://www.example.net/" }] }, title: REMEMBER },
] }] };
let remember_count = 2;
-
+
function countByTitle(aClosedTabList, aTitle)
aClosedTabList.filter(function(aData) aData.title == aTitle).length;
-
+
function testForError(aFunction) {
try {
aFunction();
return false;
}
catch (ex) {
return ex.name == "NS_ERROR_ILLEGAL_VALUE";
}
}
-
+
// open a window and add the above closed tab list
let newWin = openDialog(location, "", "chrome,all,dialog=no");
newWin.addEventListener("load", function(aEvent) {
+ newWin.removeEventListener("load", arguments.callee, false);
+
gPrefService.setIntPref("browser.sessionstore.max_tabs_undo",
test_state.windows[0]._closedTabs.length);
ss.setWindowState(newWin, JSON.stringify(test_state), true);
-
+
let closedTabs = JSON.parse(ss.getClosedTabData(newWin));
is(closedTabs.length, test_state.windows[0]._closedTabs.length,
"Closed tab list has the expected length");
is(countByTitle(closedTabs, FORGET),
test_state.windows[0]._closedTabs.length - remember_count,
"The correct amout of tabs are to be forgotten");
is(countByTitle(closedTabs, REMEMBER), remember_count,
"Everything is set up.");
-
+
// all of the following calls with illegal arguments should throw NS_ERROR_ILLEGAL_VALUE
ok(testForError(function() ss.forgetClosedTab({}, 0)),
"Invalid window for forgetClosedTab throws");
ok(testForError(function() ss.forgetClosedTab(newWin, -1)),
"Invalid tab for forgetClosedTab throws");
ok(testForError(function() ss.forgetClosedTab(newWin, test_state.windows[0]._closedTabs.length + 1)),
"Invalid tab for forgetClosedTab throws");
-
+
// Remove third tab, then first tab
ss.forgetClosedTab(newWin, 2);
ss.forgetClosedTab(newWin, null);
-
+
closedTabs = JSON.parse(ss.getClosedTabData(newWin));
is(closedTabs.length, remember_count,
"The correct amout of tabs was removed");
is(countByTitle(closedTabs, FORGET), 0,
"All tabs specifically forgotten were indeed removed");
is(countByTitle(closedTabs, REMEMBER), remember_count,
"... and tabs not specifically forgetten weren't.");
--- a/browser/components/sessionstore/test/browser/browser_464199.js
+++ b/browser/components/sessionstore/test/browser/browser_464199.js
@@ -42,21 +42,21 @@ function browserWindowsCount() {
++count;
}
return count;
}
function test() {
/** Test for Bug 464199 **/
is(browserWindowsCount(), 1, "Only one browser window should be open initially");
-
+
// test setup
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
waitForExplicitFinish();
-
+
const REMEMBER = Date.now(), FORGET = Math.random();
let test_state = { windows: [{ "tabs": [{ "entries": [] }], _closedTabs: [
{ state: { entries: [{ url: "http://www.example.net/" }] }, title: FORGET },
{ state: { entries: [{ url: "http://www.example.org/" }] }, title: REMEMBER },
{ state: { entries: [{ url: "http://www.example.net/" },
{ url: "http://www.example.org/" }] }, title: FORGET },
{ state: { entries: [{ url: "http://example.net/" }] }, title: FORGET },
{ state: { entries: [{ url: "http://sub.example.net/" }] }, title: FORGET },
@@ -74,48 +74,50 @@ function test() {
] }] }, title: FORGET },
{ state: { entries: [{ url: "http://www.example.org/form",
formdata: { "#url": "http://www.example.net/" }
}] }, title: REMEMBER },
{ state: { entries: [{ url: "http://www.example.org/form" }],
extData: { "setTabValue": "http://example.net:80" } }, title: REMEMBER }
] }] };
let remember_count = 5;
-
+
function countByTitle(aClosedTabList, aTitle)
aClosedTabList.filter(function(aData) aData.title == aTitle).length;
-
+
// open a window and add the above closed tab list
let newWin = openDialog(location, "", "chrome,all,dialog=no");
newWin.addEventListener("load", function(aEvent) {
+ newWin.removeEventListener("load", arguments.callee, false);
+
gPrefService.setIntPref("browser.sessionstore.max_tabs_undo",
test_state.windows[0]._closedTabs.length);
ss.setWindowState(newWin, JSON.stringify(test_state), true);
let closedTabs = JSON.parse(ss.getClosedTabData(newWin));
is(closedTabs.length, test_state.windows[0]._closedTabs.length,
"Closed tab list has the expected length");
is(countByTitle(closedTabs, FORGET),
test_state.windows[0]._closedTabs.length - remember_count,
"The correct amout of tabs are to be forgotten");
is(countByTitle(closedTabs, REMEMBER), remember_count,
"Everything is set up.");
-
+
let pb = Cc["@mozilla.org/privatebrowsing;1"].
getService(Ci.nsIPrivateBrowsingService);
pb.removeDataFromDomain("example.net");
-
+
closedTabs = JSON.parse(ss.getClosedTabData(newWin));
is(closedTabs.length, remember_count,
"The correct amout of tabs was removed");
is(countByTitle(closedTabs, FORGET), 0,
"All tabs to be forgotten were indeed removed");
is(countByTitle(closedTabs, REMEMBER), remember_count,
"... and tabs to be remembered weren't.");
-
+
// clean up
newWin.close();
is(browserWindowsCount(), 1, "Only one browser window should be open eventually");
if (gPrefService.prefHasUserValue("browser.sessionstore.max_tabs_undo"))
gPrefService.clearUserPref("browser.sessionstore.max_tabs_undo");
finish();
}, false);
}
--- a/browser/components/sessionstore/test/browser/browser_465223.js
+++ b/browser/components/sessionstore/test/browser/browser_465223.js
@@ -42,50 +42,52 @@ function browserWindowsCount() {
++count;
}
return count;
}
function test() {
/** Test for Bug 465223 **/
is(browserWindowsCount(), 1, "Only one browser window should be open initially");
-
+
// test setup
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
waitForExplicitFinish();
-
+
let uniqueKey1 = "bug 465223.1";
let uniqueKey2 = "bug 465223.2";
let uniqueValue1 = "unik" + Date.now();
let uniqueValue2 = "pi != " + Math.random();
-
+
// open a window and set a value on it
let newWin = openDialog(location, "_blank", "chrome,all,dialog=no");
newWin.addEventListener("load", function(aEvent) {
+ newWin.removeEventListener("load", arguments.callee, false);
+
ss.setWindowValue(newWin, uniqueKey1, uniqueValue1);
-
+
let newState = { windows: [{ tabs:[{ entries: [] }], extData: {} }] };
newState.windows[0].extData[uniqueKey2] = uniqueValue2;
ss.setWindowState(newWin, JSON.stringify(newState), false);
-
+
is(newWin.gBrowser.tabs.length, 2,
"original tab wasn't overwritten");
is(ss.getWindowValue(newWin, uniqueKey1), uniqueValue1,
"window value wasn't overwritten when the tabs weren't");
is(ss.getWindowValue(newWin, uniqueKey2), uniqueValue2,
"new window value was correctly added");
-
+
newState.windows[0].extData[uniqueKey2] = uniqueValue1;
ss.setWindowState(newWin, JSON.stringify(newState), true);
-
+
is(newWin.gBrowser.tabs.length, 1,
"original tabs were overwritten");
is(ss.getWindowValue(newWin, uniqueKey1), "",
"window value was cleared");
is(ss.getWindowValue(newWin, uniqueKey2), uniqueValue1,
"window value was correctly overwritten");
-
+
// clean up
newWin.close();
is(browserWindowsCount(), 1, "Only one browser window should be open eventually");
finish();
}, false);
}
--- a/browser/components/sessionstore/test/browser/browser_477657.js
+++ b/browser/components/sessionstore/test/browser/browser_477657.js
@@ -52,60 +52,62 @@ function test() {
if ("nsILocalFileMac" in Ci)
return;
let ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore);
waitForExplicitFinish();
let newWin = openDialog(location, "_blank", "chrome,all,dialog=no");
newWin.addEventListener("load", function(aEvent) {
+ newWin.removeEventListener("load", arguments.callee, false);
+
let newState = { windows: [{
tabs: [{ entries: [] }],
_closedTabs: [{
state: { entries: [{ url: "about:" }]},
title: "About:"
}],
sizemode: "maximized"
}] };
-
+
let uniqueKey = "bug 477657";
let uniqueValue = "unik" + Date.now();
-
+
ss.setWindowValue(newWin, uniqueKey, uniqueValue);
is(ss.getWindowValue(newWin, uniqueKey), uniqueValue,
"window value was set before the window was overwritten");
ss.setWindowState(newWin, JSON.stringify(newState), true);
-
+
// use setTimeout(..., 0) to mirror sss_restoreWindowFeatures
setTimeout(function() {
is(ss.getWindowValue(newWin, uniqueKey), "",
"window value was implicitly cleared");
-
+
is(newWin.windowState, newWin.STATE_MAXIMIZED,
"the window was maximized");
-
+
is(JSON.parse(ss.getClosedTabData(newWin)).length, 1,
"the closed tab was added before the window was overwritten");
delete newState.windows[0]._closedTabs;
delete newState.windows[0].sizemode;
ss.setWindowState(newWin, JSON.stringify(newState), true);
-
+
setTimeout(function() {
is(JSON.parse(ss.getClosedTabData(newWin)).length, 0,
"closed tabs were implicitly cleared");
-
+
is(newWin.windowState, newWin.STATE_MAXIMIZED,
"the window remains maximized");
newState.windows[0].sizemode = "normal";
ss.setWindowState(newWin, JSON.stringify(newState), true);
-
+
setTimeout(function() {
isnot(newWin.windowState, newWin.STATE_MAXIMIZED,
"the window was explicitly unmaximized");
-
+
newWin.close();
is(browserWindowsCount(), 1, "Only one browser window should be open eventually");
finish();
}, 0);
}, 0);
}, 0);
}, false);
}
--- a/browser/components/sessionstore/test/browser/browser_514751.js
+++ b/browser/components/sessionstore/test/browser/browser_514751.js
@@ -61,16 +61,18 @@ function test() {
{}
]
}]
}]
};
var theWin = openDialog(location, "", "chrome,all,dialog=no");
theWin.addEventListener("load", function () {
+ theWin.removeEventListener("load", arguments.callee, false);
+
executeSoon(function () {
var gotError = false;
try {
ss.setWindowState(theWin, JSON.stringify(state), true);
} catch (e) {
if (/NS_ERROR_MALFORMED_URI/.test(e))
gotError = true;
}
--- a/browser/components/sessionstore/test/browser/browser_528776.js
+++ b/browser/components/sessionstore/test/browser/browser_528776.js
@@ -15,14 +15,15 @@ function browserWindowsCount(expected) {
function test() {
waitForExplicitFinish();
browserWindowsCount(1);
var win = openDialog(location, "", "chrome,all,dialog=no");
win.addEventListener("load", function () {
+ win.removeEventListener("load", arguments.calle, false);
browserWindowsCount(2);
win.close();
browserWindowsCount(1);
finish();
}, false);
}
--- a/browser/components/sessionstore/test/browser/browser_579868.js
+++ b/browser/components/sessionstore/test/browser/browser_579868.js
@@ -32,20 +32,22 @@
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
function test() {
let tab1 = gBrowser.addTab("about:robots");
let tab2 = gBrowser.addTab("about:mozilla");
- tab1.addEventListener("load", mainPart, true);
+ tab1.linkedBrowser.addEventListener("load", mainPart, true);
waitForExplicitFinish();
function mainPart() {
+ tab1.linkedBrowser.removeEventListener("load", mainPart, true);
+
// Tell the session storer that the tab is pinned
let newTabState = '{"entries":[{"url":"about:robots"}],"pinned":true,"userTypedValue":"Hello World!"}';
let ss = Cc["@mozilla.org/browser/sessionstore;1"]
.getService(Ci.nsISessionStore);
ss.setTabState(tab1, newTabState);
// Undo pinning
gBrowser.unpinTab(tab1);
--- a/browser/components/sessionstore/test/browser/browser_579879.js
+++ b/browser/components/sessionstore/test/browser/browser_579879.js
@@ -1,15 +1,17 @@
function test() {
waitForExplicitFinish();
var tab1 = gBrowser.addTab("data:text/plain,foo");
gBrowser.pinTab(tab1);
tab1.linkedBrowser.addEventListener("load", function () {
+ tab1.linkedBrowser.removeEventListener("load", arguments.callee, true);
+
var tab2 = gBrowser.addTab();
gBrowser.pinTab(tab2);
is(Array.indexOf(gBrowser.tabs, tab1), 0, "pinned tab 1 is at the first position");
gBrowser.removeTab(tab1);
tab1 = undoCloseTab();
ok(tab1.pinned, "pinned tab 1 has been restored as a pinned tab");
is(Array.indexOf(gBrowser.tabs, tab1), 0, "pinned tab 1 has been restored to the first position");
--- a/browser/components/sessionstore/test/browser/browser_580512.js
+++ b/browser/components/sessionstore/test/browser/browser_580512.js
@@ -39,16 +39,17 @@ function checkSecondWin(win) {
function openWinWithCb(cb, argURIs, expectedURIs) {
if (!expectedURIs)
expectedURIs = argURIs;
var win = openDialog("chrome://browser/content/", "_blank",
"chrome,all,dialog=no", argURIs.join("|"));
win.addEventListener("load", function () {
+ win.removeEventListener("load", arguments.callee, false);
info("the window loaded");
var expectedLoads = expectedURIs.length;
win.gBrowser.addTabsProgressListener({
onStateChange: function (aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
if (aRequest &&
aStateFlags & Ci.nsIWebProgressListener.STATE_STOP &&
--- a/browser/components/sessionstore/test/browser/browser_589246.js
+++ b/browser/components/sessionstore/test/browser/browser_589246.js
@@ -201,17 +201,20 @@ function onStateRestored(aSubject, aTopi
newWin.gBrowser.selectedBrowser.addEventListener("load", function() {
newWin.gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
// pin this tab
if (shouldPinTab)
newWin.gBrowser.pinTab(newWin.gBrowser.selectedTab);
- newWin.addEventListener("unload", onWindowUnloaded, false);
+ newWin.addEventListener("unload", function () {
+ newWin.removeEventListener("unload", arguments.callee, false);
+ onWindowUnloaded();
+ }, false);
// Open a new tab as well. On Windows/Linux this will be restored when the
// new window is opened below (in onWindowUnloaded). On OS X we'll just
// restore the pinned tabs, leaving the unpinned tab in the closedWindowsData.
if (shouldOpenTabs) {
let newTab = newWin.gBrowser.addTab("about:config");
let newTab2 = newWin.gBrowser.addTab("about:buildconfig");
newTab.linkedBrowser.addEventListener("load", function() {
@@ -252,16 +255,18 @@ function onWindowUnloaded() {
let previousClosedWindowData = ss.getClosedWindowData();
// Now we want to open a new window
let newWin = openDialog(location, "_blank", "chrome,all,dialog=no", "about:robots");
newWin.addEventListener("load", function(aEvent) {
newWin.removeEventListener("load", arguments.callee, false);
newWin.gBrowser.selectedBrowser.addEventListener("load", function () {
+ newWin.gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
+
// Good enough for checking the state
afterTestCallback(previousClosedWindowData, ss.getClosedWindowData());
afterTestCleanup(newWin);
}, true);
}, false);
}
--- a/browser/components/sessionstore/test/browser/browser_597071.js
+++ b/browser/components/sessionstore/test/browser/browser_597071.js
@@ -68,28 +68,31 @@ function test() {
// set this window to be a popup.
ss.setWindowState(window, JSON.stringify(popupState), true);
// open a new non-popup window
let newWin = openDialog(location, "", "chrome,all,dialog=no", "http://example.com");
newWin.addEventListener("load", function(aEvent) {
newWin.removeEventListener("load", arguments.callee, false);
+
newWin.gBrowser.addEventListener("load", function(aEvent) {
newWin.gBrowser.removeEventListener("load", arguments.callee, true);
newWin.gBrowser.addTab().linkedBrowser.stop();
// make sure there are 2 windows open
is(browserWindowsCount(), 2, "there should be 2 windows open currently");
// make sure sessionstore sees this window
let state = JSON.parse(ss.getBrowserState());
is(state.windows.length, 2, "sessionstore knows about this window");
newWin.close();
newWin.addEventListener("unload", function(aEvent) {
+ newWin.removeEventListener("unload", arguments.callee, false);
+
is(ss.getClosedWindowCount(), closedWindowCount + 1,
"increased closed window count");
is(browserWindowsCount(), 1, "there should be 1 window open currently");
try {
Services.prefs.clearUserPref("browser.sessionstore.max_windows_undo");
} catch (e) {}
ss.setBrowserState(currentState);
--- a/browser/components/sessionstore/test/browser/browser_615394-SSWindowState_events.js
+++ b/browser/components/sessionstore/test/browser/browser_615394-SSWindowState_events.js
@@ -30,17 +30,17 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-const ss = Cc["@mozilla.org/browser/sessionstore;1"].
+var ss = Cc["@mozilla.org/browser/sessionstore;1"].
getService(Ci.nsISessionStore);
const stateBackup = ss.getBrowserState();
const testState = {
windows: [{
tabs: [
{ entries: [{ url: "about:blank" }] },
{ entries: [{ url: "about:robots" }] }
@@ -287,21 +287,23 @@ function test_setWindowState() {
function test_setBrowserState() {
// We'll track events per window so we are sure that they are each happening once
// pre window.
let windowEvents = {};
windowEvents[getOuterWindowID(window)] = { busyEventCount: 0, readyEventCount: 0 };
// waitForBrowserState does it's own observing for windows, but doesn't attach
// the listeners we want here, so do it ourselves.
+ let newWindow;
function windowObserver(aSubject, aTopic, aData) {
if (aTopic == "domwindowopened") {
- let newWindow = aSubject.QueryInterface(Ci.nsIDOMWindow);
+ newWindow = aSubject.QueryInterface(Ci.nsIDOMWindow);
newWindow.addEventListener("load", function() {
newWindow.removeEventListener("load", arguments.callee, false);
+
Services.ww.unregisterNotification(windowObserver);
windowEvents[getOuterWindowID(newWindow)] = { busyEventCount: 0, readyEventCount: 0 };
newWindow.addEventListener("SSWindowStateBusy", onSSWindowStateBusy, false);
newWindow.addEventListener("SSWindowStateReady", onSSWindowStateReady, false);
}, false);
}
@@ -327,16 +329,18 @@ function test_setBrowserState() {
is(winEvents.readyEventCount, 1,
"[test_setBrowserState] window" + id + " ready event count correct");
checkedWindows++;
}
is(checkedWindows, 2,
"[test_setBrowserState] checked 2 windows");
window.removeEventListener("SSWindowStateBusy", onSSWindowStateBusy, false);
window.removeEventListener("SSWindowStateReady", onSSWindowStateReady, false);
+ newWindow.removeEventListener("SSWindowStateBusy", onSSWindowStateBusy, false);
+ newWindow.removeEventListener("SSWindowStateReady", onSSWindowStateReady, false);
runNextTest();
});
}
function test_undoCloseWindow() {
let newWindow, reopenedWindow;
@@ -352,16 +356,17 @@ function test_undoCloseWindow() {
// Close the window which isn't window
newWindow.close();
reopenedWindow = ss.undoCloseWindow(0);
reopenedWindow.addEventListener("SSWindowStateBusy", onSSWindowStateBusy, false);
reopenedWindow.addEventListener("SSWindowStateReady", onSSWindowStateReady, false);
reopenedWindow.addEventListener("load", function() {
reopenedWindow.removeEventListener("load", arguments.callee, false);
+
reopenedWindow.gBrowser.tabContainer.addEventListener("SSTabRestored", onSSTabRestored, false);
}, false);
});
let busyEventCount = 0,
readyEventCount = 0,
tabRestoredCount = 0;
// These will listen to the reopened closed window...
--- a/browser/components/sessionstore/test/browser/browser_618151.js
+++ b/browser/components/sessionstore/test/browser/browser_618151.js
@@ -30,17 +30,17 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-const ss = Cc["@mozilla.org/browser/sessionstore;1"].
+var ss = Cc["@mozilla.org/browser/sessionstore;1"].
getService(Ci.nsISessionStore);
const stateBackup = ss.getBrowserState();
const testState = {
windows: [{
tabs: [
{ entries: [{ url: "about:blank" }] },
{ entries: [{ url: "about:robots" }] }
new file mode 100644
--- /dev/null
+++ b/browser/components/sessionstore/test/browser/browser_659591.js
@@ -0,0 +1,32 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+function test() {
+ waitForExplicitFinish();
+
+ let eventReceived = false;
+
+ registerCleanupFunction(function () {
+ ok(eventReceived, "SSWindowClosing event received");
+ });
+
+ newWindow(function (win) {
+ win.addEventListener("SSWindowClosing", function onWindowClosing() {
+ win.removeEventListener("SSWindowClosing", onWindowClosing, false);
+ eventReceived = true;
+ waitForFocus(finish);
+ }, false);
+
+ win.close();
+ });
+}
+
+function newWindow(callback) {
+ let opts = "chrome,all,dialog=no,height=800,width=800";
+ let win = window.openDialog(getBrowserURL(), "_blank", opts);
+
+ win.addEventListener("load", function onLoad() {
+ win.removeEventListener("load", onLoad, false);
+ executeSoon(function () callback(win));
+ }, false);
+}
--- a/browser/components/shell/test/browser_420786.js
+++ b/browser/components/shell/test/browser_420786.js
@@ -1,14 +1,16 @@
const DG_BACKGROUND = "/desktop/gnome/background"
const DG_IMAGE_KEY = DG_BACKGROUND + "/picture_filename";
const DG_OPTION_KEY = DG_BACKGROUND + "/picture_options";
const DG_DRAW_BG_KEY = DG_BACKGROUND + "/draw_background";
function onPageLoad() {
+ gBrowser.selectedBrowser.removeEventListener("load", onPageLoad, true);
+
var bs = Cc["@mozilla.org/intl/stringbundle;1"].
getService(Ci.nsIStringBundleService);
var brandName = bs.createBundle("chrome://branding/locale/brand.properties").
GetStringFromName("brandShortName");
var dirSvc = Cc["@mozilla.org/file/directory_service;1"].
getService(Ci.nsIDirectoryServiceProvider);
var homeDir = dirSvc.getFile("Home", {});
--- a/browser/components/sidebar/src/nsSidebar.js
+++ b/browser/components/sidebar/src/nsSidebar.js
@@ -41,18 +41,18 @@
#
# ***** END LICENSE BLOCK *****
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
const DEBUG = false; /* set to false to suppress debug messages */
+const SIDEBAR_CONTRACTID = "@mozilla.org/sidebar;1";
const SIDEBAR_CID = Components.ID("{22117140-9c6e-11d3-aaf1-00805f8a4905}");
-const nsISupports = Components.interfaces.nsISupports;
const nsISidebar = Components.interfaces.nsISidebar;
const nsISidebarExternal = Components.interfaces.nsISidebarExternal;
const nsIClassInfo = Components.interfaces.nsIClassInfo;
// File extension for Sherlock search plugin description files
const SHERLOCK_FILE_EXT_REGEXP = /\.src$/i;
function nsSidebar()
@@ -209,42 +209,23 @@ function (aDescriptionURL)
// http://msdn.microsoft.com/en-us/library/aa342526%28VS.85%29.aspx .
// XXX Implement this!
nsSidebar.prototype.IsSearchProviderInstalled =
function (aSearchURL)
{
return 0;
}
-// property of nsIClassInfo
-nsSidebar.prototype.flags = nsIClassInfo.DOM_OBJECT;
-
-// property of nsIClassInfo
-nsSidebar.prototype.classDescription = "Sidebar";
-
-// method of nsIClassInfo
-nsSidebar.prototype.getInterfaces = function(count) {
- var interfaceList = [nsISidebar, nsISidebarExternal, nsIClassInfo];
- count.value = interfaceList.length;
- return interfaceList;
-}
+nsSidebar.prototype.classInfo = XPCOMUtils.generateCI({classID: SIDEBAR_CID,
+ contractID: SIDEBAR_CONTRACTID,
+ classDescription: "Sidebar",
+ interfaces: [nsISidebar, nsISidebarExternal],
+ flags: nsIClassInfo.DOM_OBJECT});
-// method of nsIClassInfo
-nsSidebar.prototype.getHelperForLanguage = function(count) {return null;}
-
-nsSidebar.prototype.QueryInterface =
-function (iid) {
- if (iid.equals(nsISidebar) ||
- iid.equals(nsISidebarExternal) ||
- iid.equals(nsIClassInfo) ||
- iid.equals(nsISupports))
- return this;
-
- throw Components.results.NS_ERROR_NO_INTERFACE;
-};
+nsSidebar.prototype.QueryInterface = XPCOMUtils.generateQI([nsISidebar, nsISidebarExternal]);
var NSGetFactory = XPCOMUtils.generateNSGetFactory([nsSidebar]);
/* static functions */
if (DEBUG)
debug = function (s) { dump("-*- sidebar component: " + s + "\n"); }
else
debug = function (s) {}
--- a/browser/components/test/browser/browser_bug538331.js
+++ b/browser/components/test/browser/browser_bug538331.js
@@ -160,17 +160,20 @@ var gWindowCatcher = {
observe: function(subject, topic, data) {
if (topic != "domwindowopened")
return;
this.windowsOpen++;
let win = subject.QueryInterface(Ci.nsIDOMWindow);
info("window catcher caught window opening: " + win.document.documentURI);
- win.addEventListener("load", this.windowLoad.bind(this, win), false);
+ win.addEventListener("load", function () {
+ win.removeEventListener("load", arguments.callee, false);
+ gWindowCatcher.windowLoad(win);
+ }, false);
}
};
function finish_test()
{
// Reset browser.startup.homepage_override.mstone to the original value or
// clear it if it didn't exist.
if (gOriginalMStone) {
@@ -352,17 +355,20 @@ function testShowNotification()
}
}
// The last test opens an url and verifies the url from the updates.xml
// is correct.
if (i == (BG_NOTIFY_TESTS.length - 1)) {
// Wait for any windows caught by the windowcatcher to close
gWindowCatcher.finish(function () {
button.click();
- gBrowser.selectedBrowser.addEventListener("load", testNotificationURL, true);
+ gBrowser.selectedBrowser.addEventListener("load", function () {
+ gBrowser.selectedBrowser.removeEventListener("load", arguments.callee, true);
+ testNotificationURL();
+ }, true);
});
} else {
notifyBox.removeAllNotifications(true);
}
} else if (i == (BG_NOTIFY_TESTS.length - 1)) {
// If updateBox is null the test has already reported errors so bail
finish_test();
}
--- a/browser/fuel/src/fuelApplication.js
+++ b/browser/fuel/src/fuelApplication.js
@@ -35,16 +35,19 @@
*
* ***** END LICENSE BLOCK ***** */
const Ci = Components.interfaces;
const Cc = Components.classes;
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
+const APPLICATION_CID = Components.ID("fe74cf80-aa2d-11db-abbd-0800200c9a66");
+const APPLICATION_CONTRACTID = "@mozilla.org/fuel/application;1";
+
//=================================================
// Singleton that holds services and utilities
var Utilities = {
get bookmarks() {
let bookmarks = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
getService(Ci.nsINavBookmarksService);
this.__defineGetter__("bookmarks", function() bookmarks);
return this.bookmarks;
@@ -663,31 +666,32 @@ function Application() {
this.initToolkitHelpers();
this._bookmarks = null;
}
//=================================================
// Application implementation
Application.prototype = {
// for nsIClassInfo + XPCOMUtils
- classID: Components.ID("fe74cf80-aa2d-11db-abbd-0800200c9a66"),
+ classID: APPLICATION_CID,
// redefine the default factory for XPCOMUtils
_xpcom_factory: ApplicationFactory,
// for nsISupports
QueryInterface : XPCOMUtils.generateQI([Ci.fuelIApplication, Ci.extIApplication,
- Ci.nsIObserver, Ci.nsIClassInfo]),
+ Ci.nsIObserver]),
- getInterfaces : function app_gi(aCount) {
- var interfaces = [Ci.fuelIApplication, Ci.extIApplication, Ci.nsIObserver,
- Ci.nsIClassInfo];
- aCount.value = interfaces.length;
- return interfaces;
- },
+ // for nsIClassInfo
+ classInfo: XPCOMUtils.generateCI({classID: APPLICATION_CID,
+ contractID: APPLICATION_CONTRACTID,
+ interfaces: [Ci.fuelIApplication,
+ Ci.extIApplication,
+ Ci.nsIObserver],
+ flags: Ci.nsIClassInfo.SINGLETON}),
// for nsIObserver
observe: function app_observe(aSubject, aTopic, aData) {
// Call the extApplication version of this function first
this.__proto__.__proto__.observe.call(this, aSubject, aTopic, aData);
if (aTopic == "xpcom-shutdown") {
this._obs.removeObserver(this, "xpcom-shutdown");
this._bookmarks = null;
--- a/browser/locales/en-US/chrome/browser/browser.dtd
+++ b/browser/locales/en-US/chrome/browser/browser.dtd
@@ -207,29 +207,16 @@ can reach it easily. -->
<!ENTITY scratchpad.label "Scratchpad">
<!ENTITY scratchpad.accesskey "s">
<!ENTITY scratchpad.keycode "VK_F4">
<!ENTITY scratchpad.keytext "F4">
<!ENTITY inspectPanelTitle.label "HTML">
<!ENTITY inspectButton.label "Inspect">
<!ENTITY inspectButton.accesskey "I">
-<!ENTITY inspectNextButton.label "Next">
-<!ENTITY inspectNextButton.accesskey "N">
-<!ENTITY inspectPreviousButton.label "Previous">
-<!ENTITY inspectPreviousButton.accesskey "P">
-<!ENTITY inspectStyleButton.label "Style">
-<!ENTITY inspectStyleButton.accesskey "S">
-<!ENTITY inspectStylePanelTitle.label "Style">
-<!-- LOCALIZATION NOTE (inspectObjectButton.label): This button label
- - appears on the Inspector's toolbar. It is used to open and close the Object
- - panel. There is also a label in inspector.properties for the panel
- - titlebar: object.objectPanelTitle. -->
-<!ENTITY inspectObjectButton.label "Object">
-<!ENTITY inspectObjectButton.accesskey "O">
<!ENTITY getMoreDevtoolsCmd.label "Get More Tools">
<!ENTITY getMoreDevtoolsCmd.accesskey "M">
<!ENTITY fileMenu.label "File">
<!ENTITY fileMenu.accesskey "F">
<!ENTITY newNavigatorCmd.label "New Window">
<!ENTITY newNavigatorCmd.key "N">
deleted file mode 100644
--- a/browser/locales/en-US/chrome/browser/inspector.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-# LOCALIZATION NOTE (style.selectorLabel): Used in the Inspector style panel
-# to label a CSS Selector.
-style.selectorLabel=Selector
-
-# LOCALIZATION NOTE (style.inheritedFrom): used in Style panel in
-# inspector. Describes which tagname[#id] the properties are inherited from.
-style.inheritedFrom=Inherited from: #1
-
-# LOCALIZATION NOTE (style.styleItemLabel): used in Style panel in inspector.
-# Used for construction of list items, #1 = label, #2 = content.
-style.styleItemLabel=#1: #2
-
-# LOCALIZATION NOTE (object.objectPanelTitle): used in the Object Panel in the
-# Inspector tool. There's also inspectObjectButton in browser.dtd for the
-# toolbar button which allows users to open/close the Object panel.
-object.objectPanelTitle=Object
--- a/browser/locales/en-US/chrome/overrides/appstrings.properties
+++ b/browser/locales/en-US/chrome/overrides/appstrings.properties
@@ -58,9 +58,10 @@ externalProtocolTitle=External Protocol
externalProtocolPrompt=An external application must be launched to handle %1$S: links.\n\n\nRequested link:\n\n%2$S\n\nApplication: %3$S\n\n\nIf you were not expecting this request it may be an attempt to exploit a weakness in that other program. Cancel this request unless you are sure it is not malicious.\n
#LOCALIZATION NOTE (externalProtocolUnknown): The following string is shown if the application name can't be determined
externalProtocolUnknown=<Unknown>
externalProtocolChkMsg=Remember my choice for all links of this type.
externalProtocolLaunchBtn=Launch application
malwareBlocked=The site at %S has been reported as an attack site and has been blocked based on your security preferences.
phishingBlocked=The web site at %S has been reported as a web forgery designed to trick users into sharing personal or financial information.
cspFrameAncestorBlocked=This page has a content security policy that prevents it from being embedded in this way.
+corruptedContentError=The page you are trying to view cannot be shown because an error in the data transmission was detected.
remoteXUL=This page uses an unsupported technology that is no longer available by default in Firefox.
--- a/browser/locales/en-US/chrome/overrides/netError.dtd
+++ b/browser/locales/en-US/chrome/overrides/netError.dtd
@@ -48,24 +48,19 @@
<strong>/</strong>).</li>
</ul>
">
<!ENTITY netInterrupt.title "The connection was interrupted">
<!ENTITY netInterrupt.longDesc "&sharedLongDesc;">
<!ENTITY netOffline.title "Offline mode">
-<!-- LOCALIZATION NOTE (netOffline.overrideLongDesc) - This string should
- indicate that "Work Offline" is a menu item without being too specific,
- since it could be in either the normal menu (Mac/Linux) or the Firefox button
- menu (Windows).
--->
-<!ENTITY netOffline.overrideLongDesc "
+<!ENTITY netOffline.longDesc2 "
<ul>
- <li>Uncheck the "Work Offline" menu item, then try again.</li>
+ <li>Press "Try Again" to switch to online mode and reload the page.</li>
</ul>
">
<!ENTITY contentEncodingError.title "Content Encoding Error">
<!ENTITY contentEncodingError.longDesc "
<ul>
<li>Please contact the website owners to inform them of this problem.</li>
</ul>
@@ -166,16 +161,20 @@ be temporary, and you can try again late
<!ENTITY phishingBlocked.longDesc "
<p>Entering any personal information on this page may result in identity theft or other fraud.</p>
<p>These types of web forgeries are used in scams known as phishing attacks, in which fraudulent web pages and emails are used to imitate sources you may trust.</p>
">
<!ENTITY cspFrameAncestorBlocked.title "Blocked by Content Security Policy">
<!ENTITY cspFrameAncestorBlocked.longDesc "<p>&brandShortName; prevented this page from loading in this way because the page has a content security policy that disallows it.</p>">
+<!ENTITY corruptedContentError.title "Corrupted Content Error">
+<!ENTITY corruptedContentError.longDesc "<p>The page you are trying to view cannot be shown because an error in the data transmission was detected.</p><ul><li>Please contact the website owners to inform them of this problem.</li></ul>">
+
+
<!ENTITY securityOverride.linkText "Or you can add an exception…">
<!ENTITY securityOverride.getMeOutOfHereButton "Get me out of here!">
<!ENTITY securityOverride.exceptionButtonLabel "Add Exception…">
<!-- LOCALIZATION NOTE (securityOverride.warningContent) - Do not translate the
contents of the <button> tags. It uses strings already defined above. The
button is included here (instead of netError.xhtml) because it exposes
functionality specific to firefox. -->
--- a/browser/locales/jar.mn
+++ b/browser/locales/jar.mn
@@ -9,17 +9,16 @@
locale/browser/aboutHome.dtd (%chrome/browser/aboutHome.dtd)
locale/browser/aboutSessionRestore.dtd (%chrome/browser/aboutSessionRestore.dtd)
#ifdef MOZ_SERVICES_SYNC
locale/browser/aboutSyncTabs.dtd (%chrome/browser/aboutSyncTabs.dtd)
#endif
* locale/browser/browser.dtd (%chrome/browser/browser.dtd)
locale/browser/baseMenuOverlay.dtd (%chrome/browser/baseMenuOverlay.dtd)
locale/browser/browser.properties (%chrome/browser/browser.properties)
- locale/browser/inspector.properties (%chrome/browser/inspector.properties)
locale/browser/scratchpad.properties (%chrome/browser/scratchpad.properties)
locale/browser/scratchpad.dtd (%chrome/browser/scratchpad.dtd)
locale/browser/openLocation.dtd (%chrome/browser/openLocation.dtd)
locale/browser/openLocation.properties (%chrome/browser/openLocation.properties)
* locale/browser/pageInfo.dtd (%chrome/browser/pageInfo.dtd)
locale/browser/pageInfo.properties (%chrome/browser/pageInfo.properties)
locale/browser/quitDialog.properties (%chrome/browser/quitDialog.properties)
* locale/browser/safeMode.dtd (%chrome/browser/safeMode.dtd)
new file mode 100755
--- /dev/null
+++ b/build/autoconf/libstdcxx.py
@@ -0,0 +1,73 @@
+#!/usr/bin/python
+
+# This script find the version of libstdc++ and prints it as single number
+# with 8 bits per element. For example, GLIBCXX_3.4.10 becomes
+# 3 << 16 | 4 << 8 | 10 = 197642. This format is easy to use
+# in the C preprocessor.
+
+# We find out both the host and target versions. Since the output
+# will be used from shell, we just print the two assignments and evaluate
+# them from shell.
+
+import os
+import subprocess
+import re
+
+re_for_ld = re.compile('.*\((.*)\).*')
+
+def parse_readelf_line(x):
+ """Return the version from a readelf line that looks like:
+ 0x00ec: Rev: 1 Flags: none Index: 8 Cnt: 2 Name: GLIBCXX_3.4.6
+ """
+ return x.split(':')[-1].split('_')[-1].strip()
+
+def parse_ld_line(x):
+ """Parse a line from the output of ld -t. The output of gold is just
+ the full path, gnu ld prints "-lstdc++ (path)".
+ """
+ t = re_for_ld.match(x)
+ if t:
+ return t.groups()[0].strip()
+ return x.strip()
+
+def split_ver(v):
+ """Covert the string '1.2.3' into the list [1,2,3]
+ """
+ return [int(x) for x in v.split('.')]
+
+def cmp_ver(a, b):
+ """Compare versions in the form 'a.b.c'
+ """
+ for (i, j) in zip(split_ver(a), split_ver(b)):
+ if i != j:
+ return i - j
+ return 0
+
+def encode_ver(v):
+ """Encode the version as a single number.
+ """
+ t = split_ver(v)
+ return t[0] << 16 | t[1] << 8 | t[2]
+
+def find_version(e):
+ """Given the value of environment variable CXX or HOST_CXX, find the
+ version of the libstdc++ it uses.
+ """
+ args = e.split()
+ args += ['-shared', '-Wl,-t']
+ p = subprocess.Popen(args, stderr=subprocess.STDOUT, stdout=subprocess.PIPE)
+ candidates = [x for x in p.stdout if 'libstdc++.so' in x]
+ assert len(candidates) == 1
+ libstdcxx = parse_ld_line(candidates[-1])
+
+ p = subprocess.Popen(['readelf', '-V', libstdcxx], stdout=subprocess.PIPE)
+ versions = [parse_readelf_line(x)
+ for x in p.stdout.readlines() if 'Name: GLIBCXX' in x]
+ last_version = sorted(versions, cmp = cmp_ver)[-1]
+ return encode_ver(last_version)
+
+if __name__ == '__main__':
+ cxx_env = os.environ['CXX']
+ print 'MOZ_LIBSTDCXX_TARGET_VERSION=%s' % find_version(cxx_env)
+ host_cxx_env = os.environ.get('HOST_CXX', cxx_env)
+ print 'MOZ_LIBSTDCXX_HOST_VERSION=%s' % find_version(host_cxx_env)
--- a/build/automation.py.in
+++ b/build/automation.py.in
@@ -329,16 +329,18 @@ class Automation(object):
# Set up permissions database
locations = self.readLocations()
self.setupPermissionsDatabase(profileDir,
{'allowXULXBL':[(l.host, 'noxul' not in l.options) for l in locations]});
part = """\
user_pref("browser.console.showInPanel", true);
user_pref("browser.dom.window.dump.enabled", true);
+user_pref("browser.firstrun.show.localepicker", false);
+user_pref("browser.firstrun.show.uidiscovery", false);
user_pref("dom.allow_scripts_to_close_windows", true);
user_pref("dom.disable_open_during_load", false);
user_pref("dom.max_script_run_time", 0); // no slow script dialogs
user_pref("dom.max_chrome_script_run_time", 0);
user_pref("dom.popup_maximum", -1);
user_pref("dom.send_after_paint_to_content", true);
user_pref("dom.successive_dialog_time_limit", 0);
user_pref("signed.applets.codebase_principal_support", true);
old mode 100755
new mode 100644
old mode 100755
new mode 100644
--- a/build/pgo/profileserver.py
+++ b/build/pgo/profileserver.py
@@ -49,17 +49,17 @@ from datetime import datetime
SCRIPT_DIR = os.path.abspath(os.path.realpath(os.path.dirname(sys.argv[0])))
sys.path.insert(0, SCRIPT_DIR)
from automation import Automation
from automationutils import getDebuggerInfo, addCommonOptions
PORT = 8888
PROFILE_DIRECTORY = os.path.abspath(os.path.join(SCRIPT_DIR, "./pgoprofile"))
-MOZ_JAR_LOG_DIR = os.path.abspath(os.path.join(os.getenv("OBJDIR"), "jarlog"))
+MOZ_JAR_LOG_DIR = os.path.abspath(os.getenv("JARLOG_DIR"))
os.chdir(SCRIPT_DIR)
class EasyServer(SocketServer.TCPServer):
allow_reuse_address = True
if __name__ == '__main__':
from optparse import OptionParser
automation = Automation()
--- a/build/stdc++compat.cpp
+++ b/build/stdc++compat.cpp
@@ -36,27 +36,40 @@
* ***** END LICENSE BLOCK ***** */
#include <ostream>
#include <istream>
#ifdef DEBUG
#include <string>
#endif
+
+/* GLIBCXX_3.4.8 is from gcc 4.1.1 (111691)
+ GLIBCXX_3.4.9 is from gcc 4.2.0 (111690)
+ GLIBCXX_3.4.10 is from gcc 4.3.0 (126287)
+ GLIBCXX_3.4.11 is from gcc 4.4.0 (133006)
+ GLIBCXX_3.4.12 is from gcc 4.4.1 (147138)
+ GLIBCXX_3.4.13 is from gcc 4.4.2 (151127)
+ GLIBCXX_3.4.14 is from gcc 4.5.0 (151126)
+ GLIBCXX_3.4.15 is from gcc 4.6.0 (160071)
+ GLIBCXX_3.4.16 is form gcc 4.6.1 (172240) */
+
+#define GLIBCXX_VERSION(a, b, c) (((a) << 16) | ((b) << 8) | (c))
+
namespace std {
-#if (__GNUC__ == 4) && (__GNUC_MINOR__ >= 2)
+#if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 9)
/* Instantiate these templates to avoid GLIBCXX_3.4.9 symbol versions */
template ostream& ostream::_M_insert(double);
template ostream& ostream::_M_insert(long);
template ostream& ostream::_M_insert(unsigned long);
template ostream& __ostream_insert(ostream&, const char*, streamsize);
template istream& istream::_M_extract(double&);
#endif
#ifdef DEBUG
-#if (__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)
+#if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 14)
/* Instantiate these templates to avoid GLIBCXX_3.4.14 symbol versions
* in debug builds */
template char *string::_S_construct_aux_2(size_type, char, allocator<char> const&);
#ifdef _GLIBCXX_USE_WCHAR_T
template wchar_t *wstring::_S_construct_aux_2(size_type, wchar_t, allocator<wchar_t> const&);
#endif /* _GLIBCXX_USE_WCHAR_T */
#ifdef __GXX_EXPERIMENTAL_CXX0X__
template string::basic_string(string&&);
@@ -65,45 +78,45 @@ namespace std {
template wstring& wstring::operator=(wstring&&);
template wstring& wstring::assign(wstring&&);
#endif /* __GXX_EXPERIMENTAL_CXX0X__ */
#endif /* (__GNUC__ == 4) && (__GNUC_MINOR__ >= 5) */
#endif /* DEBUG */
}
namespace std __attribute__((visibility("default"))) {
-#if (__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)
+#if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 14)
/* Hack to avoid GLIBCXX_3.4.14 symbol versions */
struct _List_node_base
{
void hook(_List_node_base * const __position) throw ();
void unhook() throw ();
void transfer(_List_node_base * const __first,
_List_node_base * const __last) throw();
/* Hack to avoid GLIBCXX_3.4.15 symbol versions */
-#if (__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)
+#if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 15)
static void swap(_List_node_base& __x, _List_node_base& __y) throw ();
};
namespace __detail {
struct _List_node_base
{
#endif
void _M_hook(_List_node_base * const __position) throw ();
void _M_unhook() throw ();
void _M_transfer(_List_node_base * const __first,
_List_node_base * const __last) throw();
-#if (__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)
+#if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 15)
static void swap(_List_node_base& __x, _List_node_base& __y) throw ();
#endif
};
/* The functions actually have the same implementation */
void
_List_node_base::_M_hook(_List_node_base * const __position) throw ()
{
@@ -119,29 +132,29 @@ namespace std __attribute__((visibility(
void
_List_node_base::_M_transfer(_List_node_base * const __first,
_List_node_base * const __last) throw ()
{
((std::_List_node_base *)this)->transfer((std::_List_node_base * const)__first,
(std::_List_node_base * const)__last);
}
-#if (__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)
+#if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 15)
void
_List_node_base::swap(_List_node_base& __x, _List_node_base& __y) throw ()
{
std::_List_node_base::swap(*((std::_List_node_base *) &__x),
*((std::_List_node_base *) &__y));
}
}
#endif
-#endif /* (__GNUC__ == 4) && (__GNUC_MINOR__ >= 5) */
+#endif /*MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 14)*/
-#if (__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)
+#if MOZ_LIBSTDCXX_VERSION >= GLIBCXX_VERSION(3, 4, 11)
/* Hack to avoid GLIBCXX_3.4.11 symbol versions
An inline definition of ctype<char>::_M_widen_init() used to be in
locale_facets.h before GCC 4.4, but moved out of headers in more
recent versions.
It is actually safe to make it do nothing. */
void ctype<char>::_M_widen_init() const {}
#endif
--- a/caps/src/nsScriptSecurityManager.cpp
+++ b/caps/src/nsScriptSecurityManager.cpp
@@ -2794,17 +2794,19 @@ nsScriptSecurityManager::RequestCapabili
const char *capability, PRInt16* canEnable)
{
if (NS_FAILED(aPrincipal->CanEnableCapability(capability, canEnable)))
return NS_ERROR_FAILURE;
if (*canEnable == nsIPrincipal::ENABLE_WITH_USER_PERMISSION)
{
// Prompt user for permission to enable capability.
JSContext* cx = GetCurrentJSContext();
- PRBool remember;
+ // The actual value is irrelevant but we shouldn't be handing out
+ // malformed JSBools to XPConnect.
+ PRBool remember = PR_FALSE;
if (CheckConfirmDialog(cx, aPrincipal, capability, &remember))
*canEnable = nsIPrincipal::ENABLE_GRANTED;
else
*canEnable = nsIPrincipal::ENABLE_DENIED;
if (remember)
{
//-- Save principal to prefs and to mPrincipals
if (NS_FAILED(aPrincipal->SetCanEnableCapability(capability, *canEnable)))
--- a/chrome/src/Makefile.in
+++ b/chrome/src/Makefile.in
@@ -56,29 +56,16 @@ EXPORTS_mozilla/chrome = \
CPPSRCS = \
nsChromeRegistry.cpp \
nsChromeRegistryChrome.cpp \
nsChromeProtocolHandler.cpp \
nsChromeRegistryContent.cpp \
$(NULL)
-EXTRA_DSO_LDOPTS = \
- $(MOZ_UNICHARUTIL_LIBS) \
- $(MOZ_COMPONENT_LIBS) \
- $(NULL)
-
-ifneq (,$(filter gtk2,$(MOZ_WIDGET_TOOLKIT)))
-EXTRA_DSO_LDOPTS += $(MOZ_GTK2_LIBS)
-endif
-
-ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
-EXTRA_DSO_LDOPTS += $(TK_LIBS)
-endif
-
include $(topsrcdir)/config/config.mk
include $(topsrcdir)/ipc/chromium/chromium-config.mk
include $(topsrcdir)/config/rules.mk
LOCAL_INCLUDES += \
-I$(topsrcdir)/netwerk/protocol/res \
-I$(topsrcdir)/netwerk/base/src \
$(NULL)
--- a/chrome/src/nsChromeRegistry.h
+++ b/chrome/src/nsChromeRegistry.h
@@ -111,17 +111,17 @@ public:
static nsresult Canonify(nsIURL* aChromeURL);
protected:
void FlushSkinCaches();
void FlushAllCaches();
// Update the selected locale used by the chrome registry, and fire a
// notification about this change
- virtual void UpdateSelectedLocale() = 0;
+ virtual nsresult UpdateSelectedLocale() = 0;
static void LogMessage(const char* aMsg, ...);
static void LogMessageWithContext(nsIURI* aURL, PRUint32 aLineNumber, PRUint32 flags,
const char* aMsg, ...);
virtual nsIURI* GetBaseURIFromPackage(const nsCString& aPackage,
const nsCString& aProvider,
const nsCString& aPath) = 0;
--- a/chrome/src/nsChromeRegistryChrome.cpp
+++ b/chrome/src/nsChromeRegistryChrome.cpp
@@ -363,22 +363,19 @@ nsChromeRegistryChrome::Observe(nsISuppo
if (!strcmp(NS_PREFBRANCH_PREFCHANGE_TOPIC_ID, aTopic)) {
nsCOMPtr<nsIPrefBranch> prefs (do_QueryInterface(aSubject));
NS_ASSERTION(prefs, "Bad observer call!");
NS_ConvertUTF16toUTF8 pref(someData);
if (pref.EqualsLiteral(MATCH_OS_LOCALE_PREF) ||
pref.EqualsLiteral(SELECTED_LOCALE_PREF)) {
- if (!mProfileLoaded) {
- rv = SelectLocaleFromPref(prefs);
- if (NS_FAILED(rv))
- return rv;
- }
- FlushAllCaches();
+ rv = UpdateSelectedLocale();
+ if (NS_SUCCEEDED(rv) && mProfileLoaded)
+ FlushAllCaches();
}
else if (pref.EqualsLiteral(SELECTED_SKIN_PREF)) {
nsXPIDLCString provider;
rv = prefs->GetCharPref(pref.get(), getter_Copies(provider));
if (NS_FAILED(rv)) {
NS_ERROR("Couldn't get new skin pref!");
return rv;
}
@@ -421,29 +418,32 @@ nsChromeRegistryChrome::CheckForNewChrom
mOverlayHash.Clear();
mStyleHash.Clear();
mOverrideTable.Clear();
nsComponentManagerImpl::gComponentManager->RereadChromeManifests();
return NS_OK;
}
-void nsChromeRegistryChrome::UpdateSelectedLocale()
+nsresult nsChromeRegistryChrome::UpdateSelectedLocale()
{
+ nsresult rv = NS_OK;
nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
if (prefs) {
- nsresult rv = SelectLocaleFromPref(prefs);
+ rv = SelectLocaleFromPref(prefs);
if (NS_SUCCEEDED(rv)) {
nsCOMPtr<nsIObserverService> obsSvc =
mozilla::services::GetObserverService();
NS_ASSERTION(obsSvc, "Couldn't get observer service.");
obsSvc->NotifyObservers((nsIChromeRegistry*) this,
"selected-locale-has-changed", nsnull);
}
}
+
+ return rv;
}
static void
SerializeURI(nsIURI* aURI,
SerializedURI& aSerializedURI)
{
if (!aURI)
return;
--- a/chrome/src/nsChromeRegistryChrome.h
+++ b/chrome/src/nsChromeRegistryChrome.h
@@ -78,17 +78,17 @@ class nsChromeRegistryChrome : public ns
void SendRegisteredChrome(mozilla::dom::PContentParent* aChild);
private:
static PLDHashOperator CollectPackages(PLDHashTable *table,
PLDHashEntryHdr *entry,
PRUint32 number, void *arg);
nsresult SelectLocaleFromPref(nsIPrefBranch* prefs);
- NS_OVERRIDE void UpdateSelectedLocale();
+ NS_OVERRIDE nsresult UpdateSelectedLocale();
NS_OVERRIDE nsIURI* GetBaseURIFromPackage(const nsCString& aPackage,
const nsCString& aProvider,
const nsCString& aPath);
NS_OVERRIDE nsresult GetFlagsFromPackage(const nsCString& aPackage,
PRUint32* aFlags);
static const PLDHashTableOps kTableOps;
static PLDHashNumber HashKey(PLDHashTable *table, const void *key);
--- a/chrome/src/nsChromeRegistryContent.cpp
+++ b/chrome/src/nsChromeRegistryContent.cpp
@@ -273,19 +273,19 @@ nsChromeRegistryContent::GetStyleOverlay
NS_IMETHODIMP
nsChromeRegistryContent::GetXULOverlays(nsIURI *aChromeURL,
nsISimpleEnumerator **aResult)
{
CONTENT_NOT_IMPLEMENTED();
}
-void nsChromeRegistryContent::UpdateSelectedLocale()
+nsresult nsChromeRegistryContent::UpdateSelectedLocale()
{
- CONTENT_NOTREACHED();
+ CONTENT_NOT_IMPLEMENTED();
}
void
nsChromeRegistryContent::ManifestContent(ManifestProcessingContext& cx,
int lineno, char *const * argv,
bool platform, bool contentaccessible)
{
CONTENT_NOTREACHED();
--- a/chrome/src/nsChromeRegistryContent.h
+++ b/chrome/src/nsChromeRegistryContent.h
@@ -84,17 +84,17 @@ class nsChromeRegistryContent : public n
nsCOMPtr<nsIURI> skinBaseURI;
PRUint32 flags;
};
void RegisterPackage(const ChromePackage& aPackage);
void RegisterResource(const ResourceMapping& aResource);
void RegisterOverride(const OverrideMapping& aOverride);
- NS_OVERRIDE void UpdateSelectedLocale();
+ NS_OVERRIDE nsresult UpdateSelectedLocale();
NS_OVERRIDE nsIURI* GetBaseURIFromPackage(const nsCString& aPackage,
const nsCString& aProvider,
const nsCString& aPath);
NS_OVERRIDE nsresult GetFlagsFromPackage(const nsCString& aPackage, PRUint32* aFlags);
nsClassHashtable<nsCStringHashKey, PackageEntry> mPackagesHash;
nsCString mLocale;
--- a/client.mk
+++ b/client.mk
@@ -206,17 +206,17 @@ ifdef MOZ_OBJDIR
PGO_OBJDIR = $(MOZ_OBJDIR)
else
PGO_OBJDIR := $(TOPSRCDIR)
endif
profiledbuild::
$(MAKE) -f $(TOPSRCDIR)/client.mk realbuild MOZ_PROFILE_GENERATE=1
$(MAKE) -C $(PGO_OBJDIR) package
- OBJDIR=${PGO_OBJDIR} $(PROFILE_GEN_SCRIPT)
+ OBJDIR=${PGO_OBJDIR} JARLOG_DIR=${PGO_OBJDIR}/jarlog/en-US $(PROFILE_GEN_SCRIPT)
$(MAKE) -f $(TOPSRCDIR)/client.mk maybe_clobber_profiledbuild
$(MAKE) -f $(TOPSRCDIR)/client.mk realbuild MOZ_PROFILE_USE=1
#####################################################
# Build date unification
ifdef MOZ_UNIFY_BDATE
ifndef MOZ_BUILD_DATE
--- a/config/Makefile.in
+++ b/config/Makefile.in
@@ -184,16 +184,17 @@ endif
PYUNITS := \
unit-Expression.py \
unit-Preprocessor.py \
unit-nsinstall.py \
unit-printprereleasesuffix.py \
unit-JarMaker.py \
unit-buildlist.py \
unit-expandlibs.py \
+ unit-writemozinfo.py \
$(NULL)
check:: check-python-modules check-jar-mn
check-python-modules::
@$(EXIT_ON_ERROR) \
for test in $(PYUNITS); do \
$(PYTHON) $(srcdir)/tests/$$test ; \
--- a/config/autoconf.mk.in
+++ b/config/autoconf.mk.in
@@ -115,16 +115,18 @@ MOZ_VTUNE = @MOZ_VTUNE@
MOZ_TRACE_JSCALLS = @MOZ_TRACE_JSCALLS@
MOZ_TRACEVIS = @MOZ_TRACEVIS@
DEHYDRA_PATH = @DEHYDRA_PATH@
NS_TRACE_MALLOC = @NS_TRACE_MALLOC@
USE_ELF_DYNSTR_GC = @USE_ELF_DYNSTR_GC@
USE_ELF_HACK = @USE_ELF_HACK@
STDCXX_COMPAT = @STDCXX_COMPAT@
+MOZ_LIBSTDCXX_TARGET_VERSION=@MOZ_LIBSTDCXX_TARGET_VERSION@
+MOZ_LIBSTDCXX_HOST_VERSION=@MOZ_LIBSTDCXX_HOST_VERSION@
INCREMENTAL_LINKER = @INCREMENTAL_LINKER@
MACOSX_DEPLOYMENT_TARGET = @MACOSX_DEPLOYMENT_TARGET@
MOZ_MAIL_NEWS = @MOZ_MAIL_NEWS@
ENABLE_TESTS = @ENABLE_TESTS@
IBMBIDI = @IBMBIDI@
MOZ_UNIVERSALCHARDET = @MOZ_UNIVERSALCHARDET@
ACCESSIBILITY = @ACCESSIBILITY@
MOZ_BRANDING_DIRECTORY = @MOZ_BRANDING_DIRECTORY@
--- a/config/config.mk
+++ b/config/config.mk
@@ -552,20 +552,16 @@ DEPENDENCIES = .md
MOZ_COMPONENT_LIBS=$(XPCOM_LIBS) $(MOZ_COMPONENT_NSPR_LIBS)
ifeq ($(OS_ARCH),OS2)
ELF_DYNSTR_GC = echo
else
ELF_DYNSTR_GC = :
endif
-ifeq ($(MOZ_WIDGET_TOOLKIT),qt)
-OS_LIBS += $(MOZ_QT_LIBS)
-endif
-
ifndef CROSS_COMPILE
ifdef USE_ELF_DYNSTR_GC
ifdef MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS
ELF_DYNSTR_GC = $(DEPTH)/config/elf-dynstr-gc
endif
endif
endif
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -902,16 +902,19 @@ ifdef SHARED_LIBRARY
endif
endif # SHARED_LIBRARY || PROGRAM
endif # WINNT_
endif # MOZ_PROFILE_GENERATE || MOZ_PROFILE_USE
endif # NO_PROFILE_GUIDED_OPTIMIZE
##############################################
+stdc++compat.$(OBJ_SUFFIX): CXXFLAGS+=-DMOZ_LIBSTDCXX_VERSION=$(MOZ_LIBSTDCXX_TARGET_VERSION)
+host_stdc++compat.$(OBJ_SUFFIX): CXXFLAGS+=-DMOZ_LIBSTDCXX_VERSION=$(MOZ_LIBSTDCXX_HOST_VERSION)
+
checkout:
$(MAKE) -C $(topsrcdir) -f client.mk checkout
clean clobber realclean clobber_all:: $(SUBMAKEFILES)
-$(RM) $(ALL_TRASH)
-$(RM) -r $(ALL_TRASH_DIRS)
$(foreach dir,$(PARALLEL_DIRS) $(DIRS) $(STATIC_DIRS) $(TOOL_DIRS),-$(call SUBMAKE,$@,$(dir)))
new file mode 100755
--- /dev/null
+++ b/config/tests/unit-writemozinfo.py
@@ -0,0 +1,184 @@
+#!/usr/bin/env python
+from __future__ import with_statement
+import unittest
+import os, sys, time, tempfile
+from StringIO import StringIO
+
+sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
+
+from writemozinfo import build_dict, write_json, JsonValue, jsonify
+
+class TestBuildDict(unittest.TestCase):
+ def testMissing(self):
+ """
+ Test that missing required values raises.
+ """
+ self.assertRaises(Exception, build_dict, {})
+ self.assertRaises(Exception, build_dict, {'OS_TARGET':'foo'})
+ self.assertRaises(Exception, build_dict, {'TARGET_CPU':'foo'})
+
+ def testWin(self):
+ d = build_dict({'OS_TARGET':'WINNT',
+ 'TARGET_CPU':'i386'})
+ self.assertEqual('win', d['os'])
+ self.assertEqual('x86', d['processor'])
+ self.assertEqual(32, d['bits'])
+
+ def testLinux(self):
+ d = build_dict({'OS_TARGET':'Linux',
+ 'TARGET_CPU':'i386'})
+ self.assertEqual('linux', d['os'])
+ self.assertEqual('x86', d['processor'])
+ self.assertEqual(32, d['bits'])
+
+ d = build_dict({'OS_TARGET':'Linux',
+ 'TARGET_CPU':'x86_64'})
+ self.assertEqual('linux', d['os'])
+ self.assertEqual('x86_64', d['processor'])
+ self.assertEqual(64, d['bits'])
+
+ def testMac(self):
+ d = build_dict({'OS_TARGET':'Darwin',
+ 'TARGET_CPU':'i386'})
+ self.assertEqual('mac', d['os'])
+ self.assertEqual('x86', d['processor'])
+ self.assertEqual(32, d['bits'])
+
+ d = build_dict({'OS_TARGET':'Darwin',
+ 'TARGET_CPU':'x86_64'})
+ self.assertEqual('mac', d['os'])
+ self.assertEqual('x86_64', d['processor'])
+ self.assertEqual(64, d['bits'])
+
+ def testAndroid(self):
+ d = build_dict({'OS_TARGET':'Android',
+ 'TARGET_CPU':'arm'})
+ self.assertEqual('android', d['os'])
+ self.assertEqual('arm', d['processor'])
+ self.assertEqual(32, d['bits'])
+
+ def testX86(self):
+ """
+ Test that various i?86 values => x86.
+ """
+ d = build_dict({'OS_TARGET':'WINNT',
+ 'TARGET_CPU':'i486'})
+ self.assertEqual('x86', d['processor'])
+
+ d = build_dict({'OS_TARGET':'WINNT',
+ 'TARGET_CPU':'i686'})
+ self.assertEqual('x86', d['processor'])
+
+ def testARM(self):
+ """
+ Test that all arm CPU architectures => arm.
+ """
+ d = build_dict({'OS_TARGET':'Linux',
+ 'TARGET_CPU':'arm'})
+ self.assertEqual('arm', d['processor'])
+
+ d = build_dict({'OS_TARGET':'Linux',
+ 'TARGET_CPU':'armv7'})
+ self.assertEqual('arm', d['processor'])
+
+ def testUnknown(self):
+ """
+ Test that unknown values pass through okay.
+ """
+ d = build_dict({'OS_TARGET':'RandOS',
+ 'TARGET_CPU':'cptwo'})
+ self.assertEqual("randos", d["os"])
+ self.assertEqual("cptwo", d["processor"])
+ # unknown CPUs should not get a bits value
+ self.assertFalse("bits" in d)
+
+ def testDebug(self):
+ """
+ Test that debug values are properly detected.
+ """
+ d = build_dict({'OS_TARGET':'Linux',
+ 'TARGET_CPU':'i386'})
+ self.assertEqual(False, d['debug'])
+
+ d = build_dict({'OS_TARGET':'Linux',
+ 'TARGET_CPU':'i386',
+ 'MOZ_DEBUG':'1'})
+ self.assertEqual(True, d['debug'])
+
+class TestJsonValue(unittest.TestCase):
+ def testNone(self):
+ self.assertEqual("null", repr(JsonValue(None)))
+
+ def testBool(self):
+ self.assertEqual("true", repr(JsonValue(True)))
+ self.assertEqual("false", repr(JsonValue(False)))
+
+ def testStr(self):
+ self.assertEqual("'abc'", repr(JsonValue("abc")))
+
+ def testInt(self):
+ self.assertEqual("100", repr(JsonValue(100)))
+
+ def testInvalid(self):
+ self.assertRaises(Exception, JsonValue, unicode("abc"))
+ self.assertRaises(Exception, JsonValue, 123.45)
+
+def parse_json(j):
+ """
+ Awful hack to parse a restricted subset of JSON strings into Python dicts.
+ """
+ return eval(j, {'true':True,'false':False,'null':None})
+
+class TestJsonify(unittest.TestCase):
+ """
+ Test the jsonify function.
+ """
+ def testBasic(self):
+ """
+ Sanity check the set of accepted Python value types.
+ """
+ j = parse_json(jsonify({'a':True,'b':False,'c':None,'d':100,'e':"abc"}))
+ self.assertEquals(True, j['a'])
+ self.assertEquals(False, j['b'])
+ self.assertEquals(None, j['c'])
+ self.assertEquals(100, j['d'])
+ self.assertEquals("abc", j['e'])
+
+class TestWriteJson(unittest.TestCase):
+ """
+ Test the write_json function.
+ """
+ def setUp(self):
+ fd, self.f = tempfile.mkstemp()
+ os.close(fd)
+
+ def tearDown(self):
+ os.unlink(self.f)
+
+ def testBasic(self):
+ """
+ Test that writing to a file produces correct output.
+ """
+ write_json(self.f, env={'OS_TARGET':'WINNT',
+ 'TARGET_CPU':'i386'})
+ with open(self.f) as f:
+ d = parse_json(f.read())
+ self.assertEqual('win', d['os'])
+ self.assertEqual('x86', d['processor'])
+ self.assertEqual(32, d['bits'])
+
+ def testFileObj(self):
+ """
+ Test that writing to a file-like object produces correct output.
+ """
+ s = StringIO()
+ write_json(s, env={'OS_TARGET':'WINNT',
+ 'TARGET_CPU':'i386'})
+ d = parse_json(s.getvalue())
+ self.assertEqual('win', d['os'])
+ self.assertEqual('x86', d['processor'])
+ self.assertEqual(32, d['bits'])
+
+if __name__ == '__main__':
+ unittest.main()
+
new file mode 100755
--- /dev/null
+++ b/config/writemozinfo.py
@@ -0,0 +1,101 @@
+#!/usr/bin/env python
+#
+# This script is run during configure, taking variables set in configure
+# and producing a JSON file that describes some portions of the build
+# configuration, such as the target OS and CPU.
+#
+# The output file is intended to be used as input to the mozinfo package.
+from __future__ import with_statement
+import os, re, sys
+
+def build_dict(env=os.environ):
+ """
+ Build a dict containing data about the build configuration from
+ the environment.
+ """
+ d = {}
+ # Check that all required variables are present first.
+ required = ["TARGET_CPU", "OS_TARGET"]
+ missing = [r for r in required if r not in env]
+ if missing:
+ raise Exception("Missing required environment variables: " %
+ ', '.join(missing))
+ # os
+ o = env["OS_TARGET"]
+ known_os = {"Linux": "linux",
+ "WINNT": "win",
+ "Darwin": "mac",
+ "Android": "android"}
+ if o in known_os:
+ d["os"] = known_os[o]
+ else:
+ # Allow unknown values, just lowercase them.
+ d["os"] = o.lower()
+
+ # processor
+ p = env["TARGET_CPU"]
+ # do some slight massaging for some values
+ #TODO: retain specific values in case someone wants them?
+ if p.startswith("arm"):
+ p = "arm"
+ elif re.match("i[3-9]86", p):
+ p = "x86"
+ d["processor"] = p
+ # hardcoded list of 64-bit CPUs
+ if p in ["x86_64", "ppc64"]:
+ d["bits"] = 64
+ # hardcoded list of known 32-bit CPUs
+ elif p in ["x86", "arm", "ppc"]:
+ d["bits"] = 32
+ # other CPUs will wind up with unknown bits
+
+ # debug
+ d["debug"] = 'MOZ_DEBUG' in env and env['MOZ_DEBUG'] == '1'
+ return d
+
+#TODO: replace this with the json module when Python >= 2.6 is a requirement.
+class JsonValue:
+ """
+ A class to serialize Python values into JSON-compatible representations.
+ """
+ def __init__(self, v):
+ if v is not None and not (isinstance(v,str) or isinstance(v,bool) or isinstance(v,int)):
+ raise Exception("Unhandled data type: %s" % type(v))
+ self.v = v
+ def __repr__(self):
+ if self.v is None:
+ return "null"
+ if isinstance(self.v,bool):
+ return str(self.v).lower()
+ return repr(self.v)
+
+def jsonify(d):
+ """
+ Return a JSON string of the dict |d|. Only handles a subset of Python
+ value types: bool, str, int, None.
+ """
+ jd = {}
+ for k, v in d.iteritems():
+ jd[k] = JsonValue(v)
+ return repr(jd)
+
+def write_json(file, env=os.environ):
+ """
+ Write JSON data about the configuration specified in |env|
+ to |file|, which may be a filename or file-like object.
+ See build_dict for information about what environment variables are used,
+ and what keys are produced.
+ """
+ s = jsonify(build_dict(env))
+ if isinstance(file, basestring):
+ with open(file, "w") as f:
+ f.write(s)
+ else:
+ file.write(s)
+
+if __name__ == '__main__':
+ try:
+ write_json(sys.argv[1] if len(sys.argv) > 1 else sys.stdout)
+ except Exception, e:
+ print >>sys.stderr, str(e)
+ sys.exit(1)
--- a/configure.in
+++ b/configure.in
@@ -629,27 +629,24 @@ case "$target" in
dnl Require VC8SP1 or newer.
dnl VC8 is 14.00.50727.42, VC8SP1 is 14.00.50727.762.
if test "$_CC_RELEASE" -lt 50727 -o \
\( "$_CC_RELEASE" -eq 50727 -a "$_CC_BUILD" -lt 762 \); then
AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. You probably need to install Service Pack 1 of Visual Studio 2005. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
fi
_CC_SUITE=8
- CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
AC_DEFINE(_CRT_SECURE_NO_DEPRECATE)
AC_DEFINE(_CRT_NONSTDC_NO_DEPRECATE)
elif test "$_CC_MAJOR_VERSION" = "15"; then
_CC_SUITE=9
- CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
elif test "$_CC_MAJOR_VERSION" = "16"; then
_CC_SUITE=10
- CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
AC_DEFINE(_CRT_SECURE_NO_WARNINGS)
AC_DEFINE(_CRT_NONSTDC_NO_WARNINGS)
else
AC_MSG_ERROR([This version ($CC_VERSION) of the MSVC compiler is unsupported. See https://developer.mozilla.org/en/Windows_Build_Prerequisites.])
fi
_MOZ_RTTI_FLAGS_ON='-GR'
_MOZ_RTTI_FLAGS_OFF='-GR-'
@@ -1051,17 +1048,16 @@ MOZ_ARG_ENABLE_STRING(macos-target,
Set the minimum MacOS version needed at runtime],
[_MACOSX_DEPLOYMENT_TARGET=$enableval])
case "$target" in
*-darwin*)
if test -n "$_MACOSX_DEPLOYMENT_TARGET" ; then
dnl Use the specified value
export MACOSX_DEPLOYMENT_TARGET=$_MACOSX_DEPLOYMENT_TARGET
- AC_DEFINE_UNQUOTED(__ENVIRONMENT_MAC_OS_X_VERION_MIN_REQUIRED__,$_MACOSX_DEPLOYMENT_TARGET)
else
dnl No value specified on the command line or in the environment,
dnl use architecture minimum.
case "${target_cpu}" in
ppc*)
export MACOSX_DEPLOYMENT_TARGET=10.5
;;
i*86)
@@ -5062,16 +5058,17 @@ cairo-qt)
MOZ_ENABLE_XREMOTE=1
MOZ_WEBGL=1
MOZ_WEBGL_GLX=1
USE_ELF_DYNSTR_GC=
AC_DEFINE(MOZ_X11)
MOZ_X11=1
USE_FC_FREETYPE=1
+ XT_LIBS=
TK_CFLAGS='$(MOZ_QT_CFLAGS)'
TK_LIBS='$(MOZ_QT_LIBS)'
AC_DEFINE(MOZ_WIDGET_QT)
MOZ_PDF_PRINTING=1
;;
cairo-os2)
@@ -7660,16 +7657,22 @@ dnl ====================================
STDCXX_COMPAT=
MOZ_ARG_ENABLE_BOOL(stdcxx-compat,
[ --enable-stdcxx-compat Enable compatibility with older libstdc++],
STDCXX_COMPAT=stdc++compat.cpp)
AC_SUBST(STDCXX_COMPAT)
+if test -n "$STDCXX_COMPAT"; then
+ eval $($_topsrcdir/build/autoconf/libstdcxx.py)
+ AC_SUBST(MOZ_LIBSTDCXX_TARGET_VERSION)
+ AC_SUBST(MOZ_LIBSTDCXX_HOST_VERSION)
+fi
+
dnl ========================================================
dnl =
dnl = Profiling and Instrumenting
dnl =
dnl ========================================================
MOZ_ARG_HEADER(Profiling and Instrumenting)
dnl ========================================================
@@ -9316,16 +9319,26 @@ echo $MAKEFILES | ${PERL} $srcdir/build/
rm conftest.sh
echo $MAKEFILES > unallmakefiles
mv -f config/autoconf.mk config/autoconf.mk.orig 2> /dev/null
AC_OUTPUT($MAKEFILES)
+# Generate a JSON config file for unittest harnesses etc to read
+# build configuration details from in a standardized way.
+OS_TARGET=${OS_TARGET} TARGET_CPU=${TARGET_CPU} MOZ_DEBUG=${MOZ_DEBUG} \
+ $PYTHON ${_topsrcdir}/config/writemozinfo.py ./mozinfo.json.tmp
+if cmp -s ./mozinfo.json.tmp ./mozinfo.json; then
+ rm ./mozinfo.json.tmp
+else
+ mv -f ./mozinfo.json.tmp ./mozinfo.json
+fi
+
dnl Prevent the regeneration of cairo-features.h forcing rebuilds of gfx stuff
if test "$CAIRO_FEATURES_H"; then
if cmp -s $CAIRO_FEATURES_H "$CAIRO_FEATURES_H".orig; then
echo "$CAIRO_FEATURES_H is unchanged"
mv -f "$CAIRO_FEATURES_H".orig "$CAIRO_FEATURES_H" 2> /dev/null
else
rm -f "$CAIRO_FEATURES_H".orig 2> /dev/null
fi
--- a/content/base/src/nsContentSink.cpp
+++ b/content/base/src/nsContentSink.cpp
@@ -554,28 +554,74 @@ nsContentSink::DoProcessLinkHeader()
}
static const PRUnichar kSemiCh = PRUnichar(';');
static const PRUnichar kCommaCh = PRUnichar(',');
static const PRUnichar kEqualsCh = PRUnichar('=');
static const PRUnichar kLessThanCh = PRUnichar('<');
static const PRUnichar kGreaterThanCh = PRUnichar('>');
+
+// check whether the Link header field applies to the context resource
+// see <http://tools.ietf.org/html/rfc5988#section-5.2>
+
+PRBool
+nsContentSink::LinkContextIsOurDocument(const nsSubstring& aAnchor)
+{
+ if (aAnchor.IsEmpty()) {
+ // anchor parameter not present or empty -> same document reference
+ return PR_TRUE;
+ }
+
+ nsIURI* docUri = mDocument->GetDocumentURI();
+
+ // the document URI might contain a fragment identifier ("#...')
+ // we want to ignore that because it's invisible to the server
+ // and just affects the local interpretation in the recipient
+ nsCOMPtr<nsIURI> contextUri;
+ nsresult rv = docUri->CloneIgnoringRef(getter_AddRefs(contextUri));
+
+ if (NS_FAILED(rv)) {
+ // copying failed
+ return PR_FALSE;
+ }
+
+ // resolve anchor against context
+ nsCOMPtr<nsIURI> resolvedUri;
+ rv = NS_NewURI(getter_AddRefs(resolvedUri), aAnchor,
+ nsnull, contextUri);
+
+ if (NS_FAILED(rv)) {
+ // resolving failed
+ return PR_FALSE;
+ }
+
+ PRBool same;
+ rv = contextUri->Equals(resolvedUri, &same);
+ if (NS_FAILED(rv)) {
+ // comparison failed
+ return PR_FALSE;
+ }
+
+ return same;
+}
+
nsresult
nsContentSink::ProcessLinkHeader(nsIContent* aElement,
const nsAString& aLinkData)
{
nsresult rv = NS_OK;
// parse link content and call process style link
nsAutoString href;
nsAutoString rel;
nsAutoString title;
nsAutoString type;
nsAutoString media;
+ nsAutoString anchor;
// copy to work buffer
nsAutoString stringList(aLinkData);
// put an extra null at the end
stringList.Append(kNullCh);
PRUnichar* start = stringList.BeginWriting();
@@ -694,58 +740,72 @@ nsContentSink::ProcessLinkHeader(nsICont
}
} else if (attr.LowerCaseEqualsLiteral("media")) {
if (media.IsEmpty()) {
media = value;
// HTML4.0 spec is inconsistent, make it case INSENSITIVE
ToLowerCase(media);
}
+ } else if (attr.LowerCaseEqualsLiteral("anchor")) {
+ if (anchor.IsEmpty()) {
+ anchor = value;
+ anchor.StripWhitespace();
+ }
}
}
}
}
if (endCh == kCommaCh) {
// hit a comma, process what we've got so far
href.Trim(" \t\n\r\f"); // trim HTML5 whitespace
if (!href.IsEmpty() && !rel.IsEmpty()) {
- rv = ProcessLink(aElement, href, rel, title, type, media);
+ rv = ProcessLink(aElement, anchor, href, rel, title, type, media);
}
href.Truncate();
rel.Truncate();
title.Truncate();
type.Truncate();
media.Truncate();
+ anchor.Truncate();
}
start = ++end;
}
-
+
href.Trim(" \t\n\r\f"); // trim HTML5 whitespace
if (!href.IsEmpty() && !rel.IsEmpty()) {
- rv = ProcessLink(aElement, href, rel, title, type, media);
+ rv = ProcessLink(aElement, anchor, href, rel, title, type, media);
}
return rv;
}
nsresult
nsContentSink::ProcessLink(nsIContent* aElement,
- const nsSubstring& aHref, const nsSubstring& aRel,
- const nsSubstring& aTitle, const nsSubstring& aType,
- const nsSubstring& aMedia)
+ const nsSubstring& aAnchor, const nsSubstring& aHref,
+ const nsSubstring& aRel, const nsSubstring& aTitle,
+ const nsSubstring& aType, const nsSubstring& aMedia)
{
// XXX seems overkill to generate this string array
nsTArray<nsString> linkTypes;
nsStyleLinkElement::ParseLinkTypes(aRel, linkTypes);
+ // The link relation may apply to a different resource, specified
+ // in the anchor parameter. For the link relations supported so far,
+ // we simply abort if the link applies to a resource different to the
+ // one we've loaded
+ if (!LinkContextIsOurDocument(aAnchor)) {
+ return NS_OK;
+ }
+
PRBool hasPrefetch = linkTypes.Contains(NS_LITERAL_STRING("prefetch"));
// prefetch href if relation is "next" or "prefetch"
if (hasPrefetch || linkTypes.Contains(NS_LITERAL_STRING("next"))) {
PrefetchHref(aHref, aElement, hasPrefetch);
}
if ((!aHref.IsEmpty()) && linkTypes.Contains(NS_LITERAL_STRING("dns-prefetch"))) {
PrefetchDNS(aHref);
--- a/content/base/src/nsContentSink.h
+++ b/content/base/src/nsContentSink.h
@@ -146,16 +146,17 @@ class nsContentSink : public nsICSSLoade
// nsIDocumentObserver
NS_DECL_NSIDOCUMENTOBSERVER_BEGINUPDATE
NS_DECL_NSIDOCUMENTOBSERVER_ENDUPDATE
virtual void UpdateChildCounts() = 0;
PRBool IsTimeToNotify();
+ PRBool LinkContextIsOurDocument(const nsSubstring& aAnchor);
static void InitializeStatics();
protected:
nsContentSink();
virtual ~nsContentSink();
enum CacheSelectionAction {
@@ -183,19 +184,20 @@ protected:
nsresult Init(nsIDocument* aDoc, nsIURI* aURI,
nsISupports* aContainer, nsIChannel* aChannel);
nsresult ProcessHTTPHeaders(nsIChannel* aChannel);
nsresult ProcessHeaderData(nsIAtom* aHeader, const nsAString& aValue,
nsIContent* aContent = nsnull);
nsresult ProcessLinkHeader(nsIContent* aElement,
const nsAString& aLinkData);
- nsresult ProcessLink(nsIContent* aElement, const nsSubstring& aHref,
- const nsSubstring& aRel, const nsSubstring& aTitle,
- const nsSubstring& aType, const nsSubstring& aMedia);
+ nsresult ProcessLink(nsIContent* aElement, const nsSubstring& aAnchor,
+ const nsSubstring& aHref, const nsSubstring& aRel,
+ const nsSubstring& aTitle, const nsSubstring& aType,
+ const nsSubstring& aMedia);
virtual nsresult ProcessStyleLink(nsIContent* aElement,
const nsSubstring& aHref,
PRBool aAlternate,
const nsSubstring& aTitle,
const nsSubstring& aType,
const nsSubstring& aMedia);
--- a/content/base/src/nsContentUtils.cpp
+++ b/content/base/src/nsContentUtils.cpp
@@ -5533,27 +5533,27 @@ CloneSimpleValues(JSContext* cx,
return NS_ERROR_FAILURE;
}
return SetPropertyOnValueOrObject(cx, OBJECT_TO_JSVAL(newTypedArray), rval,
robj, rid);
}
// ArrayBuffer objects.
if (js_IsArrayBuffer(obj)) {
- js::ArrayBuffer* src = js::ArrayBuffer::fromJSObject(obj);
+ JSObject* src = js::ArrayBuffer::getArrayBuffer(src);
if (!src) {
return NS_ERROR_FAILURE;
}
- JSObject* newBuffer = js_CreateArrayBuffer(cx, src->byteLength);
+ JSObject* newBuffer = js_CreateArrayBuffer(cx, js::ArrayBuffer::getByteLength(src));
if (!newBuffer) {
return NS_ERROR_FAILURE;
}
- memcpy(js::ArrayBuffer::fromJSObject(newBuffer)->data, src->data,
- src->byteLength);
+ memcpy(js::ArrayBuffer::getDataOffset(newBuffer), js::ArrayBuffer::getDataOffset(src),
+ js::ArrayBuffer::getByteLength(src));
return SetPropertyOnValueOrObject(cx, OBJECT_TO_JSVAL(newBuffer), rval,
robj, rid);
}
// Do we support File?
// Do we support Blob?
// Do we support FileList?
--- a/content/base/src/nsDOMBlobBuilder.cpp
+++ b/content/base/src/nsDOMBlobBuilder.cpp
@@ -30,16 +30,17 @@
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+#include "jsobj.h"
#include "jstypedarray.h"
#include "nsAutoPtr.h"
#include "nsDOMClassInfo.h"
#include "nsDOMFile.h"
#include "nsIMultiplexInputStream.h"
#include "nsStringStream.h"
#include "nsTArray.h"
#include "nsJSUtils.h"
@@ -229,17 +230,17 @@ public:
{}
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMMOZBLOBBUILDER
protected:
nsresult AppendVoidPtr(void* aData, PRUint32 aLength);
nsresult AppendString(JSString* aString, JSContext* aCx);
nsresult AppendBlob(nsIDOMBlob* aBlob);
- nsresult AppendArrayBuffer(js::ArrayBuffer* aBuffer);
+ nsresult AppendArrayBuffer(JSObject* aBuffer);
bool ExpandBufferSize(PRUint64 aSize)
{
if (mDataBufferLen >= mDataLen + aSize) {
mDataLen += aSize;
return true;
}
@@ -327,19 +328,19 @@ nsDOMBlobBuilder::AppendBlob(nsIDOMBlob*
Flush();
mBlobs.AppendElement(aBlob);
return NS_OK;
}
nsresult
-nsDOMBlobBuilder::AppendArrayBuffer(js::ArrayBuffer* aBuffer)
+nsDOMBlobBuilder::AppendArrayBuffer(JSObject* aBuffer)
{
- return AppendVoidPtr(aBuffer->data, aBuffer->byteLength);
+ return AppendVoidPtr(js::ArrayBuffer::getDataOffset(aBuffer), js::ArrayBuffer::getByteLength(aBuffer));
}
/* nsIDOMBlob getBlob ([optional] in DOMString contentType); */
NS_IMETHODIMP
nsDOMBlobBuilder::GetBlob(const nsAString& aContentType,
nsIDOMBlob** aBlob)
{
NS_ENSURE_ARG(aBlob);
@@ -374,17 +375,17 @@ nsDOMBlobBuilder::Append(const jsval& aD
nsCOMPtr<nsIDOMBlob> blob = do_QueryInterface(
nsContentUtils::XPConnect()->
GetNativeOfWrapper(aCx, obj));
if (blob)
return AppendBlob(blob);
// Is it an array buffer?
if (js_IsArrayBuffer(obj)) {
- js::ArrayBuffer* buffer = js::ArrayBuffer::fromJSObject(obj);
+ JSObject* buffer = js::ArrayBuffer::getArrayBuffer(obj);
if (buffer)
return AppendArrayBuffer(buffer);
}
}
// If it's not a Blob or an ArrayBuffer, coerce it to a string
JSString* str = JS_ValueToString(aCx, aData);
NS_ENSURE_TRUE(str, NS_ERROR_FAILURE);
old mode 100755
new mode 100644
old mode 100755
new mode 100644
--- a/content/base/src/nsGkAtomList.h
+++ b/content/base/src/nsGkAtomList.h
@@ -1717,17 +1717,16 @@ GK_ATOM(bcTableCellFrame, "BCTableCellFr
GK_ATOM(blockFrame, "BlockFrame")
GK_ATOM(boxFrame, "BoxFrame")
GK_ATOM(brFrame, "BRFrame")
GK_ATOM(bulletFrame, "BulletFrame")
GK_ATOM(columnSetFrame, "ColumnSetFrame")
GK_ATOM(comboboxControlFrame, "ComboboxControlFrame")
GK_ATOM(comboboxDisplayFrame, "ComboboxDisplayFrame")
GK_ATOM(deckFrame, "DeckFrame")
-GK_ATOM(directionalFrame, "DirectionalFrame")
GK_ATOM(fieldSetFrame, "FieldSetFrame")
GK_ATOM(frameSetFrame, "FrameSetFrame")
GK_ATOM(gfxButtonControlFrame, "gfxButtonControlFrame")
GK_ATOM(HTMLButtonControlFrame, "HTMLButtonControlFrame")
GK_ATOM(HTMLCanvasFrame, "HTMLCanvasFrame")
GK_ATOM(subDocumentFrame, "subDocumentFrame")
GK_ATOM(imageBoxFrame, "ImageBoxFrame")
GK_ATOM(imageFrame, "ImageFrame")
--- a/content/base/src/nsWebSocket.cpp
+++ b/content/base/src/nsWebSocket.cpp
@@ -309,16 +309,17 @@ nsWebSocketEstablishedConnection::Init(n
nsresult
nsWebSocketEstablishedConnection::PrintErrorOnConsole(const char *aBundleURI,
const PRUnichar *aError,
const PRUnichar **aFormatStrings,
PRUint32 aFormatStringsLen)
{
NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
+ NS_ABORT_IF_FALSE(mOwner, "No owner");
nsresult rv;
nsCOMPtr<nsIStringBundleService> bundleService =
do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIStringBundle> strBundle;
@@ -360,16 +361,18 @@ nsWebSocketEstablishedConnection::PrintE
return NS_OK;
}
// when this is called the browser side wants no more part of it
nsresult
nsWebSocketEstablishedConnection::Close()
{
NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
+ if (!mOwner)
+ return NS_OK;
// Disconnect() can release this object, so we keep a
// reference until the end of the method
nsRefPtr<nsWebSocketEstablishedConnection> kungfuDeathGrip = this;
if (mOwner->mReadyState == nsIWebSocket::CONNECTING) {
mOwner->SetReadyState(nsIWebSocket::CLOSING);
mOwner->SetReadyState(nsIWebSocket::CLOSED);
@@ -453,16 +456,18 @@ nsWebSocketEstablishedConnection::Discon
nsLayoutStatics::Release();
return NS_OK;
}
nsresult
nsWebSocketEstablishedConnection::UpdateMustKeepAlive()
{
NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
+ NS_ABORT_IF_FALSE(mOwner, "No owner");
+
mOwner->UpdateMustKeepAlive();
return NS_OK;
}
//-----------------------------------------------------------------------------
// nsWebSocketEstablishedConnection::nsIWebSocketListener methods:
//-----------------------------------------------------------------------------
@@ -567,16 +572,19 @@ nsWebSocketEstablishedConnection::OnServ
//-----------------------------------------------------------------------------
NS_IMETHODIMP
nsWebSocketEstablishedConnection::GetInterface(const nsIID &aIID,
void **aResult)
{
NS_ABORT_IF_FALSE(NS_IsMainThread(), "Not running on main thread");
+ if (!mOwner)
+ return NS_ERROR_FAILURE;
+
if (aIID.Equals(NS_GET_IID(nsIAuthPrompt)) ||
aIID.Equals(NS_GET_IID(nsIAuthPrompt2))) {
nsresult rv;
nsCOMPtr<nsIDocument> doc =
nsContentUtils::GetDocumentFromScriptContext(mOwner->mScriptContext);
if (!doc) {
@@ -1287,17 +1295,19 @@ nsWebSocket::Close()
return NS_OK;
}
if (mReadyState == nsIWebSocket::CONNECTING) {
// FailConnection() can release the object, so we keep a reference
// before calling it
nsRefPtr<nsWebSocket> kungfuDeathGrip = this;
- mConnection->FailConnection();
+ if (mConnection) {
+ mConnection->FailConnection();
+ }
return NS_OK;
}
// mReadyState == nsIWebSocket::OPEN
mConnection->Close();
return NS_OK;
}
--- a/content/base/src/nsXMLHttpRequest.cpp
+++ b/content/base/src/nsXMLHttpRequest.cpp
@@ -862,19 +862,19 @@ nsresult nsXMLHttpRequest::CreateRespons
PRInt32 dataLen = mResponseBody.Length();
RootResultArrayBuffer();
mResultArrayBuffer = js_CreateArrayBuffer(aCx, dataLen);
if (!mResultArrayBuffer) {
return NS_ERROR_FAILURE;
}
if (dataLen > 0) {
- js::ArrayBuffer *abuf = js::ArrayBuffer::fromJSObject(mResultArrayBuffer);
+ JSObject *abuf = js::ArrayBuffer::getArrayBuffer(mResultArrayBuffer);
NS_ASSERTION(abuf, "What happened?");
- memcpy(abuf->data, mResponseBody.BeginReading(), dataLen);
+ memcpy(js::ArrayBuffer::getDataOffset(abuf), mResponseBody.BeginReading(), dataLen);
}
return NS_OK;
}
/* attribute AString responseType; */
NS_IMETHODIMP nsXMLHttpRequest::GetResponseType(nsAString& aResponseType)
{
--- a/content/base/test/Makefile.in
+++ b/content/base/test/Makefile.in
@@ -84,29 +84,27 @@ include $(topsrcdir)/config/rules.mk
test_bug330925.xhtml \
test_bug331959.html \
test_bug333673.html \
test_bug337631.html \
test_bug338541.xhtml \
test_bug338679.html \
test_bug339494.html \
test_bug339494.xhtml \
- test_bug339494.xul \
test_bug340571.html \
test_bug343596.html \
test_bug345339.html \
345339_iframe.html \
test_bug352728.html \
test_bug352728.xhtml \
test_bug353334.html \
test_bug355026.html \
test_bug357450.js \
test_bug357450.html \
test_bug357450.xhtml \
- test_bug357450.xul \
test_bug357450_svg.xhtml \
test_bug357509.html \
test_bug358660.html \
test_bug362391.xhtml \
test_bug364092.xhtml \
test_bug364413.xhtml \
test_bug366946.html \
test_bug367164.html \
@@ -407,17 +405,16 @@ include $(topsrcdir)/config/rules.mk
test_bug560780.html \
test_bug562652.html \
test_bug562137.html \
file_bug562137.txt \
test_bug548193.html \
file_bug548193.sjs \
test_html_colors_quirks.html \
test_html_colors_standards.html \
- test_bug571390.xul \
test_bug300992.html \
test_websocket_hello.html \
file_websocket_hello_wsh.py \
test_ws_basic_tests.html \
file_ws_basic_tests_wsh.py \
test_websocket.html \
file_websocket_wsh.py \
file_websocket_http_resource.txt \
@@ -499,16 +496,20 @@ include $(topsrcdir)/config/rules.mk
accesscontrol.resource^headers^ \
invalid_accesscontrol.resource \
invalid_accesscontrol.resource^headers^ \
somedatas.resource \
somedatas.resource^headers^ \
delayedServerEvents.sjs \
$(NULL)
+_CHROME_FILES = \
+ test_bug357450.js \
+ $(NULL)
+
# This test fails on the Mac for some reason
ifneq (,$(filter gtk2 windows,$(MOZ_WIDGET_TOOLKIT)))
_TEST_FILES2 += test_copyimage.html \
$(NULL)
endif
# Disabled for now. Mochitest isn't reliable enough for these.
# test_bug444546.html \
@@ -525,8 +526,12 @@ endif
libs:: $(_TEST_FILES1)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
libs:: $(_TEST_FILES2)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
libs:: $(_BROWSER_TEST_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
+
+libs:: $(_CHROME_FILES)
+ $(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
+
--- a/content/base/test/browser_bug593387.js
+++ b/content/base/test/browser_bug593387.js
@@ -22,16 +22,18 @@ function test() {
function testXFOFrameInChrome() {
newBrowser.removeEventListener("load", testXFOFrameInChrome, true);
// Insert an iframe that specifies "X-Frame-Options: DENY" and verify
// that it loads, since the top context is chrome
var frame = newBrowser.contentDocument.createElement("iframe");
frame.src = "http://mochi.test:8888/tests/content/base/test/file_x-frame-options_page.sjs?testid=deny&xfo=deny";
frame.addEventListener("load", function() {
+ frame.removeEventListener("load", arguments.callee, true);
+
// Test that the frame loaded
var test = this.contentDocument.getElementById("test");
is(test.tagName, "H1", "wrong element type");
is(test.textContent, "deny", "wrong textContent");
// Run next test (try the same with a content top-level context)
newBrowser.addEventListener("load", testXFOFrameInContent, true);
newBrowser.contentWindow.location = "http://example.com/";
@@ -43,16 +45,18 @@ function testXFOFrameInChrome() {
function testXFOFrameInContent() {
newBrowser.removeEventListener("load", testXFOFrameInContent, true);
// Insert an iframe that specifies "X-Frame-Options: DENY" and verify that it
// is blocked from loading since the top browsing context is another site
var frame = newBrowser.contentDocument.createElement("iframe");
frame.src = "http://mochi.test:8888/tests/content/base/test/file_x-frame-options_page.sjs?testid=deny&xfo=deny";
frame.addEventListener("load", function() {
+ frame.removeEventListener("load", arguments.callee, true);
+
// Test that the frame DID NOT load
var test = this.contentDocument.getElementById("test");
is(test, undefined, "should be about:blank");
// Finalize the test
gBrowser.removeCurrentTab();
finish();
}, true);
--- a/content/base/test/chrome/Makefile.in
+++ b/content/base/test/chrome/Makefile.in
@@ -57,15 +57,18 @@ include $(topsrcdir)/config/rules.mk
title_window.xul \
test_bug549682.xul \
file_bug549682.xul \
test_bug616841.xul \
file_bug616841.xul \
test_bug635835.xul \
test_fileconstructor.xul \
fileconstructor_file.png \
+ test_bug339494.xul \
+ test_bug357450.xul \
+ test_bug571390.xul \
$(NULL)
libs:: $(_TEST_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
libs:: $(_CHROME_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)
rename from content/base/test/test_bug339494.xul
rename to content/base/test/chrome/test_bug339494.xul
--- a/content/base/test/test_bug339494.xul
+++ b/content/base/test/chrome/test_bug339494.xul
@@ -1,22 +1,22 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
-<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=339494
-->
<window title="Mozilla Bug 339494"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<title>Test for Bug 339494</title>
- <script type="application/javascript" src="/MochiKit/packed.js"></script>
- <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
+ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml">
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=339494">Mozilla Bug 339494</a>
<p id="display"></p>
<div id="content" style="display: none">
<xul:hbox id="d"/>
<xul:hbox id="s"/>
</div>
rename from content/base/test/test_bug357450.xul
rename to content/base/test/chrome/test_bug357450.xul
--- a/content/base/test/test_bug357450.xul
+++ b/content/base/test/chrome/test_bug357450.xul
@@ -1,24 +1,24 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
-<?xml-stylesheet href="/tests/SimpleTest/test.css" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=357450
-->
<window title="Mozilla Bug 357450"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<title>Test for Bug 357450</title>
- <script type="application/javascript" src="/MochiKit/packed.js"></script>
+ <script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript"
- src="/tests/SimpleTest/SimpleTest.js"></script>
+ src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="test_bug357450.js"></script>
<body xmlns="http://www.w3.org/1999/xhtml">
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=357450"
target="_blank">Mozilla Bug 357450</a>
<p id="display"></p>
rename from content/base/test/test_bug571390.xul
rename to content/base/test/chrome/test_bug571390.xul
--- a/content/base/test/test_bug571390.xul
+++ b/content/base/test/chrome/test_bug571390.xul
@@ -1,19 +1,19 @@
<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
-<?xml-stylesheet type="text/css" href="/tests/SimpleTest/test.css"?>
+<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=571390
-->
<window title="Mozilla Bug 571390"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
class="foo bar">
- <script type="application/javascript" src="/MochiKit/packed.js"/>
- <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"/>
+ <script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"/>
+ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
<!-- test results are displayed in the html:body -->
<body xmlns="http://www.w3.org/1999/xhtml">
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=571390"
target="_blank">Mozilla Bug 571390</a>
</body>
<!-- test code goes here -->
--- a/content/base/test/delayedServerEvents.sjs
+++ b/content/base/test/delayedServerEvents.sjs
@@ -1,9 +1,9 @@
-// this will take strings_to_send.length*5000 ms = 50 sec
+// this will take strings_to_send.length*500 ms = 5 sec
var timer = null;
var strings_to_send = ["data\r\n\nda", "ta", ":", "de", "layed1\n\n",
"",
"",
"data:delayed2", "", ""];
var resp = null;
@@ -33,10 +33,10 @@ function handleRequest(request, response
response.write("Content-Length: " + b + "\r\n");
response.write("Content-Type: text/event-stream; charset=utf-8\r\n");
response.write("Cache-Control: no-cache, must-revalidate\r\n");
response.write("\r\n");
resp = response;
timer = Components.classes["@mozilla.org/timer;1"].createInstance(Components.interfaces.nsITimer);
- timer.initWithCallback(sendNextString, 5000, Components.interfaces.nsITimer.TYPE_REPEATING_SLACK);
+ timer.initWithCallback(sendNextString, 500, Components.interfaces.nsITimer.TYPE_REPEATING_SLACK);
}
old mode 100755
new mode 100644
--- a/content/base/test/test_bug338583.html
+++ b/content/base/test/test_bug338583.html
@@ -14,30 +14,49 @@ https://bugzilla.mozilla.org/show_bug.cg
<body bgColor=white>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=338583">Mozilla Bug 338583</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
-
-/** Test for Bug 338583 **/
+/** Tests for Bug 338583 **/
// we test:
// 1) the EventSource behaviour
// 2) if the events are trusted
// 3) possible invalid eventsources
// 4) the close method when the object is just been used
// 5) access-control
// 6) the data parameter
// 7) delayed server responses
// --
+ function runAllTests() {
+ // these tests run asynchronously
+ doTest1(); // this will take 8000 ms
+ doTest2(); // this will take 5000 ms
+ doTest3(); // this will take 1500 ms
+ doTest3_b(); // this will take 1500 ms
+ doTest3_c(); // this will take 1500 ms
+ doTest3_d(); // this will take 1500 ms
+ doTest3_e(); // this will take 1500 ms
+ doTest3_f(); // this will take 1500 ms
+ doTest3_g(); // this will take 1500 ms
+ doTest3_h(); // this will take 1500 ms
+ doTest4(); // this will take 3000 ms
+ doTest4_b(); // this will take 3000 ms
+ doTest5(); // this will take 3000 ms
+ doTest5_b(); // this will take 3000 ms
+ doTest6(); // this will take 2500 ms
+ doTest7(); // this will take 8000 ms
+ }
+
function fn_onmessage(e) {
if (e.currentTarget == e.target && e.target.hits != null)
e.target.hits['fn_onmessage']++;
}
function fn_event_listener_message(e) {
if (e.currentTarget == e.target && e.target.hits != null)
e.target.hits['fn_event_listener_message']++;
@@ -48,19 +67,22 @@ https://bugzilla.mozilla.org/show_bug.cg
e.target.hits['fn_other_event_name']++;
}
var domBranch;
var oldPrefVal;
var gEventSourceObj1 = null;
var gEventSourceObj2 = null;
- var gEventSourceObj3 = null;
- var gEventSourceObj4 = null;
- var gEventSourceObj5 = null;
+ var gEventSourceObj3_a = null, gEventSourceObj3_b = null,
+ gEventSourceObj3_c = null, gEventSourceObj3_d = null,
+ gEventSourceObj3_e = null, gEventSourceObj3_f = null,
+ gEventSourceObj3_g = null, gEventSourceObj3_h = null;
+ var gEventSourceObj4_a = null, gEventSourceObj4_b = null;
+ var gEventSourceObj5_a = null, gEventSourceObj5_b = null;
var gEventSourceObj6 = null;
var gEventSourceObj7 = null;
var stress_factor; // used in the setTimeouts in order to help
// the test when running in slow machines
function hasBeenHitFor1And2(obj, min) {
if (obj.hits['fn_onmessage'] < min ||
obj.hits['fn_event_listener_message'] < min ||
@@ -87,23 +109,23 @@ https://bugzilla.mozilla.org/show_bug.cg
gEventSourceObj1.hits = [];
gEventSourceObj1.hits['fn_onmessage'] = 0;
gEventSourceObj1.onmessage = fn_onmessage;
gEventSourceObj1.hits['fn_event_listener_message'] = 0;
gEventSourceObj1.addEventListener('message', fn_event_listener_message, true);
gEventSourceObj1.hits['fn_other_event_name'] = 0;
gEventSourceObj1.addEventListener('other_event_name', fn_other_event_name, true);
- // the eventsources.res always use a retry of 0.5 second, so for four hits a timeout of 3 seconds is enough
+ // the eventsources.res always use a retry of 0.5 second, so for four hits a timeout of 6 seconds is enough
setTimeout(function(){
bhits = hasBeenHitFor1And2(gEventSourceObj1, 4);
ok(bhits, "Test 1.b failed.");
doTest1_c();
- }, parseInt(3000*stress_factor));
+ }, parseInt(6000*stress_factor));
}
function doTest1_c() {
gEventSourceObj1.close();
ok(gEventSourceObj1.readyState == 2, "Test 1.c failed.");
doTest1_d();
}
@@ -112,18 +134,16 @@ https://bugzilla.mozilla.org/show_bug.cg
gEventSourceObj1.hits['fn_onmessage'] = 0;
gEventSourceObj1.hits['fn_event_listener_message'] = 0;
gEventSourceObj1.hits['fn_other_event_name'] = 0;
setTimeout(function(){
bhits = hasBeenHitFor1And2(gEventSourceObj1, 1);
ok(!bhits, "Test 1.d failed.");
gEventSourceObj1.close();
-
- doTest2();
}, parseInt(2000*stress_factor));
}
// in order to test (2)
// a) set a eventsource that give the dom events messages
// b) expect trusted events
function doTest2() {
@@ -133,240 +153,219 @@ https://bugzilla.mozilla.org/show_bug.cg
};
gEventSourceObj2 = new EventSource("eventsource.resource");
gEventSourceObj2.onmessage = func;
setTimeout(function(){ // just to clean...
gEventSourceObj2.close();
}, parseInt(5000*stress_factor));
-
- doTest3();
}
// in order to test (3)
// a) XSite domain error test
-// b) protocol file:/// test
+// b) protocol file:// test
// c) protocol javascript: test
// d) wrong Content-Type test
// e) bad http response code test
// f) message eventsource without a data test
// g) eventsource with invalid NCName char in the event field test
// h) DNS error
function doTest3() {
- gEventSourceObj3 = new EventSource("http://example.org/tests/content/base/test/eventsource.resource");
+ gEventSourceObj3_a = new EventSource("http://example.org/tests/content/base/test/eventsource.resource");
- gEventSourceObj3.onmessage = fn_onmessage;
- gEventSourceObj3.hits = [];
- gEventSourceObj3.hits['fn_onmessage'] = 0;
+ gEventSourceObj3_a.onmessage = fn_onmessage;
+ gEventSourceObj3_a.hits = [];
+ gEventSourceObj3_a.hits['fn_onmessage'] = 0;
setTimeout(function() {
- ok(gEventSourceObj3.hits['fn_onmessage'] == 0, "Test 3.a failed");
- gEventSourceObj3.close();
-
- doTest3_b();
+ ok(gEventSourceObj3_a.hits['fn_onmessage'] == 0, "Test 3.a failed");
+ gEventSourceObj3_a.close();
}, parseInt(1500*stress_factor));
}
function doTest3_b() {