Merge the last PGO-green inbound changeset to m-c.

This commit is contained in:
Ryan VanderMeulen 2013-02-14 17:16:49 -05:00
commit 416cda2e64
108 changed files with 1060 additions and 752 deletions

View File

@ -9,16 +9,11 @@ VPATH = @srcdir@
LIBRARY_NAME = AccessibleMarshal LIBRARY_NAME = AccessibleMarshal
MODULE = accessibility MODULE = accessibility
XPIDL_MODULE = accessibility-msaa
GRE_MODULE = 1 GRE_MODULE = 1
DEFFILE = $(win_srcdir)/AccessibleMarshal.def DEFFILE = $(win_srcdir)/AccessibleMarshal.def
include $(DEPTH)/config/autoconf.mk include $(DEPTH)/config/autoconf.mk
XPIDLSRCS = \
nsIWinAccessNode.idl \
$(NULL)
DEFINES += -DREGISTER_PROXY_DLL DEFINES += -DREGISTER_PROXY_DLL
GARBAGE += $(MIDL_GENERATED_FILES) done_gen dlldata.c GARBAGE += $(MIDL_GENERATED_FILES) done_gen dlldata.c

View File

@ -1,20 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsISupports.idl"
%{C++
#include "guiddef.h"
%}
[ref] native MSCOMIIDRef(IID);
[uuid(63efe9c5-2610-4d2f-861b-e4ddfe1b70d9)]
interface nsIWinAccessNode : nsISupports
{
voidPtr queryNativeInterface([const] in MSCOMIIDRef aIID);
};

View File

@ -272,6 +272,16 @@ aria::MapToState(EStateRule aRule, dom::Element* aElement, uint64_t* aState)
return true; return true;
} }
case eARIAReadonlyOrEditableIfDefined:
{
static const TokenTypeData data(
nsGkAtoms::aria_readonly, eBoolType,
0, states::READONLY, states::EDITABLE);
MapTokenType(aElement, aState, data);
return true;
}
case eARIARequired: case eARIARequired:
{ {
static const TokenTypeData data( static const TokenTypeData data(

View File

@ -39,6 +39,7 @@ enum EStateRule
eARIAPressed, eARIAPressed,
eARIAReadonly, eARIAReadonly,
eARIAReadonlyOrEditable, eARIAReadonlyOrEditable,
eARIAReadonlyOrEditableIfDefined,
eARIARequired, eARIARequired,
eARIASelectable, eARIASelectable,
eReadonlyUntilEditable, eReadonlyUntilEditable,

View File

@ -53,7 +53,7 @@ AccEvent::CreateXPCOMObject()
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// AccEvent cycle collection // AccEvent cycle collection
NS_IMPL_CYCLE_COLLECTION_NATIVE_1(AccEvent, mAccessible) NS_IMPL_CYCLE_COLLECTION_1(AccEvent, mAccessible)
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(AccEvent, AddRef) NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(AccEvent, AddRef)
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(AccEvent, Release) NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(AccEvent, Release)

View File

@ -178,7 +178,7 @@ static nsRoleMapEntry sWAIRoleMaps[] =
eSelect | eTable, eSelect | eTable,
states::FOCUSABLE, states::FOCUSABLE,
eARIAMultiSelectable, eARIAMultiSelectable,
eARIAReadonly eARIAReadonlyOrEditable
}, },
{ // gridcell { // gridcell
&nsGkAtoms::gridcell, &nsGkAtoms::gridcell,
@ -190,7 +190,7 @@ static nsRoleMapEntry sWAIRoleMaps[] =
eTableCell, eTableCell,
kNoReqStates, kNoReqStates,
eARIASelectable, eARIASelectable,
eARIAReadonly eARIAReadonlyOrEditableIfDefined
}, },
{ // group { // group
&nsGkAtoms::group, &nsGkAtoms::group,

View File

@ -22,6 +22,8 @@
#include "RootAccessible.h" #include "RootAccessible.h"
#include "States.h" #include "States.h"
#include "StyleInfo.h" #include "StyleInfo.h"
#include "TableAccessible.h"
#include "TableCellAccessible.h"
#include "TreeWalker.h" #include "TreeWalker.h"
#include "nsContentUtils.h" #include "nsContentUtils.h"
@ -1597,6 +1599,22 @@ Accessible::ApplyARIAState(uint64_t* aState) const
if (aria::MapToState(mRoleMapEntry->attributeMap1, element, aState) && if (aria::MapToState(mRoleMapEntry->attributeMap1, element, aState) &&
aria::MapToState(mRoleMapEntry->attributeMap2, element, aState)) aria::MapToState(mRoleMapEntry->attributeMap2, element, aState))
aria::MapToState(mRoleMapEntry->attributeMap3, element, aState); aria::MapToState(mRoleMapEntry->attributeMap3, element, aState);
// ARIA gridcell inherits editable/readonly states from the grid until it's
// overridden.
if (mRoleMapEntry->Is(nsGkAtoms::gridcell) &&
!(*aState & (states::READONLY | states::EDITABLE))) {
const TableCellAccessible* cell = AsTableCell();
if (cell) {
TableAccessible* table = cell->Table();
if (table) {
Accessible* grid = table->AsAccessible();
uint64_t gridState = 0;
grid->ApplyARIAState(&gridState);
*aState |= (gridState & (states::READONLY | states::EDITABLE));
}
}
}
} }
NS_IMETHODIMP NS_IMETHODIMP

View File

@ -514,6 +514,8 @@ public:
virtual TableAccessible* AsTable() { return nullptr; } virtual TableAccessible* AsTable() { return nullptr; }
virtual TableCellAccessible* AsTableCell() { return nullptr; } virtual TableCellAccessible* AsTableCell() { return nullptr; }
const TableCellAccessible* AsTableCell() const
{ return const_cast<Accessible*>(this)->AsTableCell(); }
bool IsTableRow() const { return HasGenericType(eTableRow); } bool IsTableRow() const { return HasGenericType(eTableRow); }

View File

@ -45,18 +45,7 @@ nsAccessNodeWrap::~nsAccessNodeWrap()
// nsISupports methods // nsISupports methods
//----------------------------------------------------- //-----------------------------------------------------
NS_IMPL_ISUPPORTS_INHERITED1(nsAccessNodeWrap, nsAccessNode, nsIWinAccessNode) NS_IMPL_ISUPPORTS_INHERITED0(nsAccessNodeWrap, nsAccessNode)
//-----------------------------------------------------
// nsIWinAccessNode methods
//-----------------------------------------------------
NS_IMETHODIMP
nsAccessNodeWrap::QueryNativeInterface(REFIID aIID, void** aInstancePtr)
{
// XXX Wrong for E_NOINTERFACE
return static_cast<nsresult>(QueryInterface(aIID, aInstancePtr));
}
STDMETHODIMP nsAccessNodeWrap::QueryInterface(REFIID iid, void** ppv) STDMETHODIMP nsAccessNodeWrap::QueryInterface(REFIID iid, void** ppv)
{ {
@ -122,12 +111,12 @@ nsAccessNodeWrap::QueryService(REFGUID guidService, REFIID iid, void** ppv)
// Can get to IAccessibleApplication from any node via QS // Can get to IAccessibleApplication from any node via QS
if (guidService == IID_IAccessibleApplication || if (guidService == IID_IAccessibleApplication ||
(Compatibility::IsJAWS() && iid == IID_IAccessibleApplication)) { (Compatibility::IsJAWS() && iid == IID_IAccessibleApplication)) {
ApplicationAccessible* applicationAcc = ApplicationAcc(); ApplicationAccessibleWrap* applicationAcc =
static_cast<ApplicationAccessibleWrap*>(ApplicationAcc());
if (!applicationAcc) if (!applicationAcc)
return E_NOINTERFACE; return E_NOINTERFACE;
nsresult rv = applicationAcc->QueryNativeInterface(iid, ppv); return applicationAcc->QueryInterface(iid, ppv);
return NS_SUCCEEDED(rv) ? S_OK : E_NOINTERFACE;
} }
/** /**

View File

@ -22,7 +22,6 @@
#include "nsCOMPtr.h" #include "nsCOMPtr.h"
#include "nsIAccessible.h" #include "nsIAccessible.h"
#include "nsIAccessibleEvent.h" #include "nsIAccessibleEvent.h"
#include "nsIWinAccessNode.h"
#include "nsIDOMElement.h" #include "nsIDOMElement.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsAccessNode.h" #include "nsAccessNode.h"
@ -55,12 +54,10 @@ namespace a11y {
#endif #endif
class nsAccessNodeWrap : public nsAccessNode, class nsAccessNodeWrap : public nsAccessNode,
public nsIWinAccessNode,
public IServiceProvider public IServiceProvider
{ {
public: public:
NS_DECL_ISUPPORTS_INHERITED NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIWINACCESSNODE
public: // construction, destruction public: // construction, destruction
nsAccessNodeWrap(nsIContent* aContent, DocAccessible* aDoc); nsAccessNodeWrap(nsIContent* aContent, DocAccessible* aDoc);

View File

@ -43,59 +43,6 @@ nsWinUtils::GetComputedStyleDeclaration(nsIContent* aContent)
return cssDecl.forget(); return cssDecl.forget();
} }
HRESULT
nsWinUtils::ConvertToIA2Array(nsIArray *aGeckoArray, IUnknown ***aIA2Array,
long *aIA2ArrayLen)
{
*aIA2Array = NULL;
*aIA2ArrayLen = 0;
if (!aGeckoArray)
return S_FALSE;
uint32_t length = 0;
nsresult rv = aGeckoArray->GetLength(&length);
if (NS_FAILED(rv))
return GetHRESULT(rv);
if (length == 0)
return S_FALSE;
*aIA2Array =
static_cast<IUnknown**>(::CoTaskMemAlloc((length) * sizeof(IUnknown*)));
if (!*aIA2Array)
return E_OUTOFMEMORY;
uint32_t idx = 0;
for (; idx < length; ++idx) {
nsCOMPtr<nsIWinAccessNode> winAccessNode =
do_QueryElementAt(aGeckoArray, idx, &rv);
if (NS_FAILED(rv))
break;
void *instancePtr = NULL;
nsresult rv = winAccessNode->QueryNativeInterface(IID_IUnknown,
&instancePtr);
if (NS_FAILED(rv))
break;
(*aIA2Array)[idx] = static_cast<IUnknown*>(instancePtr);
}
if (NS_FAILED(rv)) {
for (uint32_t idx2 = 0; idx2 < idx; idx2++) {
(*aIA2Array)[idx2]->Release();
(*aIA2Array)[idx2] = NULL;
}
::CoTaskMemFree(*aIA2Array);
return GetHRESULT(rv);
}
*aIA2ArrayLen = length;
return S_OK;
}
bool bool
nsWinUtils::MaybeStartWindowEmulation() nsWinUtils::MaybeStartWindowEmulation()
{ {

View File

@ -30,13 +30,6 @@ public:
static already_AddRefed<nsIDOMCSSStyleDeclaration> static already_AddRefed<nsIDOMCSSStyleDeclaration>
GetComputedStyleDeclaration(nsIContent* aContent); GetComputedStyleDeclaration(nsIContent* aContent);
/**
* Convert nsIArray array of accessible objects to an array of IUnknown*
* objects used in IA2 methods.
*/
static HRESULT ConvertToIA2Array(nsIArray *aCollection,
IUnknown ***aAccessibles, long *aCount);
/** /**
* Start window emulation if presence of specific AT is detected. * Start window emulation if presence of specific AT is detected.
*/ */

View File

@ -10,7 +10,6 @@
#include "AccessibleHyperlink_i.c" #include "AccessibleHyperlink_i.c"
#include "AccessibleWrap.h" #include "AccessibleWrap.h"
#include "nsIWinAccessNode.h"
using namespace mozilla::a11y; using namespace mozilla::a11y;

View File

@ -45,17 +45,12 @@ ia2AccessibleHypertext::get_hyperlink(long aLinkIndex,
return CO_E_OBJNOTCONNECTED; return CO_E_OBJNOTCONNECTED;
Accessible* hyperLink = hyperText->GetLinkAt(aLinkIndex); Accessible* hyperLink = hyperText->GetLinkAt(aLinkIndex);
nsCOMPtr<nsIWinAccessNode> winAccessNode(do_QueryObject(hyperLink)); if (!hyperText)
if (!winAccessNode)
return E_FAIL; return E_FAIL;
void *instancePtr = NULL; *aHyperlink =
nsresult rv = winAccessNode->QueryNativeInterface(IID_IAccessibleHyperlink, static_cast<IAccessibleHyperlink*>(static_cast<AccessibleWrap*>(hyperLink));
&instancePtr); (*aHyperlink)->AddRef();
if (NS_FAILED(rv))
return E_FAIL;
*aHyperlink = static_cast<IAccessibleHyperlink*>(instancePtr);
return S_OK; return S_OK;
A11Y_TRYBLOCK_END A11Y_TRYBLOCK_END

View File

@ -163,7 +163,11 @@ ia2AccessibleRelation::get_target(long aTargetIndex, IUnknown **aTarget)
if (aTargetIndex < 0 || (uint32_t)aTargetIndex >= mTargets.Length() || !aTarget) if (aTargetIndex < 0 || (uint32_t)aTargetIndex >= mTargets.Length() || !aTarget)
return E_INVALIDARG; return E_INVALIDARG;
mTargets[aTargetIndex]->QueryNativeInterface(IID_IUnknown, (void**) aTarget); AccessibleWrap* target =
static_cast<AccessibleWrap*>(mTargets[aTargetIndex].get());
*aTarget = static_cast<IAccessible*>(target);
(*aTarget)->AddRef();
return S_OK; return S_OK;
A11Y_TRYBLOCK_END A11Y_TRYBLOCK_END

View File

@ -110,6 +110,20 @@
// aria-readonly // aria-readonly
testStates("aria_readonly_textbox", STATE_READONLY); testStates("aria_readonly_textbox", STATE_READONLY);
// readonly/editable on grid and gridcell
testStates("aria_grid_default", 0, EXT_STATE_EDITABLE,
STATE_READONLY, 0);
testStates("aria_grid_default_cell_readonly", STATE_READONLY, 0,
0, EXT_STATE_EDITABLE);
testStates("aria_grid_default_cell_inherited", 0, EXT_STATE_EDITABLE,
STATE_READONLY, 0);
testStates("aria_grid_readonly", STATE_READONLY, 0,
0, EXT_STATE_EDITABLE);
testStates("aria_grid_readonly_cell_editable", 0, EXT_STATE_EDITABLE,
STATE_READONLY, 0);
testStates("aria_grid_readonly_cell_inherited", STATE_READONLY, 0,
0, EXT_STATE_EDITABLE);
// aria-selectable // aria-selectable
testStates("aria_selectable_listitem", STATE_SELECTABLE | STATE_SELECTED); testStates("aria_selectable_listitem", STATE_SELECTABLE | STATE_SELECTED);
@ -230,6 +244,11 @@
title="fix default horizontal / vertical state of role=scrollbar and ensure only one of horizontal / vertical states is exposed"> title="fix default horizontal / vertical state of role=scrollbar and ensure only one of horizontal / vertical states is exposed">
Mozilla Bug 762876 Mozilla Bug 762876
</a> </a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=835121
title="ARIA grid should be editable by default">
Mozilla Bug 835121
</a>
<p id="display"></p> <p id="display"></p>
<div id="content" style="display: none"></div> <div id="content" style="display: none"></div>
<pre id="test"> <pre id="test">
@ -265,7 +284,26 @@
<div id="aria_multiline_textbox" role="textbox" aria-multiline="true"></div> <div id="aria_multiline_textbox" role="textbox" aria-multiline="true"></div>
<div id="aria_multiselectable_listbox" role="listbox" aria-multiselectable="true"></div> <div id="aria_multiselectable_listbox" role="listbox" aria-multiselectable="true"></div>
<div id="aria_pressed_button" role="button" aria-pressed="true">Button</div> <div id="aria_pressed_button" role="button" aria-pressed="true">Button</div>
<div id="aria_readonly_textbox" role="textbox" aria-readonly="true">This text should be readonly</div>
<div id="aria_readonly_textbox"
role="textbox" aria-readonly="true">This text should be readonly</div>
<div id="aria_grid_default" role="grid">
<div role="row">
<div id="aria_grid_default_cell_readonly"
role="gridcell" aria-readonly="true">gridcell1</div>
<div id="aria_grid_default_cell_inherited"
role="gridcell">gridcell2</div>
</div>
<div id="aria_grid_readonly" role="grid" aria-readonly="true">
<div role="row">
<div id="aria_grid_readonly_cell_editable"
role="gridcell" aria-readonly="false">gridcell1</div>
<div id="aria_grid_readonly_cell_inherited"
role="gridcell">gridcell2</div>
</div>
<div role="listbox"> <div role="listbox">
<div id="aria_selectable_listitem" role="option" aria-selected="true">Item1</div> <div id="aria_selectable_listitem" role="option" aria-selected="true">Item1</div>
</div> </div>
@ -313,7 +351,7 @@
<a id="aria_application_link" role="application" href="foo">app</a> <a id="aria_application_link" role="application" href="foo">app</a>
<a id="aria_main_link" role="main" href="foo">main</a> <a id="aria_main_link" role="main" href="foo">main</a>
<a id="aria_navigation_link" role="navigation" href="foo">nav</a> <a id="aria_navigation_link" role="navigation" href="foo">nav</a>
<!-- landmarks: anchors --> <!-- landmarks: anchors -->
<a id="aria_application_anchor" role="application" name="app_anchor">app</a> <a id="aria_application_anchor" role="application" name="app_anchor">app</a>
<a id="aria_main_anchor" role="main" name="main_anchor">main</a> <a id="aria_main_anchor" role="main" name="main_anchor">main</a>

View File

@ -129,7 +129,6 @@
#ifdef ACCESSIBILITY #ifdef ACCESSIBILITY
#ifdef XP_WIN32 #ifdef XP_WIN32
@BINPATH@/AccessibleMarshal.dll @BINPATH@/AccessibleMarshal.dll
@BINPATH@/components/accessibility-msaa.xpt
#endif #endif
@BINPATH@/components/accessibility.xpt @BINPATH@/components/accessibility.xpt
#endif #endif

View File

@ -119,10 +119,6 @@ ifeq ($(OS_ARCH),WINNT) #{
# #
ifndef GNU_CC #{ ifndef GNU_CC #{
LDFLAGS += /HEAP:0x40000 LDFLAGS += /HEAP:0x40000
ifeq ($(OS_TEST),x86_64) #{
# set stack to 2MB on x64 build. See bug 582910
LDFLAGS += -STACK:2097152
endif #}
endif #} endif #}
endif #} endif #}

View File

@ -265,7 +265,6 @@
class="social-panel" class="social-panel"
type="arrow" type="arrow"
hidden="true" hidden="true"
consumeoutsideclicks="false"
noautofocus="true"/> noautofocus="true"/>
<panel id="social-flyout-panel" <panel id="social-flyout-panel"
class="social-panel" class="social-panel"

View File

@ -139,7 +139,6 @@
#ifdef ACCESSIBILITY #ifdef ACCESSIBILITY
#ifdef XP_WIN32 #ifdef XP_WIN32
@BINPATH@/AccessibleMarshal.dll @BINPATH@/AccessibleMarshal.dll
@BINPATH@/components/accessibility-msaa.xpt
#endif #endif
@BINPATH@/components/accessibility.xpt @BINPATH@/components/accessibility.xpt
#endif #endif

View File

@ -56,13 +56,13 @@ fi
CLANG_CC= CLANG_CC=
CLANG_CXX= CLANG_CXX=
if test "$GCC" = yes; then if test "$GCC" = yes; then
if test "`$CC -v 2>&1 | grep -c 'clang version'`" != "0"; then if test "`$CC -v 2>&1 | grep -c 'clang version\|Apple.*clang'`" != "0"; then
CLANG_CC=1 CLANG_CC=1
fi fi
fi fi
if test "$GXX" = yes; then if test "$GXX" = yes; then
if test "`$CXX -v 2>&1 | grep -c 'clang version'`" != "0"; then if test "`$CXX -v 2>&1 | grep -c 'clang version\|Apple.*clang'`" != "0"; then
CLANG_CXX=1 CLANG_CXX=1
fi fi
fi fi

View File

@ -589,6 +589,13 @@ endif
endif endif
endif endif
ifdef _MSC_VER
ifeq ($(CPU_ARCH),x86_64)
# set stack to 2MB on x64 build. See bug 582910
WIN32_EXE_LDFLAGS += -STACK:2097152
endif
endif
# If we're building a component on MSVC, we don't want to generate an # If we're building a component on MSVC, we don't want to generate an
# import lib, because that import lib will collide with the name of a # import lib, because that import lib will collide with the name of a
# static version of the same library. # static version of the same library.

View File

@ -267,6 +267,14 @@ class SectionFinder(object):
syms.append((tmp[-1], tmp[0])) syms.append((tmp[-1], tmp[0]))
return syms return syms
def print_command(out, args):
print >>out, "Executing: " + " ".join(args)
for tmp in [f for f in args.tmp if os.path.isfile(f)]:
print >>out, tmp + ":"
with open(tmp) as file:
print >>out, "".join([" " + l for l in file.readlines()])
out.flush()
def main(): def main():
parser = OptionParser() parser = OptionParser()
parser.add_option("--depend", dest="depend", metavar="FILE", parser.add_option("--depend", dest="depend", metavar="FILE",
@ -302,15 +310,15 @@ def main():
args.makelist() args.makelist()
if options.verbose: if options.verbose:
print >>sys.stderr, "Executing: " + " ".join(args) print_command(sys.stderr, args)
for tmp in [f for f in args.tmp if os.path.isfile(f)]: proc = subprocess.Popen(args, stdout = subprocess.PIPE, stderr = subprocess.STDOUT)
print >>sys.stderr, tmp + ":" (stdout, stderr) = proc.communicate()
with open(tmp) as file: if proc.returncode and not options.verbose:
print >>sys.stderr, "".join([" " + l for l in file.readlines()]) print_command(sys.stderr, args)
sys.stderr.flush() sys.stderr.write(stdout)
ret = subprocess.call(args) sys.stderr.flush()
if ret: if proc.returncode:
exit(ret) exit(proc.returncode)
if not options.depend: if not options.depend:
return return
ensureParentDir(options.depend) ensureParentDir(options.depend)

View File

@ -32,8 +32,3 @@ ifneq (,$(filter OS2 WINNT,$(OS_ARCH))) # {
else # } { else # } {
$(RM) -f $(DIST)/sdk/lib/$(LIB_PREFIX)nspr4.$(LIB_SUFFIX) $(DIST)/sdk/lib/$(LIB_PREFIX)plc4.$(LIB_SUFFIX) $(DIST)/sdk/lib/$(LIB_PREFIX)plds4.$(LIB_SUFFIX) $(RM) -f $(DIST)/sdk/lib/$(LIB_PREFIX)nspr4.$(LIB_SUFFIX) $(DIST)/sdk/lib/$(LIB_PREFIX)plc4.$(LIB_SUFFIX) $(DIST)/sdk/lib/$(LIB_PREFIX)plds4.$(LIB_SUFFIX)
endif # } endif # }
install::
$(MAKE) -C $(DEPTH)/nsprpub install DESTDIR=$(DESTDIR) libdir=$(mozappdir) includedir=$(includedir)/nspr
$(RM) -f $(addprefix $(DESTDIR)$(mozappdir)/$(LIB_PREFIX), $(addsuffix .$(LIB_SUFFIX), nspr4 plds4 plc4))
$(RM) -f $(addprefix $(DESTDIR)$(bindir)/,nspr-config compile-et.pl prerr.properties)

View File

@ -1,10 +0,0 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
TIERS += nspr
ifndef MOZ_NATIVE_NSPR
tier_nspr_staticdirs += nsprpub
tier_nspr_dirs += config/nspr
endif

View File

@ -18,7 +18,7 @@ interface nsINode;
* @version 1.0 * @version 1.0
*/ */
[scriptable, uuid(12cf5a4d-fffb-4f2f-9cec-c65195661d76)] [scriptable, builtinclass, uuid(12cf5a4d-fffb-4f2f-9cec-c65195661d76)]
interface nsISelection : nsISupports interface nsISelection : nsISupports
{ {
/** /**

View File

@ -31,7 +31,7 @@ struct ScrollAxis;
native nsDirection(nsDirection); native nsDirection(nsDirection);
native ScrollAxis(nsIPresShell::ScrollAxis); native ScrollAxis(nsIPresShell::ScrollAxis);
[scriptable, uuid(2e44b10f-7d6d-4bf4-92e2-f9551d22f422)] [scriptable, builtinclass, uuid(2e44b10f-7d6d-4bf4-92e2-f9551d22f422)]
interface nsISelectionPrivate : nsISelection interface nsISelectionPrivate : nsISelection
{ {
const short ENDOFPRECEDINGLINE=0; const short ENDOFPRECEDINGLINE=0;

View File

@ -6123,15 +6123,15 @@ nsContentUtils::CheckCCWrapperTraversal(void* aScriptObjectHolder,
DebugWrapperTraversalCallback callback(wrapper); DebugWrapperTraversalCallback callback(wrapper);
aTracer->Traverse(aScriptObjectHolder, callback); aTracer->Traverse(aScriptObjectHolder, callback);
NS_ASSERTION(callback.mFound, MOZ_ASSERT(callback.mFound,
"Cycle collection participant didn't traverse to preserved " "Cycle collection participant didn't traverse to preserved "
"wrapper! This will probably crash."); "wrapper! This will probably crash.");
callback.mFound = false; callback.mFound = false;
aTracer->Trace(aScriptObjectHolder, DebugWrapperTraceCallback, &callback); aTracer->Trace(aScriptObjectHolder, DebugWrapperTraceCallback, &callback);
NS_ASSERTION(callback.mFound, MOZ_ASSERT(callback.mFound,
"Cycle collection participant didn't trace preserved wrapper! " "Cycle collection participant didn't trace preserved wrapper! "
"This will probably crash."); "This will probably crash.");
} }
#endif #endif

View File

@ -34,12 +34,11 @@
#include "nsICharsetConverterManager.h" #include "nsICharsetConverterManager.h"
#include "nsGkAtoms.h" #include "nsGkAtoms.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsIEnumerator.h"
#include "nsIParserService.h" #include "nsIParserService.h"
#include "nsIScriptContext.h" #include "nsIScriptContext.h"
#include "nsIScriptGlobalObject.h" #include "nsIScriptGlobalObject.h"
#include "nsIScriptSecurityManager.h" #include "nsIScriptSecurityManager.h"
#include "nsISelection.h" #include "mozilla/Selection.h"
#include "nsISelectionPrivate.h" #include "nsISelectionPrivate.h"
#include "nsITransferable.h" // for kUnicodeMime #include "nsITransferable.h" // for kUnicodeMime
#include "nsContentUtils.h" #include "nsContentUtils.h"
@ -1348,19 +1347,17 @@ nsHTMLCopyEncoder::SetSelection(nsISelection* aSelection)
nsCOMPtr<nsIDOMRange> range; nsCOMPtr<nsIDOMRange> range;
nsCOMPtr<nsIDOMNode> commonParent; nsCOMPtr<nsIDOMNode> commonParent;
int32_t count = 0; Selection* selection = static_cast<Selection*>(aSelection);
uint32_t rangeCount = selection->GetRangeCount();
nsresult rv = aSelection->GetRangeCount(&count);
NS_ENSURE_SUCCESS(rv, rv);
// if selection is uninitialized return // if selection is uninitialized return
if (!count) if (!rangeCount)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
// we'll just use the common parent of the first range. Implicit assumption // we'll just use the common parent of the first range. Implicit assumption
// here that multi-range selections are table cell selections, in which case // here that multi-range selections are table cell selections, in which case
// the common parent is somewhere in the table and we don't really care where. // the common parent is somewhere in the table and we don't really care where.
rv = aSelection->GetRangeAt(0, getter_AddRefs(range)); nsresult rv = aSelection->GetRangeAt(0, getter_AddRefs(range));
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
if (!range) if (!range)
return NS_ERROR_NULL_POINTER; return NS_ERROR_NULL_POINTER;
@ -1412,25 +1409,10 @@ nsHTMLCopyEncoder::SetSelection(nsISelection* aSelection)
//NS_ENSURE_SUCCESS(rv, rv); //NS_ENSURE_SUCCESS(rv, rv);
NS_NewDomSelection(getter_AddRefs(mSelection)); NS_NewDomSelection(getter_AddRefs(mSelection));
NS_ENSURE_TRUE(mSelection, NS_ERROR_FAILURE); NS_ENSURE_TRUE(mSelection, NS_ERROR_FAILURE);
nsCOMPtr<nsISelectionPrivate> privSelection( do_QueryInterface(aSelection) );
NS_ENSURE_TRUE(privSelection, NS_ERROR_FAILURE);
// get selection range enumerator
nsCOMPtr<nsIEnumerator> enumerator;
rv = privSelection->GetEnumerator(getter_AddRefs(enumerator));
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_TRUE(enumerator, NS_ERROR_FAILURE);
// loop thru the ranges in the selection // loop thru the ranges in the selection
enumerator->First(); for (uint32_t rangeIdx = 0; rangeIdx < rangeCount; ++rangeIdx) {
nsCOMPtr<nsISupports> currentItem; range = selection->GetRangeAt(rangeIdx);
while (static_cast<nsresult>(NS_ENUMERATOR_FALSE) == enumerator->IsDone())
{
rv = enumerator->CurrentItem(getter_AddRefs(currentItem));
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_TRUE(currentItem, NS_ERROR_FAILURE);
range = do_QueryInterface(currentItem);
NS_ENSURE_TRUE(range, NS_ERROR_FAILURE); NS_ENSURE_TRUE(range, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMRange> myRange; nsCOMPtr<nsIDOMRange> myRange;
range->CloneRange(getter_AddRefs(myRange)); range->CloneRange(getter_AddRefs(myRange));
@ -1442,8 +1424,6 @@ nsHTMLCopyEncoder::SetSelection(nsISelection* aSelection)
rv = mSelection->AddRange(myRange); rv = mSelection->AddRange(myRange);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
enumerator->Next();
} }
return NS_OK; return NS_OK;

View File

@ -142,12 +142,13 @@ CPPSRCS = \
ifdef MOZ_MEDIA ifdef MOZ_MEDIA
EXPORTS_mozilla/dom += \ EXPORTS_mozilla/dom += \
HTMLSourceElement.h \ HTMLSourceElement.h \
MediaError.h \
$(NULL) $(NULL)
CPPSRCS += \ CPPSRCS += \
nsHTMLAudioElement.cpp \ nsHTMLAudioElement.cpp \
nsHTMLMediaElement.cpp \ nsHTMLMediaElement.cpp \
nsMediaError.cpp \ MediaError.cpp \
nsMediaFragmentURIParser.cpp \ nsMediaFragmentURIParser.cpp \
HTMLSourceElement.cpp \ HTMLSourceElement.cpp \
nsTimeRanges.cpp \ nsTimeRanges.cpp \

View File

@ -0,0 +1,50 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/dom/MediaError.h"
#include "nsDOMClassInfoID.h"
#include "mozilla/dom/MediaErrorBinding.h"
DOMCI_DATA(MediaError, mozilla::dom::MediaError)
namespace mozilla {
namespace dom {
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(MediaError, mParent)
NS_IMPL_CYCLE_COLLECTING_ADDREF(MediaError)
NS_IMPL_CYCLE_COLLECTING_RELEASE(MediaError)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(MediaError)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRY(nsIDOMMediaError)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMMediaError)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MediaError)
NS_INTERFACE_MAP_END
MediaError::MediaError(nsHTMLMediaElement* aParent, uint16_t aCode)
: mParent(aParent)
, mCode(aCode)
{
SetIsDOMBinding();
}
NS_IMETHODIMP MediaError::GetCode(uint16_t* aCode)
{
if (aCode)
*aCode = Code();
return NS_OK;
}
JSObject*
MediaError::WrapObject(JSContext* aCx, JSObject* aScope,
bool* aTriedToWrap)
{
return MediaErrorBinding::Wrap(aCx, aScope, this, aTriedToWrap);
}
} // namespace dom
} // namespace mozilla

View File

@ -0,0 +1,54 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_dom_MediaError_h
#define mozilla_dom_MediaError_h
#include "nsIDOMMediaError.h"
#include "nsHTMLMediaElement.h"
#include "nsWrapperCache.h"
#include "nsISupports.h"
#include "mozilla/Attributes.h"
namespace mozilla {
namespace dom {
class MediaError MOZ_FINAL : public nsIDOMMediaError,
public nsWrapperCache
{
public:
MediaError(nsHTMLMediaElement* aParent, uint16_t aCode);
// nsISupports
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(MediaError)
// nsIDOMMediaError
NS_DECL_NSIDOMMEDIAERROR
nsHTMLMediaElement* GetParentObject() const
{
return mParent;
}
virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope, bool* aTriedToWrap);
uint16_t Code() const
{
return mCode;
}
private:
nsRefPtr<nsHTMLMediaElement> mParent;
// Error code
const uint16_t mCode;
};
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_MediaError_h

View File

@ -38,7 +38,7 @@
#include "nsITimer.h" #include "nsITimer.h"
#include "nsEventDispatcher.h" #include "nsEventDispatcher.h"
#include "nsMediaError.h" #include "MediaError.h"
#include "MediaDecoder.h" #include "MediaDecoder.h"
#include "nsICategoryManager.h" #include "nsICategoryManager.h"
#include "MediaResource.h" #include "MediaResource.h"
@ -436,6 +436,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsHTMLMediaElement, nsGenericH
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSourcePointer) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSourcePointer)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mLoadBlockedDoc) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mLoadBlockedDoc)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSourceLoadCandidate) NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSourceLoadCandidate)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mError)
for (uint32_t i = 0; i < tmp->mOutputStreams.Length(); ++i) { for (uint32_t i = 0; i < tmp->mOutputStreams.Length(); ++i) {
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOutputStreams[i].mStream); NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOutputStreams[i].mStream);
} }
@ -451,6 +452,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsHTMLMediaElement, nsGenericHTM
NS_IMPL_CYCLE_COLLECTION_UNLINK(mSourcePointer) NS_IMPL_CYCLE_COLLECTION_UNLINK(mSourcePointer)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mLoadBlockedDoc) NS_IMPL_CYCLE_COLLECTION_UNLINK(mLoadBlockedDoc)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mSourceLoadCandidate) NS_IMPL_CYCLE_COLLECTION_UNLINK(mSourceLoadCandidate)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mError)
for (uint32_t i = 0; i < tmp->mOutputStreams.Length(); ++i) { for (uint32_t i = 0; i < tmp->mOutputStreams.Length(); ++i) {
NS_IMPL_CYCLE_COLLECTION_UNLINK(mOutputStreams[i].mStream); NS_IMPL_CYCLE_COLLECTION_UNLINK(mOutputStreams[i].mStream);
} }
@ -660,7 +662,7 @@ void nsHTMLMediaElement::NoSupportedMediaSourceError()
{ {
NS_ASSERTION(mDelayingLoadEvent, "Load event not delayed during source selection?"); NS_ASSERTION(mDelayingLoadEvent, "Load event not delayed during source selection?");
mError = new nsMediaError(nsIDOMMediaError::MEDIA_ERR_SRC_NOT_SUPPORTED); mError = new MediaError(this, nsIDOMMediaError::MEDIA_ERR_SRC_NOT_SUPPORTED);
mNetworkState = nsIDOMHTMLMediaElement::NETWORK_NO_SOURCE; mNetworkState = nsIDOMHTMLMediaElement::NETWORK_NO_SOURCE;
DispatchAsyncEvent(NS_LITERAL_STRING("error")); DispatchAsyncEvent(NS_LITERAL_STRING("error"));
// This clears mDelayingLoadEvent, so AddRemoveSelfReference will be called // This clears mDelayingLoadEvent, so AddRemoveSelfReference will be called
@ -2740,7 +2742,7 @@ void nsHTMLMediaElement::Error(uint16_t aErrorCode)
aErrorCode == nsIDOMMediaError::MEDIA_ERR_NETWORK || aErrorCode == nsIDOMMediaError::MEDIA_ERR_NETWORK ||
aErrorCode == nsIDOMMediaError::MEDIA_ERR_ABORTED, aErrorCode == nsIDOMMediaError::MEDIA_ERR_ABORTED,
"Only use nsIDOMMediaError codes!"); "Only use nsIDOMMediaError codes!");
mError = new nsMediaError(aErrorCode); mError = new MediaError(this, aErrorCode);
mBegun = false; mBegun = false;
DispatchAsyncEvent(NS_LITERAL_STRING("error")); DispatchAsyncEvent(NS_LITERAL_STRING("error"));
if (mReadyState == nsIDOMHTMLMediaElement::HAVE_NOTHING) { if (mReadyState == nsIDOMHTMLMediaElement::HAVE_NOTHING) {

View File

@ -29,7 +29,7 @@
#include "nsEventDispatcher.h" #include "nsEventDispatcher.h"
#include "nsIDOMProgressEvent.h" #include "nsIDOMProgressEvent.h"
#include "nsMediaError.h" #include "MediaError.h"
#include "MediaDecoder.h" #include "MediaDecoder.h"
using namespace mozilla; using namespace mozilla;

View File

@ -1,31 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsMediaError.h"
#include "nsDOMClassInfoID.h"
NS_IMPL_ADDREF(nsMediaError)
NS_IMPL_RELEASE(nsMediaError)
DOMCI_DATA(MediaError, nsMediaError)
NS_INTERFACE_MAP_BEGIN(nsMediaError)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_ENTRY(nsIDOMMediaError)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(MediaError)
NS_INTERFACE_MAP_END
nsMediaError::nsMediaError(uint16_t aCode) :
mCode(aCode)
{
}
NS_IMETHODIMP nsMediaError::GetCode(uint16_t* aCode)
{
if (aCode)
*aCode = mCode;
return NS_OK;
}

View File

@ -1,24 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsIDOMMediaError.h"
#include "nsISupports.h"
#include "mozilla/Attributes.h"
class nsMediaError MOZ_FINAL : public nsIDOMMediaError
{
public:
nsMediaError(uint16_t aCode);
// nsISupports
NS_DECL_ISUPPORTS
// nsIDOMMediaError
NS_DECL_NSIDOMMEDIAERROR
private:
// Error code
uint16_t mCode;
};

View File

@ -2305,11 +2305,8 @@ int64_t MediaDecoderStateMachine::GetVideoStreamPosition()
int64_t pos = DurationToUsecs(TimeStamp::Now() - mPlayStartTime) + mPlayDuration; int64_t pos = DurationToUsecs(TimeStamp::Now() - mPlayStartTime) + mPlayDuration;
pos -= mBasePosition; pos -= mBasePosition;
if (pos >= 0) { NS_ASSERTION(pos >= 0, "Video stream position should be positive.");
int64_t final = mBasePosition + pos * mPlaybackRate + mStartTime; return mBasePosition + pos * mPlaybackRate + mStartTime;
return final;
}
return mPlayDuration + mStartTime;
} }
int64_t MediaDecoderStateMachine::GetClock() { int64_t MediaDecoderStateMachine::GetClock() {
@ -2768,12 +2765,14 @@ void MediaDecoderStateMachine::SetPlaybackRate(double aPlaybackRate)
// Get position of the last time we changed the rate. // Get position of the last time we changed the rate.
if (!HasAudio()) { if (!HasAudio()) {
// mBasePosition is a position in the video stream, not an absolute time. // mBasePosition is a position in the video stream, not an absolute time.
mBasePosition = GetVideoStreamPosition(); if (mState == DECODER_STATE_SEEKING) {
if (IsPlaying()) { mBasePosition = mSeekTime;
mPlayDuration = mBasePosition - mStartTime; } else {
mResetPlayStartTime = true; mBasePosition = GetVideoStreamPosition();
mPlayStartTime = TimeStamp::Now();
} }
mPlayDuration = mBasePosition - mStartTime;
mResetPlayStartTime = true;
mPlayStartTime = TimeStamp::Now();
} }
mPlaybackRate = aPlaybackRate; mPlaybackRate = aPlaybackRate;

View File

@ -235,9 +235,6 @@ this.AppsUtils = {
} }
} }
// Ensure that non-updatable fields contains the current app value
AppsUtils.normalizeManifest(aManifest, app);
return true; return true;
}, },
@ -257,33 +254,24 @@ this.AppsUtils = {
* Method to apply modifications to webapp manifests file saved internally. * Method to apply modifications to webapp manifests file saved internally.
* For now, only ensure app can't rename itself. * For now, only ensure app can't rename itself.
*/ */
normalizeManifest: function normalizeManifest(aManifest, aApp) { ensureSameAppName: function ensureSameAppName(aOldManifest, aNewManifest, aApp) {
// As normalizeManifest isn't only called on update but also
// during app install, we need to bail out on install.
if (aApp.installState != "installed" &&
aApp.installState != "updating") {
return;
}
let previousManifest = aApp.manifest;
// Ensure that app name can't be updated // Ensure that app name can't be updated
aManifest.name = aApp.name; aNewManifest.name = aApp.name;
// Nor through localized names // Nor through localized names
if ('locales' in aManifest) { if ('locales' in aNewManifest) {
let defaultName = new ManifestHelper(aManifest, aApp.origin).name; let defaultName = new ManifestHelper(aOldManifest, aApp.origin).name;
for (let locale in aManifest.locales) { for (let locale in aNewManifest.locales) {
let entry = aManifest.locales[locale]; let entry = aNewManifest.locales[locale];
if (!entry.name) { if (!entry.name) {
continue; continue;
} }
// In case previous manifest didn't had a name, // In case previous manifest didn't had a name,
// we use the default app name // we use the default app name
let localizedName = defaultName; let localizedName = defaultName;
if (previousManifest && 'locales' in previousManifest && if (aOldManifest && 'locales' in aOldManifest &&
locale in previousManifest.locales) { locale in aOldManifest.locales) {
localizedName = previousManifest.locales[locale].name; localizedName = aOldManifest.locales[locale].name;
} }
entry.name = localizedName; entry.name = localizedName;
} }

View File

@ -393,6 +393,7 @@ WebappsApplication.prototype = {
this.initHelper(aWindow, ["Webapps:OfflineCache", this.initHelper(aWindow, ["Webapps:OfflineCache",
"Webapps:CheckForUpdate:Return:OK", "Webapps:CheckForUpdate:Return:OK",
"Webapps:CheckForUpdate:Return:KO", "Webapps:CheckForUpdate:Return:KO",
"Webapps:Launch:Return:KO",
"Webapps:PackageEvent"]); "Webapps:PackageEvent"]);
cpmm.sendAsyncMessage("Webapps:RegisterForMessages", cpmm.sendAsyncMessage("Webapps:RegisterForMessages",

View File

@ -1482,20 +1482,8 @@ this.DOMApplicationRegistry = {
return; return;
} }
// Try to download a new manifest. // On xhr load request event
let xhr = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"] function onload(xhr, oldManifest) {
.createInstance(Ci.nsIXMLHttpRequest);
xhr.open("GET", aData.manifestURL, true);
xhr.channel.loadFlags |= Ci.nsIRequest.INHIBIT_CACHING;
xhr.responseType = "json";
if (app.etag) {
debug("adding manifest etag:" + app.etag);
xhr.setRequestHeader("If-None-Match", app.etag);
}
xhr.channel.notificationCallbacks =
this.createLoadContext(app.installerAppId, app.installerIsBrowser);
xhr.addEventListener("load", (function() {
debug("Got http status=" + xhr.status + " for " + aData.manifestURL); debug("Got http status=" + xhr.status + " for " + aData.manifestURL);
let oldHash = app.manifestHash; let oldHash = app.manifestHash;
let isPackage = app.origin.startsWith("app://"); let isPackage = app.origin.startsWith("app://");
@ -1514,6 +1502,8 @@ this.DOMApplicationRegistry = {
sendError("INSTALL_FROM_DENIED"); sendError("INSTALL_FROM_DENIED");
return; return;
} else { } else {
AppsUtils.ensureSameAppName(oldManifest, manifest, app);
let hash = this.computeManifestHash(manifest); let hash = this.computeManifestHash(manifest);
debug("Manifest hash = " + hash); debug("Manifest hash = " + hash);
if (isPackage) { if (isPackage) {
@ -1543,12 +1533,10 @@ this.DOMApplicationRegistry = {
this._saveApps(); this._saveApps();
} }
} else { } else {
this._readManifests([{ id: id }], (function(aResult) { // Update only the appcache if the manifest has not changed
// Update only the appcache if the manifest has not changed // based on the hash value.
// based on the hash value. updateHostedApp.call(this, oldManifest,
updateHostedApp.call(this, aResult[0].manifest, oldHash == hash ? null : manifest);
oldHash == hash ? null : manifest);
}).bind(this));
} }
} }
} else if (xhr.status == 304) { } else if (xhr.status == 304) {
@ -1567,21 +1555,40 @@ this.DOMApplicationRegistry = {
} else { } else {
// For hosted apps, even if the manifest has not changed, we check // For hosted apps, even if the manifest has not changed, we check
// for offline cache updates. // for offline cache updates.
this._readManifests([{ id: id }], (function(aResult) { updateHostedApp.call(this, oldManifest, null);
updateHostedApp.call(this, aResult[0].manifest, null);
}).bind(this));
} }
} else { } else {
sendError("MANIFEST_URL_ERROR"); sendError("MANIFEST_URL_ERROR");
} }
}).bind(this), false); }
xhr.addEventListener("error", (function() { // Try to download a new manifest.
sendError("NETWORK_ERROR"); function doRequest(oldManifest) {
}).bind(this), false); let xhr = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]
.createInstance(Ci.nsIXMLHttpRequest);
xhr.open("GET", aData.manifestURL, true);
xhr.channel.loadFlags |= Ci.nsIRequest.INHIBIT_CACHING;
xhr.responseType = "json";
if (app.etag) {
debug("adding manifest etag:" + app.etag);
xhr.setRequestHeader("If-None-Match", app.etag);
}
xhr.channel.notificationCallbacks =
this.createLoadContext(app.installerAppId, app.installerIsBrowser);
debug("Checking manifest at " + aData.manifestURL); xhr.addEventListener("load", onload.bind(this, xhr, oldManifest), false);
xhr.send(null); xhr.addEventListener("error", (function() {
sendError("NETWORK_ERROR");
}).bind(this), false);
debug("Checking manifest at " + aData.manifestURL);
xhr.send(null);
}
// Read the current app manifest file
this._readManifests([{ id: id }], (function(aResult) {
doRequest.call(this, aResult[0].manifest);
}).bind(this));
}, },
// Creates a nsILoadContext object with a given appId and isBrowser flag. // Creates a nsILoadContext object with a given appId and isBrowser flag.
@ -2305,13 +2312,14 @@ this.DOMApplicationRegistry = {
let manifest = JSON.parse(converter.ConvertToUnicode(NetUtil.readInputStreamToString(istream, let manifest = JSON.parse(converter.ConvertToUnicode(NetUtil.readInputStreamToString(istream,
istream.available()) || "")); istream.available()) || ""));
// Call checkManifest before compareManifests, as checkManifest
// will normalize some attributes that has already been normalized
// for aManifest during checkForUpdate.
if (!AppsUtils.checkManifest(manifest, app)) { if (!AppsUtils.checkManifest(manifest, app)) {
throw "INVALID_MANIFEST"; throw "INVALID_MANIFEST";
} }
// Call ensureSameAppName before compareManifests, as `manifest`,
// has been normalized to avoid app rename.
AppsUtils.ensureSameAppName(aManifest._manifest, manifest, app);
if (!AppsUtils.compareManifests(manifest, if (!AppsUtils.compareManifests(manifest,
aManifest._manifest)) { aManifest._manifest)) {
throw "MANIFEST_MISMATCH"; throw "MANIFEST_MISMATCH";

View File

@ -601,6 +601,10 @@ DOMInterfaces = {
'register': False 'register': False
}, },
'MediaError': {
'hasInstanceInterface': 'nsIDOMMediaError',
},
'MediaStream': [{ 'MediaStream': [{
'nativeType': 'nsIDOMMediaStream', 'nativeType': 'nsIDOMMediaStream',
}, },

View File

@ -144,6 +144,8 @@ static nsAutoPtr<RawDBusConnection> gThreadConnection;
static nsDataHashtable<nsStringHashKey, DBusMessage* > sPairingReqTable; static nsDataHashtable<nsStringHashKey, DBusMessage* > sPairingReqTable;
static nsDataHashtable<nsStringHashKey, DBusMessage* > sAuthorizeReqTable; static nsDataHashtable<nsStringHashKey, DBusMessage* > sAuthorizeReqTable;
static PRInt32 sIsPairing = 0; static PRInt32 sIsPairing = 0;
static nsString sAdapterPath;
typedef void (*UnpackFunc)(DBusMessage*, DBusError*, BluetoothValue&, nsAString&); typedef void (*UnpackFunc)(DBusMessage*, DBusError*, BluetoothValue&, nsAString&);
class RemoveDeviceTask : public nsRunnable { class RemoveDeviceTask : public nsRunnable {
@ -780,6 +782,22 @@ BluetoothDBusService::AddReservedServicesInternal(const nsAString& aAdapterPath,
return true; return true;
} }
void
BluetoothDBusService::DisconnectAllAcls(const nsAString& aAdapterPath)
{
MOZ_ASSERT(!NS_IsMainThread());
DBusMessage* reply =
dbus_func_args(gThreadConnection->GetConnection(),
NS_ConvertUTF16toUTF8(aAdapterPath).get(),
DBUS_ADAPTER_IFACE, "DisconnectAllConnections",
DBUS_TYPE_INVALID);
if (reply) {
dbus_message_unref(reply);
}
}
class PrepareProfileManagersRunnable : public nsRunnable class PrepareProfileManagersRunnable : public nsRunnable
{ {
public: public:
@ -1653,7 +1671,10 @@ BluetoothDBusService::StopInternal()
// This could block. It should never be run on the main thread. // This could block. It should never be run on the main thread.
MOZ_ASSERT(!NS_IsMainThread()); MOZ_ASSERT(!NS_IsMainThread());
NS_DispatchToMainThread(new ShutdownProfileManagersRunnable()); // If Bluetooth is turned off while connections exist, in order not to only
// disconnect with profile connections with low level ACL connections alive,
// we disconnect ACLs directly instead of closing each socket.
DisconnectAllAcls(sAdapterPath);
if (!mConnection) { if (!mConnection) {
StopDBus(); StopDBus();
@ -2409,6 +2430,9 @@ BluetoothDBusService::PrepareAdapterInternal(const nsAString& aPath)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
// Keep the adapter path for further use
sAdapterPath = aPath;
nsRefPtr<nsRunnable> func(new PrepareAdapterRunnable(aPath)); nsRefPtr<nsRunnable> func(new PrepareAdapterRunnable(aPath));
if (NS_FAILED(mBluetoothCommandThread->Dispatch(func, NS_DISPATCH_NORMAL))) { if (NS_FAILED(mBluetoothCommandThread->Dispatch(func, NS_DISPATCH_NORMAL))) {
NS_WARNING("Cannot dispatch task!"); NS_WARNING("Cannot dispatch task!");

View File

@ -167,6 +167,8 @@ private:
nsresult SendSetPropertyMessage(const nsString& aPath, const char* aInterface, nsresult SendSetPropertyMessage(const nsString& aPath, const char* aInterface,
const BluetoothNamedValue& aValue, const BluetoothNamedValue& aValue,
BluetoothReplyRunnable* aRunnable); BluetoothReplyRunnable* aRunnable);
void DisconnectAllAcls(const nsAString& aAdapterPath);
}; };
END_BLUETOOTH_NAMESPACE END_BLUETOOTH_NAMESPACE

View File

@ -32,6 +32,7 @@ MOCHITEST_FILES = \
test_peerConnection_bug827843.html \ test_peerConnection_bug827843.html \
test_peerConnection_bug825703.html \ test_peerConnection_bug825703.html \
test_peerConnection_bug834153.html \ test_peerConnection_bug834153.html \
test_peerConnection_bug840344.html \
head.js \ head.js \
mediaStreamPlayback.js \ mediaStreamPlayback.js \
pc.js \ pc.js \

View File

@ -0,0 +1,129 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=840344
-->
<head>
<meta charset="utf-8">
<title>Bug 840344: Assertion failure</title>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js">
</script>
<script type="application/javascript" src="head.js"></script>
</meta>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=840344">
Bug 840344</a>
<p id="display"></p>
<pre id="test">
<script class="testbody" type="application/javascript">
runTest(function () {
var answerCount = 0;
var setLocalCount = 0;
// SDP to stand in for an offer coming from a (theoretical) remote endpoint
var offer = { sdp: "v=0\r\n"+
"o=Mozilla-SIPUA 23597 0 IN IP4 0.0.0.0\r\n"+
"s=SIP Call\r\n"+
"t=0 0\r\n"+
"a=ice-ufrag:f5fda439\r\n"+
"a=ice-pwd:d0df8e2904bdbd29587966e797655970\r\n"+
"a=fingerprint:sha-256 DF:69:78:20:8D:2E:08:CE:49:82:A3:11:79:1D:BF:"+
"B5:49:49:2D:32:82:2F:0D:88:84:A7:C6:63:23:63:A9:0F\r\n"+
"m=audio 52757 RTP/SAVPF 109 0 8 101\r\n"+
"c=IN IP4 192.168.129.33\r\n"+
"a=rtpmap:109 opus/48000/2\r\n"+
"a=ptime:20\r\n"+
"a=rtpmap:0 PCMU/8000\r\n"+
"a=rtpmap:8 PCMA/8000\r\n"+
"a=rtpmap:101 telephone-event/8000\r\n"+
"a=fmtp:101 0-15\r\n"+
"a=sendrecv\r\n"+
"a=candidate:0 1 UDP 2113601791 192.168.129.33 52757 typ host\r\n"+
"a=candidate:0 2 UDP 2113601790 192.168.129.33 59738 typ host\r\n"+
"m=video 63901 RTP/SAVPF 120\r\n"+
"c=IN IP4 192.168.129.33\r\n"+
"a=rtpmap:120 VP8/90000\r\n"+
"a=sendrecv\r\n"+
"a=candidate:0 1 UDP 2113601791 192.168.129.33 63901 typ host\r\n"+
"a=candidate:0 2 UDP 2113601790 192.168.129.33 54165 typ host\r\n"+
"m=application 65080 SCTP/DTLS 5000 \r\n"+
"c=IN IP4 192.168.129.33\r\n"+
"a=fmtp:5000 protocol=webrtc-datachannel;streams=16\r\n"+
"a=sendrecv\r\n"+
"a=candidate:0 1 UDP 2113601791 192.168.129.33 65080 typ host\r\n"+
"a=candidate:0 2 UDP 2113601790 192.168.129.33 62658 typ host\r\n",
type: "offer" };
info("Step 0: Instantiate a Peer Connection");
var pc = new mozRTCPeerConnection();
// First: Kick off the chain of events by asking for a mic and camera
var start = function() {
info("Step 1: Get User Media for Audio and Video");
getUserMedia({audio:true, video:true},
gumSuccess, unexpectedCallbackAndFinish);
};
// Second: set the remote description
var gumSuccess = function(x) {
info("Step 2a: Add stream");
pc.addStream(x);
info("Step 2b: Create Session Description");
var osd = new mozRTCSessionDescription(offer);
info("Step 2c: Set Remote Description");
pc.setRemoteDescription(osd,
setRemoteSuccess,
unexpectedCallbackAndFinish);
};
// Third: Attempt to create an answer. Twice.
var setRemoteSuccess = function() {
info("Step 3a: Create answer #1");
pc.createAnswer(answerSuccess, unexpectedCallbackAndFinish);
info("Step 3b: Create answer #2");
pc.createAnswer(answerSuccess, unexpectedCallbackAndFinish);
};
// Fourth: Count the answers and push them into the local description
var answerSuccess = function(answer) {
answerCount++;
ok (answerCount < 3, "Answer count is less than three.")
info("got answer #" + answerCount);
is(answer.type,'answer',"Answer is of type 'answer'");
ok(answer.sdp.length > 10, "Answer has length " + answer.sdp.length);
info("Step 4: Set local description");
pc.setLocalDescription(answer,
setLocalSuccess,
unexpectedCallbackAndFinish);
};
// Fifth: Once we have two successful rounds through here, we're done.
var setLocalSuccess = function(x) {
setLocalCount++;
info("Set local description #" + setLocalCount);
// Then shalt thou count to two, no more, no less. Two shall be the
// number thou shalt count, and the number of the counting shall be
// two. Three shalt thou not count, neither count thou one, excepting
// that thou then proceed to two. Four is right out. Once the number two,
// being the second number, be reached, then thou shalt declare success.
ok (setLocalCount < 3, "Set local count is less than three.")
if (setLocalCount === 2) {
is (answerCount, 2, "Answer count is 2.")
info("Step 5: Finished");
SimpleTest.finish();
}
};
start();
}, true);
</script>
</pre>
</body>
</html>

View File

@ -39,7 +39,7 @@ function test() {
let sandbox = new Cu.Sandbox(workerWindow); let sandbox = new Cu.Sandbox(workerWindow);
// inject some functions from the window into the sandbox. // inject some functions from the window into the sandbox.
// postMessage so the async code in the sandbox can report a result. // postMessage so the async code in the sandbox can report a result.
sandbox.importFunction(workerWindow.postMessage, "postMessage"); sandbox.importFunction(workerWindow.postMessage.bind(workerWindow), "postMessage");
sandbox.importFunction(workerWindow.XMLHttpRequest, "XMLHttpRequest"); sandbox.importFunction(workerWindow.XMLHttpRequest, "XMLHttpRequest");
Cu.evalInSandbox(sandboxCode, sandbox, "1.8"); Cu.evalInSandbox(sandboxCode, sandbox, "1.8");
}, true); }, true);

View File

@ -0,0 +1,22 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
* http://www.whatwg.org/html/#mediaerror
*
* © Copyright 2004-2011 Apple Computer, Inc., Mozilla Foundation, and
* Opera Software ASA. You are granted a license to use, reproduce
* and create derivative works of this document.
*/
interface MediaError {
const unsigned short MEDIA_ERR_ABORTED = 1;
const unsigned short MEDIA_ERR_NETWORK = 2;
const unsigned short MEDIA_ERR_DECODE = 3;
const unsigned short MEDIA_ERR_SRC_NOT_SUPPORTED = 4;
[Constant]
readonly attribute unsigned short code;
};

View File

@ -223,6 +223,7 @@ endif
ifdef MOZ_MEDIA ifdef MOZ_MEDIA
webidl_files += \ webidl_files += \
HTMLSourceElement.webidl \ HTMLSourceElement.webidl \
MediaError.webidl \
$(NULL) $(NULL)
endif endif

View File

@ -72,7 +72,6 @@
#include "nsIEditActionListener.h" // for nsIEditActionListener #include "nsIEditActionListener.h" // for nsIEditActionListener
#include "nsIEditorObserver.h" // for nsIEditorObserver #include "nsIEditorObserver.h" // for nsIEditorObserver
#include "nsIEditorSpellCheck.h" // for nsIEditorSpellCheck #include "nsIEditorSpellCheck.h" // for nsIEditorSpellCheck
#include "nsIEnumerator.h" // for nsIEnumerator, etc
#include "nsIFrame.h" // for nsIFrame #include "nsIFrame.h" // for nsIFrame
#include "nsIInlineSpellChecker.h" // for nsIInlineSpellChecker, etc #include "nsIInlineSpellChecker.h" // for nsIInlineSpellChecker, etc
#include "nsIMEStateManager.h" // for nsIMEStateManager #include "nsIMEStateManager.h" // for nsIMEStateManager
@ -3892,21 +3891,13 @@ nsEditor::GetStartNodeAndOffset(nsISelection *aSelection,
*outStartNode = nullptr; *outStartNode = nullptr;
*outStartOffset = 0; *outStartOffset = 0;
nsCOMPtr<nsISelectionPrivate>selPrivate(do_QueryInterface(aSelection)); Selection* selection = static_cast<Selection*>(aSelection);
nsCOMPtr<nsIEnumerator> enumerator; NS_ENSURE_TRUE(selection->GetRangeCount(), NS_ERROR_FAILURE);
nsresult result = selPrivate->GetEnumerator(getter_AddRefs(enumerator));
NS_ENSURE_SUCCESS(result, result);
NS_ENSURE_TRUE(enumerator, NS_ERROR_FAILURE);
enumerator->First(); nsRange* range = selection->GetRangeAt(0);
nsCOMPtr<nsISupports> currentItem;
result = enumerator->CurrentItem(getter_AddRefs(currentItem));
NS_ENSURE_SUCCESS(result, result);
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
NS_ENSURE_TRUE(range, NS_ERROR_FAILURE); NS_ENSURE_TRUE(range, NS_ERROR_FAILURE);
result = range->GetStartContainer(outStartNode); nsresult result = range->GetStartContainer(outStartNode);
NS_ENSURE_SUCCESS(result, result); NS_ENSURE_SUCCESS(result, result);
result = range->GetStartOffset(outStartOffset); result = range->GetStartOffset(outStartOffset);
@ -3928,18 +3919,11 @@ nsEditor::GetEndNodeAndOffset(nsISelection *aSelection,
*outEndNode = nullptr; *outEndNode = nullptr;
nsCOMPtr<nsISelectionPrivate>selPrivate(do_QueryInterface(aSelection)); Selection* selection = static_cast<Selection*>(aSelection);
nsCOMPtr<nsIEnumerator> enumerator; NS_ENSURE_TRUE(selection, NS_ERROR_FAILURE);
nsresult result = selPrivate->GetEnumerator(getter_AddRefs(enumerator)); NS_ENSURE_TRUE(selection->GetRangeCount(), NS_ERROR_FAILURE);
if (NS_FAILED(result) || !enumerator)
return NS_ERROR_FAILURE;
enumerator->First();
nsCOMPtr<nsISupports> currentItem;
if (NS_FAILED(enumerator->CurrentItem(getter_AddRefs(currentItem))))
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) ); nsRange* range = selection->GetRangeAt(0);
NS_ENSURE_TRUE(range, NS_ERROR_FAILURE); NS_ENSURE_TRUE(range, NS_ERROR_FAILURE);
if (NS_FAILED(range->GetEndContainer(outEndNode))) if (NS_FAILED(range->GetEndContainer(outEndNode)))

View File

@ -38,7 +38,6 @@
#include "nsIDOMNode.h" #include "nsIDOMNode.h"
#include "nsIDOMRange.h" #include "nsIDOMRange.h"
#include "nsIDOMText.h" #include "nsIDOMText.h"
#include "nsIEnumerator.h"
#include "nsIHTMLAbsPosEditor.h" #include "nsIHTMLAbsPosEditor.h"
#include "nsIHTMLDocument.h" #include "nsIHTMLDocument.h"
#include "nsINode.h" #include "nsINode.h"
@ -2306,22 +2305,13 @@ nsHTMLEditRules::WillDeleteSelection(Selection* aSelection,
// else blocks not same type, or not siblings. Delete everything except // else blocks not same type, or not siblings. Delete everything except
// table elements. // table elements.
nsCOMPtr<nsIEnumerator> enumerator;
res = aSelection->GetEnumerator(getter_AddRefs(enumerator));
NS_ENSURE_SUCCESS(res, res);
NS_ENSURE_TRUE(enumerator, NS_ERROR_UNEXPECTED);
join = true; join = true;
for (enumerator->First(); NS_OK!=enumerator->IsDone(); enumerator->Next()) uint32_t rangeCount = aSelection->GetRangeCount();
{ for (uint32_t rangeIdx = 0; rangeIdx < rangeCount; ++rangeIdx) {
nsCOMPtr<nsISupports> currentItem; nsRefPtr<nsRange> range = aSelection->GetRangeAt(rangeIdx);
res = enumerator->CurrentItem(getter_AddRefs(currentItem));
NS_ENSURE_SUCCESS(res, res);
NS_ENSURE_TRUE(currentItem, NS_ERROR_UNEXPECTED);
// build a list of nodes in the range // build a list of nodes in the range
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
nsCOMArray<nsIDOMNode> arrayOfNodes; nsCOMArray<nsIDOMNode> arrayOfNodes;
nsTrivialFunctor functor; nsTrivialFunctor functor;
nsDOMSubtreeIterator iter; nsDOMSubtreeIterator iter;
@ -5776,25 +5766,15 @@ nsHTMLEditRules::GetListActionNodes(nsCOMArray<nsIDOMNode> &outArrayOfNodes,
nsCOMPtr<nsISelection>selection; nsCOMPtr<nsISelection>selection;
res = mHTMLEditor->GetSelection(getter_AddRefs(selection)); res = mHTMLEditor->GetSelection(getter_AddRefs(selection));
NS_ENSURE_SUCCESS(res, res); NS_ENSURE_SUCCESS(res, res);
nsCOMPtr<nsISelectionPrivate> selPriv(do_QueryInterface(selection)); Selection* sel = static_cast<Selection*>(selection.get());
NS_ENSURE_TRUE(selPriv, NS_ERROR_FAILURE); NS_ENSURE_TRUE(sel, NS_ERROR_FAILURE);
// added this in so that ui code can ask to change an entire list, even if selection // added this in so that ui code can ask to change an entire list, even if selection
// is only in part of it. used by list item dialog. // is only in part of it. used by list item dialog.
if (aEntireList) if (aEntireList)
{ {
nsCOMPtr<nsIEnumerator> enumerator; uint32_t rangeCount = sel->GetRangeCount();
res = selPriv->GetEnumerator(getter_AddRefs(enumerator)); for (uint32_t rangeIdx = 0; rangeIdx < rangeCount; ++rangeIdx) {
NS_ENSURE_SUCCESS(res, res); nsRefPtr<nsRange> range = sel->GetRangeAt(rangeIdx);
NS_ENSURE_TRUE(enumerator, NS_ERROR_UNEXPECTED);
for (enumerator->First(); NS_OK!=enumerator->IsDone(); enumerator->Next())
{
nsCOMPtr<nsISupports> currentItem;
res = enumerator->CurrentItem(getter_AddRefs(currentItem));
NS_ENSURE_SUCCESS(res, res);
NS_ENSURE_TRUE(currentItem, NS_ERROR_UNEXPECTED);
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
nsCOMPtr<nsIDOMNode> commonParent, parent, tmp; nsCOMPtr<nsIDOMNode> commonParent, parent, tmp;
range->GetCommonAncestorContainer(getter_AddRefs(commonParent)); range->GetCommonAncestorContainer(getter_AddRefs(commonParent));
if (commonParent) if (commonParent)
@ -7797,21 +7777,11 @@ nsHTMLEditRules::SelectionEndpointInNode(nsINode* aNode, bool* aResult)
nsCOMPtr<nsISelection>selection; nsCOMPtr<nsISelection>selection;
nsresult res = mHTMLEditor->GetSelection(getter_AddRefs(selection)); nsresult res = mHTMLEditor->GetSelection(getter_AddRefs(selection));
NS_ENSURE_SUCCESS(res, res); NS_ENSURE_SUCCESS(res, res);
nsCOMPtr<nsISelectionPrivate>selPriv(do_QueryInterface(selection));
nsCOMPtr<nsIEnumerator> enumerator; Selection* sel = static_cast<Selection*>(selection.get());
res = selPriv->GetEnumerator(getter_AddRefs(enumerator)); uint32_t rangeCount = sel->GetRangeCount();
NS_ENSURE_SUCCESS(res, res); for (uint32_t rangeIdx = 0; rangeIdx < rangeCount; ++rangeIdx) {
NS_ENSURE_TRUE(enumerator, NS_ERROR_UNEXPECTED); nsRefPtr<nsRange> range = sel->GetRangeAt(rangeIdx);
for (enumerator->First(); NS_OK!=enumerator->IsDone(); enumerator->Next())
{
nsCOMPtr<nsISupports> currentItem;
res = enumerator->CurrentItem(getter_AddRefs(currentItem));
NS_ENSURE_SUCCESS(res, res);
NS_ENSURE_TRUE(currentItem, NS_ERROR_UNEXPECTED);
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
nsCOMPtr<nsIDOMNode> startParent, endParent; nsCOMPtr<nsIDOMNode> startParent, endParent;
range->GetStartContainer(getter_AddRefs(startParent)); range->GetStartContainer(getter_AddRefs(startParent));
if (startParent) if (startParent)

View File

@ -37,7 +37,6 @@
#include "nsCSSStyleSheet.h" #include "nsCSSStyleSheet.h"
#include "nsIDOMStyleSheet.h" #include "nsIDOMStyleSheet.h"
#include "nsIEnumerator.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsIContentIterator.h" #include "nsIContentIterator.h"
#include "nsIDOMRange.h" #include "nsIDOMRange.h"
@ -2388,7 +2387,7 @@ nsHTMLEditor::GetSelectedElement(const nsAString& aTagName, nsIDOMElement** aRet
nsresult res = GetSelection(getter_AddRefs(selection)); nsresult res = GetSelection(getter_AddRefs(selection));
NS_ENSURE_SUCCESS(res, res); NS_ENSURE_SUCCESS(res, res);
NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER); NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
nsCOMPtr<nsISelectionPrivate> selPriv(do_QueryInterface(selection)); Selection* sel = static_cast<Selection*>(selection.get());
bool bNodeFound = false; bool bNodeFound = false;
bool isCollapsed = selection->Collapsed(); bool isCollapsed = selection->Collapsed();
@ -2453,7 +2452,7 @@ nsHTMLEditor::GetSelectedElement(const nsAString& aTagName, nsIDOMElement** aRet
int32_t anchorOffset = -1; int32_t anchorOffset = -1;
if (anchorNode) if (anchorNode)
selection->GetAnchorOffset(&anchorOffset); selection->GetAnchorOffset(&anchorOffset);
nsCOMPtr<nsIDOMNode> focusNode; nsCOMPtr<nsIDOMNode> focusNode;
res = selection->GetFocusNode(getter_AddRefs(focusNode)); res = selection->GetFocusNode(getter_AddRefs(focusNode));
NS_ENSURE_SUCCESS(res, res); NS_ENSURE_SUCCESS(res, res);
@ -2464,19 +2463,6 @@ nsHTMLEditor::GetSelectedElement(const nsAString& aTagName, nsIDOMElement** aRet
// Link node must be the same for both ends of selection // Link node must be the same for both ends of selection
if (NS_SUCCEEDED(res) && anchorNode) if (NS_SUCCEEDED(res) && anchorNode)
{ {
#ifdef DEBUG_cmanske
{
nsAutoString name;
anchorNode->GetNodeName(name);
printf("GetSelectedElement: Anchor node of selection: ");
wprintf(name.get());
printf(" Offset: %d\n", anchorOffset);
focusNode->GetNodeName(name);
printf("Focus node of selection: ");
wprintf(name.get());
printf(" Offset: %d\n", focusOffset);
}
#endif
nsCOMPtr<nsIDOMElement> parentLinkOfAnchor; nsCOMPtr<nsIDOMElement> parentLinkOfAnchor;
res = GetElementOrParentByTagName(NS_LITERAL_STRING("href"), anchorNode, getter_AddRefs(parentLinkOfAnchor)); res = GetElementOrParentByTagName(NS_LITERAL_STRING("href"), anchorNode, getter_AddRefs(parentLinkOfAnchor));
// XXX: ERROR_HANDLING can parentLinkOfAnchor be null? // XXX: ERROR_HANDLING can parentLinkOfAnchor be null?
@ -2493,7 +2479,7 @@ nsHTMLEditor::GetSelectedElement(const nsAString& aTagName, nsIDOMElement** aRet
if (NS_SUCCEEDED(res) && parentLinkOfFocus == parentLinkOfAnchor) if (NS_SUCCEEDED(res) && parentLinkOfFocus == parentLinkOfAnchor)
bNodeFound = true; bNodeFound = true;
} }
// We found a link node parent // We found a link node parent
if (bNodeFound) { if (bNodeFound) {
// GetElementOrParentByTagName addref'd this, so we don't need to do it here // GetElementOrParentByTagName addref'd this, so we don't need to do it here
@ -2518,77 +2504,63 @@ nsHTMLEditor::GetSelectedElement(const nsAString& aTagName, nsIDOMElement** aRet
if (!isCollapsed) // Don't bother to examine selection if it is collapsed if (!isCollapsed) // Don't bother to examine selection if it is collapsed
{ {
nsCOMPtr<nsIEnumerator> enumerator; nsRefPtr<nsRange> currange = sel->GetRangeAt(0);
res = selPriv->GetEnumerator(getter_AddRefs(enumerator)); if (currange) {
if (NS_SUCCEEDED(res)) nsCOMPtr<nsIContentIterator> iter =
{ do_CreateInstance("@mozilla.org/content/post-content-iterator;1", &res);
if(!enumerator) NS_ENSURE_SUCCESS(res, res);
return NS_ERROR_NULL_POINTER;
enumerator->First(); iter->Init(currange);
nsCOMPtr<nsISupports> currentItem; // loop through the content iterator for each content node
res = enumerator->CurrentItem(getter_AddRefs(currentItem)); while (!iter->IsDone())
if ((NS_SUCCEEDED(res)) && currentItem)
{ {
nsCOMPtr<nsIDOMRange> currange( do_QueryInterface(currentItem) ); // Query interface to cast nsIContent to nsIDOMNode
nsCOMPtr<nsIContentIterator> iter = // then get tagType to compare to aTagName
do_CreateInstance("@mozilla.org/content/post-content-iterator;1", &res); // Clone node of each desired type and append it to the aDomFrag
NS_ENSURE_SUCCESS(res, res); selectedElement = do_QueryInterface(iter->GetCurrentNode());
if (selectedElement)
iter->Init(currange);
// loop through the content iterator for each content node
while (!iter->IsDone())
{ {
// Query interface to cast nsIContent to nsIDOMNode // If we already found a node, then we have another element,
// then get tagType to compare to aTagName // thus there's not just one element selected
// Clone node of each desired type and append it to the aDomFrag if (bNodeFound)
selectedElement = do_QueryInterface(iter->GetCurrentNode());
if (selectedElement)
{ {
// If we already found a node, then we have another element, bNodeFound = false;
// thus there's not just one element selected break;
if (bNodeFound) }
{
bNodeFound = false; selectedElement->GetNodeName(domTagName);
break; ToLowerCase(domTagName);
}
if (anyTag)
selectedElement->GetNodeName(domTagName); {
ToLowerCase(domTagName); // Get name of first selected element
selectedElement->GetTagName(TagName);
if (anyTag) ToLowerCase(TagName);
{ anyTag = false;
// Get name of first selected element }
selectedElement->GetTagName(TagName);
ToLowerCase(TagName); // The "A" tag is a pain,
anyTag = false; // used for both link(href is set) and "Named Anchor"
} nsCOMPtr<nsIDOMNode> selectedNode = do_QueryInterface(selectedElement);
if ( (isLinkTag && nsHTMLEditUtils::IsLink(selectedNode)) ||
// The "A" tag is a pain, (isNamedAnchorTag && nsHTMLEditUtils::IsNamedAnchor(selectedNode)) )
// used for both link(href is set) and "Named Anchor" {
nsCOMPtr<nsIDOMNode> selectedNode = do_QueryInterface(selectedElement); bNodeFound = true;
if ( (isLinkTag && nsHTMLEditUtils::IsLink(selectedNode)) || } else if (TagName == domTagName) { // All other tag names are handled here
(isNamedAnchorTag && nsHTMLEditUtils::IsNamedAnchor(selectedNode)) ) bNodeFound = true;
{ }
bNodeFound = true; if (!bNodeFound)
} else if (TagName == domTagName) { // All other tag names are handled here {
bNodeFound = true; // Check if node we have is really part of the selection???
} break;
if (!bNodeFound)
{
// Check if node we have is really part of the selection???
break;
}
} }
iter->Next();
} }
} else { iter->Next();
// Should never get here?
isCollapsed = true;
printf("isCollapsed was FALSE, but no elements found in selection\n");
} }
} else { } else {
printf("Could not create enumerator for GetSelectionProperties\n"); // Should never get here?
isCollapsed = true;
NS_WARNING("isCollapsed was FALSE, but no elements found in selection\n");
} }
} }
} }
@ -4678,23 +4650,13 @@ nsHTMLEditor::SetCSSBackgroundColor(const nsAString& aColor)
NS_ENSURE_SUCCESS(res, res); NS_ENSURE_SUCCESS(res, res);
if (!cancel && !handled) if (!cancel && !handled)
{ {
// get selection range enumerator
nsCOMPtr<nsIEnumerator> enumerator;
res = selection->GetEnumerator(getter_AddRefs(enumerator));
NS_ENSURE_SUCCESS(res, res);
NS_ENSURE_TRUE(enumerator, NS_ERROR_FAILURE);
// loop thru the ranges in the selection // loop thru the ranges in the selection
enumerator->First();
nsCOMPtr<nsISupports> currentItem;
nsAutoString bgcolor; bgcolor.AssignLiteral("bgcolor"); nsAutoString bgcolor; bgcolor.AssignLiteral("bgcolor");
nsCOMPtr<nsIDOMNode> cachedBlockParent = nullptr; uint32_t rangeCount = selection->GetRangeCount();
while (static_cast<nsresult>(NS_ENUMERATOR_FALSE) == enumerator->IsDone()) { for (uint32_t rangeIdx = 0; rangeIdx < rangeCount; ++rangeIdx) {
res = enumerator->CurrentItem(getter_AddRefs(currentItem)); nsCOMPtr<nsIDOMNode> cachedBlockParent = nullptr;
NS_ENSURE_SUCCESS(res, res); nsRefPtr<nsRange> range = selection->GetRangeAt(rangeIdx);
NS_ENSURE_TRUE(currentItem, NS_ERROR_FAILURE); NS_ENSURE_TRUE(range, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
// check for easy case: both range endpoints in same text node // check for easy case: both range endpoints in same text node
nsCOMPtr<nsIDOMNode> startNode, endNode; nsCOMPtr<nsIDOMNode> startNode, endNode;
@ -4854,7 +4816,6 @@ nsHTMLEditor::SetCSSBackgroundColor(const nsAString& aColor)
} }
} }
} }
enumerator->Next();
} }
} }
if (!cancel) if (!cancel)

View File

@ -33,7 +33,6 @@
#include "nsIDOMRange.h" #include "nsIDOMRange.h"
#include "nsIEditor.h" #include "nsIEditor.h"
#include "nsIEditorIMESupport.h" #include "nsIEditorIMESupport.h"
#include "nsIEnumerator.h"
#include "nsINameSpaceManager.h" #include "nsINameSpaceManager.h"
#include "nsINode.h" #include "nsINode.h"
#include "nsISelection.h" #include "nsISelection.h"
@ -144,22 +143,10 @@ nsHTMLEditor::SetInlineProperty(nsIAtom *aProperty,
nsresult res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled); nsresult res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
NS_ENSURE_SUCCESS(res, res); NS_ENSURE_SUCCESS(res, res);
if (!cancel && !handled) { if (!cancel && !handled) {
// get selection range enumerator
nsCOMPtr<nsIEnumerator> enumerator;
res = selection->GetEnumerator(getter_AddRefs(enumerator));
NS_ENSURE_SUCCESS(res, res);
NS_ENSURE_TRUE(enumerator, NS_ERROR_FAILURE);
// loop thru the ranges in the selection // loop thru the ranges in the selection
nsCOMPtr<nsISupports> currentItem; uint32_t rangeCount = selection->GetRangeCount();
for (enumerator->First(); for (uint32_t rangeIdx = 0; rangeIdx < rangeCount; ++rangeIdx) {
static_cast<nsresult>(NS_ENUMERATOR_FALSE) == enumerator->IsDone(); nsRefPtr<nsRange> range = selection->GetRangeAt(rangeIdx);
enumerator->Next()) {
res = enumerator->CurrentItem(getter_AddRefs(currentItem));
NS_ENSURE_SUCCESS(res, res);
NS_ENSURE_TRUE(currentItem, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMRange> range(do_QueryInterface(currentItem));
// adjust range to include any ancestors whose children are entirely // adjust range to include any ancestors whose children are entirely
// selected // selected
@ -1115,23 +1102,15 @@ nsHTMLEditor::GetInlinePropertyBase(nsIAtom *aProperty,
result = GetSelection(getter_AddRefs(selection)); result = GetSelection(getter_AddRefs(selection));
NS_ENSURE_SUCCESS(result, result); NS_ENSURE_SUCCESS(result, result);
NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER); NS_ENSURE_TRUE(selection, NS_ERROR_NULL_POINTER);
nsCOMPtr<nsISelectionPrivate> selPriv(do_QueryInterface(selection)); Selection* sel = static_cast<Selection*>(selection.get());
bool isCollapsed = selection->Collapsed(); bool isCollapsed = selection->Collapsed();
nsCOMPtr<nsIDOMNode> collapsedNode; nsCOMPtr<nsIDOMNode> collapsedNode;
nsCOMPtr<nsIEnumerator> enumerator; nsRefPtr<nsRange> range = sel->GetRangeAt(0);
result = selPriv->GetEnumerator(getter_AddRefs(enumerator));
NS_ENSURE_SUCCESS(result, result);
NS_ENSURE_TRUE(enumerator, NS_ERROR_NULL_POINTER);
enumerator->First();
nsCOMPtr<nsISupports> currentItem;
result = enumerator->CurrentItem(getter_AddRefs(currentItem));
// XXX: should be a while loop, to get each separate range // XXX: should be a while loop, to get each separate range
// XXX: ERROR_HANDLING can currentItem be null? // XXX: ERROR_HANDLING can currentItem be null?
if (NS_SUCCEEDED(result) && currentItem) { if (range) {
bool firstNodeInRange = true; // for each range, set a flag bool firstNodeInRange = true; // for each range, set a flag
nsCOMPtr<nsIDOMRange> range(do_QueryInterface(currentItem));
if (isCollapsed) { if (isCollapsed) {
range->GetStartContainer(getter_AddRefs(collapsedNode)); range->GetStartContainer(getter_AddRefs(collapsedNode));
@ -1379,22 +1358,10 @@ nsresult nsHTMLEditor::RemoveInlinePropertyImpl(nsIAtom *aProperty, const nsAStr
NS_ENSURE_SUCCESS(res, res); NS_ENSURE_SUCCESS(res, res);
if (!cancel && !handled) if (!cancel && !handled)
{ {
// get selection range enumerator
nsCOMPtr<nsIEnumerator> enumerator;
res = selection->GetEnumerator(getter_AddRefs(enumerator));
NS_ENSURE_SUCCESS(res, res);
NS_ENSURE_TRUE(enumerator, NS_ERROR_FAILURE);
// loop thru the ranges in the selection // loop thru the ranges in the selection
enumerator->First(); uint32_t rangeCount = selection->GetRangeCount();
nsCOMPtr<nsISupports> currentItem; for (uint32_t rangeIdx = 0; rangeIdx < rangeCount; ++rangeIdx) {
while (static_cast<nsresult>(NS_ENUMERATOR_FALSE) == enumerator->IsDone()) { nsRefPtr<nsRange> range = selection->GetRangeAt(rangeIdx);
res = enumerator->CurrentItem(getter_AddRefs(currentItem));
NS_ENSURE_SUCCESS(res, res);
NS_ENSURE_TRUE(currentItem, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
if (aProperty == nsEditProperty::name) if (aProperty == nsEditProperty::name)
{ {
// promote range if it starts or end in a named anchor and we // promote range if it starts or end in a named anchor and we
@ -1500,7 +1467,6 @@ nsresult nsHTMLEditor::RemoveInlinePropertyImpl(nsIAtom *aProperty, const nsAStr
} }
arrayOfNodes.Clear(); arrayOfNodes.Clear();
} }
enumerator->Next();
} }
} }
if (!cancel) if (!cancel)
@ -1566,24 +1532,13 @@ nsHTMLEditor::RelativeFontChange( int32_t aSizeChange)
nsAutoSelectionReset selectionResetter(selection, this); nsAutoSelectionReset selectionResetter(selection, this);
nsAutoTxnsConserveSelection dontSpazMySelection(this); nsAutoTxnsConserveSelection dontSpazMySelection(this);
// get selection range enumerator
nsCOMPtr<nsIEnumerator> enumerator;
nsresult res = selection->GetEnumerator(getter_AddRefs(enumerator));
NS_ENSURE_SUCCESS(res, res);
NS_ENSURE_TRUE(enumerator, NS_ERROR_FAILURE);
// loop thru the ranges in the selection // loop thru the ranges in the selection
enumerator->First(); uint32_t rangeCount = selection->GetRangeCount();
nsCOMPtr<nsISupports> currentItem; for (uint32_t rangeIdx = 0; rangeIdx < rangeCount; ++rangeIdx) {
while (static_cast<nsresult>(NS_ENUMERATOR_FALSE) == enumerator->IsDone()) { nsRefPtr<nsRange> range = selection->GetRangeAt(rangeIdx);
res = enumerator->CurrentItem(getter_AddRefs(currentItem));
NS_ENSURE_SUCCESS(res, res);
NS_ENSURE_TRUE(currentItem, NS_ERROR_FAILURE);
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
// adjust range to include any ancestors who's children are entirely selected // adjust range to include any ancestors who's children are entirely selected
res = PromoteInlineRange(range); nsresult res = PromoteInlineRange(range);
NS_ENSURE_SUCCESS(res, res); NS_ENSURE_SUCCESS(res, res);
// check for easy case: both range endpoints in same text node // check for easy case: both range endpoints in same text node
@ -1665,10 +1620,9 @@ nsHTMLEditor::RelativeFontChange( int32_t aSizeChange)
NS_ENSURE_SUCCESS(res, res); NS_ENSURE_SUCCESS(res, res);
} }
} }
enumerator->Next();
} }
return res; return NS_OK;
} }
nsresult nsresult

View File

@ -76,10 +76,6 @@ include $(topsrcdir)/config/rules.mk
# #
ifndef GNU_CC ifndef GNU_CC
LDFLAGS += /HEAP:0x40000 LDFLAGS += /HEAP:0x40000
ifeq ($(OS_TEST),x86_64)
# set stack to 2MB on x64 build. See bug 582910
LDFLAGS += -STACK:2097152
endif
endif endif
# Get rid of console window # Get rid of console window

View File

@ -77,10 +77,6 @@ ifeq ($(OS_ARCH),WINNT) #{
# #
ifndef GNU_CC #{ ifndef GNU_CC #{
LDFLAGS += /HEAP:0x40000 LDFLAGS += /HEAP:0x40000
ifeq ($(OS_TEST),x86_64) #{
# set stack to 2MB on x64 build. See bug 582910
LDFLAGS += -STACK:2097152
endif #}
endif #} endif #}
endif #} endif #}

View File

@ -510,7 +510,7 @@ public:
void store8(RegisterID src, ImplicitAddress address) void store8(RegisterID src, ImplicitAddress address)
{ {
m_assembler.dataTransferN(false, false, 16, src, address.base, address.offset); m_assembler.dataTransferN(false, false, 8, src, address.base, address.offset);
} }
void store8(RegisterID src, BaseIndex address) void store8(RegisterID src, BaseIndex address)
@ -1157,25 +1157,26 @@ public:
void loadFloat(ImplicitAddress address, FPRegisterID dest) void loadFloat(ImplicitAddress address, FPRegisterID dest)
{ {
// as long as this is a sane mapping, (*2) should just work
dest = (FPRegisterID) (dest * 2);
ASSERT((address.offset & 0x3) == 0); ASSERT((address.offset & 0x3) == 0);
m_assembler.floatTransfer(true, dest, address.base, address.offset); // as long as this is a sane mapping, (*2) should just work
m_assembler.vcvt(m_assembler.FloatReg32, m_assembler.FloatReg64, (FPRegisterID)(dest*2), dest); m_assembler.floatTransfer(true, floatShadow(dest), address.base, address.offset);
m_assembler.vcvt(m_assembler.FloatReg32, m_assembler.FloatReg64, floatShadow(dest), dest);
} }
void loadFloat(BaseIndex address, FPRegisterID dest) void loadFloat(BaseIndex address, FPRegisterID dest)
{ {
m_assembler.baseIndexFloatTransfer(true, false, (FPRegisterID)(dest*2), FPRegisterID dest_s = floatShadow(dest);
m_assembler.baseIndexFloatTransfer(true, false, dest_s,
address.base, address.index, address.base, address.index,
address.scale, address.offset); address.scale, address.offset);
m_assembler.vcvt(m_assembler.FloatReg32, m_assembler.FloatReg64, (FPRegisterID)(dest*2), dest); m_assembler.vcvt(m_assembler.FloatReg32, m_assembler.FloatReg64, dest_s, dest);
} }
DataLabelPtr loadFloat(const void* address, FPRegisterID dest) DataLabelPtr loadFloat(const void* address, FPRegisterID dest)
{ {
FPRegisterID dest_s = floatShadow(dest);
DataLabelPtr label = moveWithPatch(ImmPtr(address), ARMRegisters::S0); DataLabelPtr label = moveWithPatch(ImmPtr(address), ARMRegisters::S0);
m_assembler.fmem_imm_off(true, false, true, (FPRegisterID)(dest*2), ARMRegisters::S0, 0); m_assembler.fmem_imm_off(true, false, true, dest_s, ARMRegisters::S0, 0);
m_assembler.vcvt(m_assembler.FloatReg32, m_assembler.FloatReg64, (FPRegisterID)(dest*2), dest); m_assembler.vcvt(m_assembler.FloatReg32, m_assembler.FloatReg64, dest_s, dest);
return label; return label;
} }
@ -1208,14 +1209,16 @@ public:
m_assembler.vmov64(true, true, lo, hi, fpReg); m_assembler.vmov64(true, true, lo, hi, fpReg);
} }
// the StoreFloat functions take an FPRegisterID that is really of the corresponding Double register.
// but the double has already been converted into a float
void storeFloat(FPRegisterID src, ImplicitAddress address) void storeFloat(FPRegisterID src, ImplicitAddress address)
{ {
m_assembler.floatTransfer(false, src, address.base, address.offset); m_assembler.floatTransfer(false, floatShadow(src), address.base, address.offset);
} }
void storeFloat(FPRegisterID src, BaseIndex address) void storeFloat(FPRegisterID src, BaseIndex address)
{ {
m_assembler.baseIndexFloatTransfer(false, false, src, m_assembler.baseIndexFloatTransfer(false, false, floatShadow(src),
address.base, address.index, address.base, address.index,
address.scale, address.offset); address.scale, address.offset);
} }
@ -1329,7 +1332,7 @@ public:
void convertDoubleToFloat(FPRegisterID src, FPRegisterID dest) void convertDoubleToFloat(FPRegisterID src, FPRegisterID dest)
{ {
m_assembler.vcvt(m_assembler.FloatReg64, m_assembler.FloatReg32, src, dest); m_assembler.vcvt(m_assembler.FloatReg64, m_assembler.FloatReg32, src, floatShadow(dest));
} }
Jump branchDouble(DoubleCondition cond, FPRegisterID left, FPRegisterID right) Jump branchDouble(DoubleCondition cond, FPRegisterID left, FPRegisterID right)

View File

@ -56,13 +56,13 @@ fi
CLANG_CC= CLANG_CC=
CLANG_CXX= CLANG_CXX=
if test "$GCC" = yes; then if test "$GCC" = yes; then
if test "`$CC -v 2>&1 | grep -c 'clang version'`" != "0"; then if test "`$CC -v 2>&1 | grep -c 'clang version\|Apple.*clang'`" != "0"; then
CLANG_CC=1 CLANG_CC=1
fi fi
fi fi
if test "$GXX" = yes; then if test "$GXX" = yes; then
if test "`$CXX -v 2>&1 | grep -c 'clang version'`" != "0"; then if test "`$CXX -v 2>&1 | grep -c 'clang version\|Apple.*clang'`" != "0"; then
CLANG_CXX=1 CLANG_CXX=1
fi fi
fi fi

View File

@ -589,6 +589,13 @@ endif
endif endif
endif endif
ifdef _MSC_VER
ifeq ($(CPU_ARCH),x86_64)
# set stack to 2MB on x64 build. See bug 582910
WIN32_EXE_LDFLAGS += -STACK:2097152
endif
endif
# If we're building a component on MSVC, we don't want to generate an # If we're building a component on MSVC, we don't want to generate an
# import lib, because that import lib will collide with the name of a # import lib, because that import lib will collide with the name of a
# static version of the same library. # static version of the same library.

View File

@ -267,6 +267,14 @@ class SectionFinder(object):
syms.append((tmp[-1], tmp[0])) syms.append((tmp[-1], tmp[0]))
return syms return syms
def print_command(out, args):
print >>out, "Executing: " + " ".join(args)
for tmp in [f for f in args.tmp if os.path.isfile(f)]:
print >>out, tmp + ":"
with open(tmp) as file:
print >>out, "".join([" " + l for l in file.readlines()])
out.flush()
def main(): def main():
parser = OptionParser() parser = OptionParser()
parser.add_option("--depend", dest="depend", metavar="FILE", parser.add_option("--depend", dest="depend", metavar="FILE",
@ -302,15 +310,15 @@ def main():
args.makelist() args.makelist()
if options.verbose: if options.verbose:
print >>sys.stderr, "Executing: " + " ".join(args) print_command(sys.stderr, args)
for tmp in [f for f in args.tmp if os.path.isfile(f)]: proc = subprocess.Popen(args, stdout = subprocess.PIPE, stderr = subprocess.STDOUT)
print >>sys.stderr, tmp + ":" (stdout, stderr) = proc.communicate()
with open(tmp) as file: if proc.returncode and not options.verbose:
print >>sys.stderr, "".join([" " + l for l in file.readlines()]) print_command(sys.stderr, args)
sys.stderr.flush() sys.stderr.write(stdout)
ret = subprocess.call(args) sys.stderr.flush()
if ret: if proc.returncode:
exit(ret) exit(proc.returncode)
if not options.depend: if not options.depend:
return return
ensureParentDir(options.depend) ensureParentDir(options.depend)

View File

@ -2091,7 +2091,7 @@ arm*-*)
ENABLE_ION=1 ENABLE_ION=1
ENABLE_MONOIC=1 ENABLE_MONOIC=1
ENABLE_POLYIC=1 ENABLE_POLYIC=1
ENABLE_POLYIC_TYPED_ARRAY=1 ENABLE_METHODJIT_TYPED_ARRAY=1
AC_DEFINE(JS_CPU_ARM) AC_DEFINE(JS_CPU_ARM)
AC_DEFINE(JS_NUNBOX32) AC_DEFINE(JS_NUNBOX32)
;; ;;

View File

@ -494,7 +494,7 @@ ion::RecompileForInlining()
return BAILOUT_RETURN_FATAL_ERROR; return BAILOUT_RETURN_FATAL_ERROR;
// Invalidation should not reset the use count. // Invalidation should not reset the use count.
JS_ASSERT(script->getUseCount() >= js_IonOptions.usesBeforeInlining); JS_ASSERT(script->getUseCount() >= js_IonOptions.usesBeforeInlining());
return true; return true;
} }

View File

@ -99,10 +99,10 @@ struct IonOptions
uint32_t usesBeforeCompileNoJaeger; uint32_t usesBeforeCompileNoJaeger;
// How many invocations or loop iterations are needed before calls // How many invocations or loop iterations are needed before calls
// are inlined. // are inlined, as a fraction of usesBeforeCompile.
// //
// Default: 10,240 // Default: .125
uint32_t usesBeforeInlining; double usesBeforeInliningFactor;
// How many actual arguments are accepted on the C stack. // How many actual arguments are accepted on the C stack.
// //
@ -133,15 +133,6 @@ struct IonOptions
// Default: 100 // Default: 100
uint32_t smallFunctionMaxBytecodeLength; uint32_t smallFunctionMaxBytecodeLength;
// The inlining limit for small functions.
//
// This value has been arrived at empirically via benchmarking.
// We may want to revisit this tuning after other optimizations have
// gone in.
//
// Default: usesBeforeInlining / 4
uint32_t smallFunctionUsesBeforeInlining;
// The maximum number of functions to polymorphically inline at a call site. // The maximum number of functions to polymorphically inline at a call site.
// //
// Default: 4 // Default: 4
@ -149,7 +140,7 @@ struct IonOptions
// The maximum total bytecode size of an inline call site. // The maximum total bytecode size of an inline call site.
// //
// Default: 800 // Default: 1000
uint32_t inlineMaxTotalBytecodeLength; uint32_t inlineMaxTotalBytecodeLength;
// Minimal ratio between the use counts of the caller and the callee to // Minimal ratio between the use counts of the caller and the callee to
@ -184,10 +175,6 @@ struct IonOptions
eagerCompilation = true; eagerCompilation = true;
usesBeforeCompile = usesBeforeCompileNoJaeger = 0; usesBeforeCompile = usesBeforeCompileNoJaeger = 0;
// Eagerly inline calls to improve test coverage.
usesBeforeInlining = 0;
smallFunctionUsesBeforeInlining = 0;
parallelCompilation = false; parallelCompilation = false;
} }
@ -205,14 +192,13 @@ struct IonOptions
parallelCompilation(false), parallelCompilation(false),
usesBeforeCompile(10240), usesBeforeCompile(10240),
usesBeforeCompileNoJaeger(40), usesBeforeCompileNoJaeger(40),
usesBeforeInlining(usesBeforeCompile), usesBeforeInliningFactor(.125),
maxStackArgs(4096), maxStackArgs(4096),
maxInlineDepth(3), maxInlineDepth(3),
smallFunctionMaxInlineDepth(10), smallFunctionMaxInlineDepth(10),
smallFunctionMaxBytecodeLength(100), smallFunctionMaxBytecodeLength(100),
smallFunctionUsesBeforeInlining(usesBeforeInlining / 4),
polyInlineMax(4), polyInlineMax(4),
inlineMaxTotalBytecodeLength(800), inlineMaxTotalBytecodeLength(1000),
inlineUseCountRatio(128), inlineUseCountRatio(128),
eagerCompilation(false), eagerCompilation(false),
slowCallLimit(512), slowCallLimit(512),
@ -220,6 +206,10 @@ struct IonOptions
usesBeforeCompileParallel(1) usesBeforeCompileParallel(1)
{ {
} }
uint32_t usesBeforeInlining() {
return usesBeforeCompile * usesBeforeInliningFactor;
}
}; };
enum MethodStatus enum MethodStatus

View File

@ -3099,7 +3099,6 @@ IonBuilder::makeInliningDecision(AutoObjectVector &targets)
uint32_t callerUses = script()->getUseCount(); uint32_t callerUses = script()->getUseCount();
uint32_t totalSize = 0; uint32_t totalSize = 0;
uint32_t checkUses = js_IonOptions.usesBeforeInlining;
uint32_t maxInlineDepth = js_IonOptions.maxInlineDepth; uint32_t maxInlineDepth = js_IonOptions.maxInlineDepth;
bool allFunctionsAreSmall = true; bool allFunctionsAreSmall = true;
RootedFunction target(cx); RootedFunction target(cx);
@ -3126,15 +3125,13 @@ IonBuilder::makeInliningDecision(AutoObjectVector &targets)
return false; return false;
} }
} }
if (allFunctionsAreSmall) { if (allFunctionsAreSmall)
checkUses = js_IonOptions.smallFunctionUsesBeforeInlining;
maxInlineDepth = js_IonOptions.smallFunctionMaxInlineDepth; maxInlineDepth = js_IonOptions.smallFunctionMaxInlineDepth;
}
if (inliningDepth >= maxInlineDepth) if (inliningDepth >= maxInlineDepth)
return false; return false;
if (script()->getUseCount() < checkUses) { if (script()->getUseCount() < js_IonOptions.usesBeforeInlining()) {
IonSpew(IonSpew_Inlining, "Not inlining, caller is not hot"); IonSpew(IonSpew_Inlining, "Not inlining, caller is not hot");
return false; return false;
} }
@ -4789,7 +4786,7 @@ IonBuilder::insertRecompileCheck()
return; return;
// Don't recompile if we are already inlining. // Don't recompile if we are already inlining.
if (script()->getUseCount() >= js_IonOptions.usesBeforeInlining) if (script()->getUseCount() >= js_IonOptions.usesBeforeInlining())
return; return;
// Don't recompile if the oracle cannot provide inlining information // Don't recompile if the oracle cannot provide inlining information

View File

@ -73,40 +73,84 @@ template void MacroAssembler::guardTypeSet(const ValueOperand &value, const type
void void
MacroAssembler::PushRegsInMask(RegisterSet set) MacroAssembler::PushRegsInMask(RegisterSet set)
{ {
size_t diff = set.gprs().size() * STACK_SLOT_SIZE + int32_t diffF = set.fpus().size() * sizeof(double);
set.fpus().size() * sizeof(double); int32_t diffG = set.gprs().size() * STACK_SLOT_SIZE;
reserveStack(diff); reserveStack(diffG);
#ifdef JS_CPU_ARM
for (GeneralRegisterIterator iter(set.gprs()); iter.more(); iter++) { if (set.gprs().size() > 1) {
diff -= STACK_SLOT_SIZE; startDataTransferM(IsStore, StackPointer, IA, NoWriteBack);
storePtr(*iter, Address(StackPointer, diff)); for (GeneralRegisterIterator iter(set.gprs()); iter.more(); iter++) {
diffG -= STACK_SLOT_SIZE;
transferReg(*iter);
}
finishDataTransfer();
} else
#endif
{
for (GeneralRegisterIterator iter(set.gprs()); iter.more(); iter++) {
diffG -= STACK_SLOT_SIZE;
storePtr(*iter, Address(StackPointer, diffG));
}
} }
JS_ASSERT(diffG == 0);
reserveStack(diffF);
#ifdef JS_CPU_ARM
diffF -= transferMultipleByRuns(set.fpus(), IsStore, StackPointer, IA);
#else
for (FloatRegisterIterator iter(set.fpus()); iter.more(); iter++) { for (FloatRegisterIterator iter(set.fpus()); iter.more(); iter++) {
diff -= sizeof(double); diffF -= sizeof(double);
storeDouble(*iter, Address(StackPointer, diff)); storeDouble(*iter, Address(StackPointer, diffF));
} }
#endif
JS_ASSERT(diffF == 0);
} }
void void
MacroAssembler::PopRegsInMaskIgnore(RegisterSet set, RegisterSet ignore) MacroAssembler::PopRegsInMaskIgnore(RegisterSet set, RegisterSet ignore)
{ {
size_t diff = set.gprs().size() * STACK_SLOT_SIZE + int32_t diffG = set.gprs().size() * STACK_SLOT_SIZE;
set.fpus().size() * sizeof(double); int32_t diffF = set.fpus().size() * sizeof(double);
size_t reserved = diff; const int32_t reservedG = diffG;
const int32_t reservedF = diffF;
for (GeneralRegisterIterator iter(set.gprs()); iter.more(); iter++) { #ifdef JS_CPU_ARM
diff -= STACK_SLOT_SIZE; // ARM can load multiple registers at once, but only if we want back all
if (!ignore.has(*iter)) // the registers we previously saved to the stack.
loadPtr(Address(StackPointer, diff), *iter); if (ignore.empty(true)) {
} diffF -= transferMultipleByRuns(set.fpus(), IsLoad, StackPointer, IA);
for (FloatRegisterIterator iter(set.fpus()); iter.more(); iter++) { } else
diff -= sizeof(double); #endif
if (!ignore.has(*iter)) {
loadDouble(Address(StackPointer, diff), *iter); for (FloatRegisterIterator iter(set.fpus()); iter.more(); iter++) {
diffF -= sizeof(double);
if (!ignore.has(*iter))
loadDouble(Address(StackPointer, diffF), *iter);
}
} }
freeStack(reservedF);
JS_ASSERT(diffF == 0);
freeStack(reserved); #ifdef JS_CPU_ARM
if (set.gprs().size() > 1 && ignore.empty(false)) {
startDataTransferM(IsLoad, StackPointer, IA, NoWriteBack);
for (GeneralRegisterIterator iter(set.gprs()); iter.more(); iter++) {
diffG -= STACK_SLOT_SIZE;
transferReg(*iter);
}
finishDataTransfer();
} else
#endif
{
for (GeneralRegisterIterator iter(set.gprs()); iter.more(); iter++) {
diffG -= STACK_SLOT_SIZE;
if (!ignore.has(*iter))
loadPtr(Address(StackPointer, diffG), *iter);
}
}
freeStack(reservedG);
JS_ASSERT(diffG == 0);
} }
template<typename T> template<typename T>

View File

@ -318,6 +318,11 @@ class TypedRegisterSet
bool has(T reg) const { bool has(T reg) const {
return !!(bits_ & (1 << reg.code())); return !!(bits_ & (1 << reg.code()));
} }
bool hasNextRegister(T reg) const {
if (reg.code() == sizeof(bits_)*8)
return false;
return !!(bits_ & (1 << (reg.code()+1)));
}
void addUnchecked(T reg) { void addUnchecked(T reg) {
bits_ |= (1 << reg.code()); bits_ |= (1 << reg.code());
} }
@ -344,12 +349,23 @@ class TypedRegisterSet
JS_FLOOR_LOG2(ireg, bits_); JS_FLOOR_LOG2(ireg, bits_);
return T::FromCode(ireg); return T::FromCode(ireg);
} }
T getFirst() const {
JS_ASSERT(!empty());
int ireg = js_bitscan_ctz32(bits_);
return T::FromCode(ireg);
}
T takeAny() { T takeAny() {
JS_ASSERT(!empty()); JS_ASSERT(!empty());
T reg = getAny(); T reg = getAny();
take(reg); take(reg);
return reg; return reg;
} }
T takeFirst() {
JS_ASSERT(!empty());
T reg = getFirst();
take(reg);
return reg;
}
void clear() { void clear() {
bits_ = 0; bits_ = 0;
} }
@ -533,6 +549,7 @@ class RegisterSet {
} }
}; };
// iterates backwards, that is, rn to r0
template <typename T> template <typename T>
class TypedRegisterIterator class TypedRegisterIterator
{ {
@ -552,13 +569,48 @@ class TypedRegisterIterator
regset_.takeAny(); regset_.takeAny();
return old; return old;
} }
TypedRegisterIterator<T>& operator ++() {
regset_.takeAny();
return *this;
}
T operator *() const { T operator *() const {
return regset_.getAny(); return regset_.getAny();
} }
}; };
// iterates forwards, that is r0 to rn
template <typename T>
class TypedRegisterForwardIterator
{
TypedRegisterSet<T> regset_;
public:
TypedRegisterForwardIterator(TypedRegisterSet<T> regset) : regset_(regset)
{ }
TypedRegisterForwardIterator(const TypedRegisterForwardIterator &other) : regset_(other.regset_)
{ }
bool more() const {
return !regset_.empty();
}
TypedRegisterForwardIterator<T> operator ++(int) {
TypedRegisterIterator<T> old(*this);
regset_.takeFirst();
return old;
}
TypedRegisterForwardIterator<T>& operator ++() {
regset_.takeFirst();
return *this;
}
T operator *() const {
return regset_.getFirst();
}
};
typedef TypedRegisterIterator<Register> GeneralRegisterIterator; typedef TypedRegisterIterator<Register> GeneralRegisterIterator;
typedef TypedRegisterIterator<FloatRegister> FloatRegisterIterator; typedef TypedRegisterIterator<FloatRegister> FloatRegisterIterator;
typedef TypedRegisterForwardIterator<Register> GeneralRegisterForwardIterator;
typedef TypedRegisterForwardIterator<FloatRegister> FloatRegisterForwardIterator;
class AnyRegisterIterator class AnyRegisterIterator
{ {

View File

@ -1383,6 +1383,37 @@ MacroAssemblerARM::ma_vstr(VFPRegister src, Register base, Register index, int32
ma_vstr(src, Operand(ScratchRegister, 0), cc); ma_vstr(src, Operand(ScratchRegister, 0), cc);
} }
int32_t
MacroAssemblerARM::transferMultipleByRuns(FloatRegisterSet set, LoadStore ls,
Register rm, DTMMode mode)
{
int32_t delta;
if (mode == IA) {
delta = sizeof(double);
} else if (mode == DB) {
delta = -sizeof(double);
} else {
JS_NOT_REACHED("Invalid data transfer addressing mode");
}
int32_t offset = 0;
FloatRegisterForwardIterator iter(set);
while (iter.more()) {
startFloatTransferM(ls, rm, mode, WriteBack);
int32_t reg = (*iter).code_;
do {
offset += delta;
transferFloatReg(*iter);
} while ((++iter).more() && (*iter).code_ == ++reg);
finishFloatTransfer();
}
JS_ASSERT(offset == set.size() * sizeof(double) * (mode == DB ? -1 : 1));
ma_sub(Imm32(offset), rm);
return offset;
}
bool bool
MacroAssemblerARMCompat::buildFakeExitFrame(const Register &scratch, uint32_t *offset) MacroAssemblerARMCompat::buildFakeExitFrame(const Register &scratch, uint32_t *offset)
{ {

View File

@ -330,6 +330,14 @@ class MacroAssemblerARM : public Assembler
void ma_callIonHalfPush(const Register reg); void ma_callIonHalfPush(const Register reg);
void ma_call(void *dest); void ma_call(void *dest);
// Float registers can only be loaded/stored in continuous runs
// when using vstm/vldm.
// This function breaks set into continuous runs and loads/stores
// them at [rm]. rm will be modified, but returned to its initial value.
// Returns the offset from [dm] for the logical next load/store.
int32_t transferMultipleByRuns(FloatRegisterSet set, LoadStore ls,
Register rm, DTMMode mode);
}; };
class MacroAssemblerARMCompat : public MacroAssemblerARM class MacroAssemblerARMCompat : public MacroAssemblerARM

View File

@ -3366,6 +3366,9 @@ TypeCompartment::fixObjectType(JSContext *cx, HandleObject obj)
return; return;
} }
if (obj->isIndexed())
objType->setFlags(cx, OBJECT_FLAG_SPARSE_INDEXES);
jsid *ids = cx->pod_calloc<jsid>(obj->slotSpan()); jsid *ids = cx->pod_calloc<jsid>(obj->slotSpan());
if (!ids) { if (!ids) {
cx->compartment->types.setPendingNukeTypes(cx); cx->compartment->types.setPendingNukeTypes(cx);

View File

@ -52,13 +52,6 @@ LIBS += $(NSPR_LIBS)
NSDISTMODE = copy NSDISTMODE = copy
ifdef _MSC_VER
ifeq ($(OS_TEST),x86_64)
# set stack to 2MB on x64 build. See bug 582910
WIN32_EXE_LDFLAGS += -STACK:2097152
endif
endif
ifeq ($(OS_TEST),ia64) ifeq ($(OS_TEST),ia64)
LIBS += $(JEMALLOC_LIBS) LIBS += $(JEMALLOC_LIBS)
endif endif

View File

@ -285,7 +285,8 @@ DEBUG_CheckUnwrapSafety(JSObject *obj, js::Wrapper *handler,
MOZ_ASSERT(!handler->isSafeToUnwrap()); MOZ_ASSERT(!handler->isSafeToUnwrap());
} else if (AccessCheck::needsSystemOnlyWrapper(obj)) { } else if (AccessCheck::needsSystemOnlyWrapper(obj)) {
// SOWs are opaque to everyone but Chrome and XBL scopes. // SOWs are opaque to everyone but Chrome and XBL scopes.
MOZ_ASSERT(handler->isSafeToUnwrap() == nsContentUtils::CanAccessNativeAnon()); // FIXME: Re-enable in bug 834732.
// MOZ_ASSERT(handler->isSafeToUnwrap() == nsContentUtils::CanAccessNativeAnon());
} else { } else {
// Otherwise, it should depend on whether the target subsumes the origin. // Otherwise, it should depend on whether the target subsumes the origin.
MOZ_ASSERT(handler->isSafeToUnwrap() == AccessCheck::subsumes(target, origin)); MOZ_ASSERT(handler->isSafeToUnwrap() == AccessCheck::subsumes(target, origin));

View File

@ -5305,10 +5305,10 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
// Don't create frames for non-SVG element children of SVG elements. // Don't create frames for non-SVG element children of SVG elements.
if (aNameSpaceID != kNameSpaceID_SVG && if (aNameSpaceID != kNameSpaceID_SVG &&
aParentFrame && ((aParentFrame &&
IsFrameForSVG(aParentFrame) && IsFrameForSVG(aParentFrame) &&
!aParentFrame->IsFrameOfType(nsIFrame::eSVGForeignObject) !aParentFrame->IsFrameOfType(nsIFrame::eSVGForeignObject)) ||
) { (aFlags & ITEM_IS_WITHIN_SVG_TEXT))) {
SetAsUndisplayedContent(aItems, element, styleContext, SetAsUndisplayedContent(aItems, element, styleContext,
isGeneratedContent); isGeneratedContent);
return; return;

View File

@ -1605,11 +1605,14 @@ nsDisplayBackgroundImage::AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuil
drawBackgroundImage, drawBackgroundColor); drawBackgroundImage, drawBackgroundColor);
} }
// Even if we don't actually have a background color to paint, we still need // Even if we don't actually have a background color to paint, we may still need
// to create the item because it's used for hit testing. // to create an item for hit testing.
aList->AppendNewToTop( if ((drawBackgroundColor && color != NS_RGBA(0,0,0,0)) ||
new (aBuilder) nsDisplayBackgroundColor(aBuilder, aFrame, bg, aBuilder->IsForEventDelivery()) {
drawBackgroundColor ? color : NS_RGBA(0, 0, 0, 0))); aList->AppendNewToTop(
new (aBuilder) nsDisplayBackgroundColor(aBuilder, aFrame, bg,
drawBackgroundColor ? color : NS_RGBA(0, 0, 0, 0)));
}
if (isThemed) { if (isThemed) {
nsDisplayBackgroundImage* bgItem = nsDisplayBackgroundImage* bgItem =

View File

@ -124,7 +124,7 @@ fuzzy-if(!contentSameGfxBackendAsCanvas,2,20000) fails-if(Android) == aja-linear
fuzzy-if(!contentSameGfxBackendAsCanvas,2,16477) fails-if(Android) == aja-linear-6a.html aja-linear-6-ref.html # bug 526708 fuzzy-if(!contentSameGfxBackendAsCanvas,2,16477) fails-if(Android) == aja-linear-6a.html aja-linear-6-ref.html # bug 526708
fails == aja-linear-6b.html aja-linear-6-ref.html # bug 522607 fails == aja-linear-6b.html aja-linear-6-ref.html # bug 522607
skip-if(B2G) == height-dependence-1.html height-dependence-1-ref.html skip-if(B2G) == height-dependence-1.html height-dependence-1-ref.html
skip-if(B2G) == height-dependence-2.html height-dependence-2-ref.html skip-if(B2G) fuzzy-if(cocoaWidget,1,40000) == height-dependence-2.html height-dependence-2-ref.html
skip-if(B2G) == height-dependence-3.html height-dependence-3-ref.html skip-if(B2G) == height-dependence-3.html height-dependence-3-ref.html
fails-if(d2d) == linear-onestopposition-1.html linear-onestopposition-1-ref.html # bug 638664 fails-if(d2d) == linear-onestopposition-1.html linear-onestopposition-1-ref.html # bug 638664

View File

@ -0,0 +1,9 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<svg xmlns="http://www.w3.org/2000/svg" width="700" height="200" viewBox="0 0 700 200"
style="font: 16px sans-serif">
<text x="100" y="100">hello</text>
<text x="100" y="200"><textPath display="none">f</textPath></text>
</svg>

After

Width:  |  Height:  |  Size: 354 B

View File

@ -0,0 +1,12 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<svg xmlns="http://www.w3.org/2000/svg" width="700" height="200">
<text x="100" y="100" style="font: 16px sans-serif">
<tspan>
ab
ef
</tspan>
</text>
</svg>

After

Width:  |  Height:  |  Size: 299 B

View File

@ -0,0 +1,13 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<svg xmlns="http://www.w3.org/2000/svg" width="700" height="200">
<text x="100" y="100" style="font: 16px sans-serif">
<tspan>
ab
<progress xmlns="http://www.w3.org/1999/xhtml">cd</progress>
ef
</tspan>
</text>
</svg>

After

Width:  |  Height:  |  Size: 366 B

View File

@ -0,0 +1,7 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<svg xmlns="http://www.w3.org/2000/svg" width="700" height="200">
<text x="100" y="100" style="font: 16px sans-serif">&#x0301;t</text>
</svg>

After

Width:  |  Height:  |  Size: 262 B

View File

@ -0,0 +1,10 @@
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<svg xmlns="http://www.w3.org/2000/svg" width="700" height="200">
<style>
text::first-letter { font-size: 32px }
</style>
<text x="100" y="100" style="font: 16px sans-serif">&#x0301;t</text>
</svg>

After

Width:  |  Height:  |  Size: 326 B

View File

@ -99,6 +99,7 @@ HTTP(../..) == simple-transform-rotate.svg simple-transform-rotate-ref.svg
== display-none-1.svg simple.svg == display-none-1.svg simple.svg
== display-none-2.svg simple.svg == display-none-2.svg simple.svg
== display-none-3.svg simple.svg == display-none-3.svg simple.svg
== display-none-4.svg simple.svg
== simple-multiline.svg simple-multiline-ref.svg == simple-multiline.svg simple-multiline-ref.svg
== simple-multiline-number.svg simple-multiline-number-ref.svg == simple-multiline-number.svg simple-multiline-number-ref.svg
@ -133,10 +134,12 @@ HTTP(../..) == simple-transform-rotate.svg simple-transform-rotate-ref.svg
== pseudo-first-line.svg pseudo-first-line-ref.svg == pseudo-first-line.svg pseudo-first-line-ref.svg
== pseudo-first-line-2.svg pseudo-first-line-2-ref.svg == pseudo-first-line-2.svg pseudo-first-line-2-ref.svg
== pseudo-first-letter.svg pseudo-first-letter-ref.svg == pseudo-first-letter.svg pseudo-first-letter-ref.svg
== pseudo-first-letter-2.svg pseudo-first-letter-2-ref.svg
== ignore-before-after.svg ignore-prop-ref.svg == ignore-before-after.svg ignore-prop-ref.svg
# invalid child nodes # invalid child nodes
== ignore-invalid-child.svg ignore-invalid-child-ref.svg == ignore-invalid-child.svg ignore-invalid-child-ref.svg
== ignore-invalid-child-2.svg ignore-invalid-child-2-ref.svg
# text inside a link # text inside a link
== link-surrounding.svg simple.svg == link-surrounding.svg simple.svg

View File

@ -273,11 +273,7 @@ IsNonEmptyTextFrame(nsIFrame* aFrame)
return false; return false;
} }
nsIContent* content = textFrame->GetContent(); return textFrame->GetContentLength() != 0;
NS_ASSERTION(content && content->IsNodeOfType(nsINode::eTEXT),
"unexpected content type for nsTextFrame");
return static_cast<nsTextNode*>(content)->TextLength() != 0;
} }
/** /**
@ -1440,6 +1436,9 @@ TextNodeCorrespondenceRecorder::TraverseAndRecord(nsIFrame* aFrame)
* * what nsInlineFrame corresponding to a <textPath> element it is a * * what nsInlineFrame corresponding to a <textPath> element it is a
* descendant of * descendant of
* * what computed dominant-baseline value applies to it * * what computed dominant-baseline value applies to it
*
* Note that any text frames that are empty -- whose ContentLength() is 0 --
* will be skipped over.
*/ */
class TextFrameIterator class TextFrameIterator
{ {
@ -4424,9 +4423,9 @@ nsSVGTextFrame2::DoGlyphPositioning()
// Get the x, y, dx, dy, rotate values for the subtree. // Get the x, y, dx, dy, rotate values for the subtree.
nsTArray<gfxPoint> deltas; nsTArray<gfxPoint> deltas;
if (!ResolvePositions(deltas)) { if (!ResolvePositions(deltas)) {
// We shouldn't reach here because DetermineCharPositions should have been // If ResolvePositions returned false, it means that there were some
// empty if we fail to resolve any positions. // characters in the DOM but none of them are displayed. Clear out
NS_NOTREACHED("unexpected result from ResolvePositions"); // mPositions so that we don't attempt to do any painting later.
mPositions.Clear(); mPositions.Clear();
return; return;
} }

View File

@ -1023,6 +1023,7 @@ fsmdef_init_dcb (fsmdef_dcb_t *dcb, callid_t call_id,
dcb->remote_sdp_present = FALSE; dcb->remote_sdp_present = FALSE;
dcb->remote_sdp_in_ack = FALSE; dcb->remote_sdp_in_ack = FALSE;
dcb->local_sdp_complete = FALSE;
dcb->sdp = NULL; dcb->sdp = NULL;
dcb->src_sdp_version = 0; dcb->src_sdp_version = 0;
@ -2865,6 +2866,8 @@ fsmdef_ev_createoffer (sm_event_t *event) {
char *ice_pwd = NULL; char *ice_pwd = NULL;
short vcm_res; short vcm_res;
session_data_t *sess_data_p = NULL; session_data_t *sess_data_p = NULL;
char *local_sdp = NULL;
uint32_t local_sdp_len = 0;
FSM_DEBUG_SM(DEB_F_PREFIX"Entered.\n", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__)); FSM_DEBUG_SM(DEB_F_PREFIX"Entered.\n", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__));
@ -2878,6 +2881,29 @@ fsmdef_ev_createoffer (sm_event_t *event) {
FSM_DEBUG_SM(DEB_F_PREFIX"dcb is NULL.\n", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__)); FSM_DEBUG_SM(DEB_F_PREFIX"dcb is NULL.\n", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__));
return SM_RC_CLEANUP; return SM_RC_CLEANUP;
} }
/* For now, if the local SDP has been set, we don't allow it to be set
again. This will change when we allow renegotiation of ongoing
sessions. See bug 840728. */
if (dcb->local_sdp_complete) {
FSM_DEBUG_SM(DEB_F_PREFIX"local SDP already created: returning "
"prevously created SDP.\n", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__));
local_sdp = sipsdp_write_to_buf(dcb->sdp->src_sdp, &local_sdp_len);
if (!local_sdp) {
ui_create_offer(evCreateOfferError, line, call_id,
dcb->caller_id.call_instance_id, strlib_empty());
FSM_DEBUG_SM(get_debug_string(FSM_DBG_SDP_BUILD_ERR));
return (fsmdef_release(fcb, cause, FALSE));
}
ui_create_offer(evCreateOffer, line, call_id,
dcb->caller_id.call_instance_id,
strlib_malloc(local_sdp,-1));
free(local_sdp);
return (SM_RC_END);
}
dcb->inbound = FALSE; dcb->inbound = FALSE;
if (msg->data.session.constraints) { if (msg->data.session.constraints) {
@ -2935,6 +2961,8 @@ fsmdef_ev_createoffer (sm_event_t *event) {
return (fsmdef_release(fcb, cause, FALSE)); return (fsmdef_release(fcb, cause, FALSE));
} }
dcb->local_sdp_complete = TRUE;
/* Pass offer SDP back to UI */ /* Pass offer SDP back to UI */
ui_create_offer(evCreateOffer, line, call_id, ui_create_offer(evCreateOffer, line, call_id,
dcb->caller_id.call_instance_id, dcb->caller_id.call_instance_id,
@ -2974,6 +3002,8 @@ fsmdef_ev_createanswer (sm_event_t *event) {
boolean has_audio; boolean has_audio;
boolean has_video; boolean has_video;
boolean has_data; boolean has_data;
char *local_sdp = NULL;
uint32_t local_sdp_len = 0;
FSM_DEBUG_SM(DEB_F_PREFIX"Entered.\n", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__)); FSM_DEBUG_SM(DEB_F_PREFIX"Entered.\n", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__));
@ -2986,6 +3016,29 @@ fsmdef_ev_createanswer (sm_event_t *event) {
FSM_DEBUG_SM(DEB_F_PREFIX"dcb is NULL.\n", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__)); FSM_DEBUG_SM(DEB_F_PREFIX"dcb is NULL.\n", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__));
return SM_RC_CLEANUP; return SM_RC_CLEANUP;
} }
/* For now, if the local SDP has been set, we don't allow it to be set
again. This will change when we allow renegotiation of ongoing
sessions. See bug 840728. */
if (dcb->local_sdp_complete) {
FSM_DEBUG_SM(DEB_F_PREFIX"local SDP already created: returning "
"prevously created SDP.\n", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__));
local_sdp = sipsdp_write_to_buf(dcb->sdp->src_sdp, &local_sdp_len);
if (!local_sdp) {
ui_create_answer(evCreateAnswerError, line, call_id,
dcb->caller_id.call_instance_id, strlib_empty());
FSM_DEBUG_SM(get_debug_string(FSM_DBG_SDP_BUILD_ERR));
return (fsmdef_release(fcb, cause, FALSE));
}
ui_create_answer(evCreateAnswer, line, call_id,
dcb->caller_id.call_instance_id,
strlib_malloc(local_sdp,-1));
free(local_sdp);
return (SM_RC_END);
}
dcb->inbound = TRUE; dcb->inbound = TRUE;
if (msg->data.session.constraints) { if (msg->data.session.constraints) {
@ -3069,6 +3122,8 @@ fsmdef_ev_createanswer (sm_event_t *event) {
return (fsmdef_release(fcb, cause, FALSE)); return (fsmdef_release(fcb, cause, FALSE));
} }
dcb->local_sdp_complete = TRUE;
/* Pass SDP back to UI */ /* Pass SDP back to UI */
ui_create_answer(evCreateAnswer, line, call_id, ui_create_answer(evCreateAnswer, line, call_id,
dcb->caller_id.call_instance_id, dcb->caller_id.call_instance_id,
@ -3096,7 +3151,7 @@ fsmdef_ev_setlocaldesc(sm_event_t *event) {
callid_t call_id = msg->call_id; callid_t call_id = msg->call_id;
line_t line = msg->line; line_t line = msg->line;
cc_causes_t lsm_rc; cc_causes_t lsm_rc;
char *local_sdp = 0; char *local_sdp = NULL;
uint32_t local_sdp_len = 0; uint32_t local_sdp_len = 0;
FSM_DEBUG_SM(DEB_F_PREFIX"Entered.\n", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__)); FSM_DEBUG_SM(DEB_F_PREFIX"Entered.\n", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__));

View File

@ -293,6 +293,7 @@ typedef struct {
*/ */
boolean remote_sdp_present; boolean remote_sdp_present;
boolean remote_sdp_in_ack; boolean remote_sdp_in_ack;
boolean local_sdp_complete;
uint16_t src_sdp_version; uint16_t src_sdp_version;
cc_sdp_t *sdp; cc_sdp_t *sdp;

View File

@ -1215,7 +1215,8 @@ TEST_F(SignalingTest, CreateOfferDontReceiveVideo)
SHOULD_SENDRECV_AUDIO | SHOULD_SEND_VIDEO); SHOULD_SENDRECV_AUDIO | SHOULD_SEND_VIDEO);
} }
TEST_F(SignalingTest, CreateOfferRemoveAudioStream) // XXX Disabled pending resolution of Bug 840728
TEST_F(SignalingTest, DISABLED_CreateOfferRemoveAudioStream)
{ {
sipcc::MediaConstraints constraints; sipcc::MediaConstraints constraints;
constraints.setBooleanConstraint("OfferToReceiveAudio", true, false); constraints.setBooleanConstraint("OfferToReceiveAudio", true, false);
@ -1224,7 +1225,8 @@ TEST_F(SignalingTest, CreateOfferRemoveAudioStream)
SHOULD_RECV_AUDIO | SHOULD_SENDRECV_VIDEO); SHOULD_RECV_AUDIO | SHOULD_SENDRECV_VIDEO);
} }
TEST_F(SignalingTest, CreateOfferDontReceiveAudioRemoveAudioStream) // XXX Disabled pending resolution of Bug 840728
TEST_F(SignalingTest, DISABLED_CreateOfferDontReceiveAudioRemoveAudioStream)
{ {
sipcc::MediaConstraints constraints; sipcc::MediaConstraints constraints;
constraints.setBooleanConstraint("OfferToReceiveAudio", false, false); constraints.setBooleanConstraint("OfferToReceiveAudio", false, false);
@ -1233,7 +1235,8 @@ TEST_F(SignalingTest, CreateOfferDontReceiveAudioRemoveAudioStream)
SHOULD_SENDRECV_VIDEO); SHOULD_SENDRECV_VIDEO);
} }
TEST_F(SignalingTest, CreateOfferDontReceiveVideoRemoveVideoStream) // XXX Disabled pending resolution of Bug 840728
TEST_F(SignalingTest, DISABLED_CreateOfferDontReceiveVideoRemoveVideoStream)
{ {
sipcc::MediaConstraints constraints; sipcc::MediaConstraints constraints;
constraints.setBooleanConstraint("OfferToReceiveAudio", true, false); constraints.setBooleanConstraint("OfferToReceiveAudio", true, false);

View File

@ -128,7 +128,6 @@
#ifdef ACCESSIBILITY #ifdef ACCESSIBILITY
#ifdef XP_WIN32 #ifdef XP_WIN32
@BINPATH@/AccessibleMarshal.dll @BINPATH@/AccessibleMarshal.dll
@BINPATH@/components/accessibility-msaa.xpt
#endif #endif
@BINPATH@/components/accessibility.xpt @BINPATH@/components/accessibility.xpt
#endif #endif

View File

@ -43,12 +43,6 @@ EXPORTS = \
include $(topsrcdir)/config/rules.mk include $(topsrcdir)/config/rules.mk
ifdef CROSS_COMPILE
ifdef HOST_NSPR_MDCPUCFG
HOST_CFLAGS += -DMDCPUCFG=$(HOST_NSPR_MDCPUCFG)
endif
endif
# The intermediate (.ii/.s) files for host and target can have the same name... # The intermediate (.ii/.s) files for host and target can have the same name...
# disable parallel builds # disable parallel builds
.NOTPARALLEL: .NOTPARALLEL:

View File

@ -39,12 +39,6 @@ EXPORTS = \
include $(topsrcdir)/config/rules.mk include $(topsrcdir)/config/rules.mk
ifdef CROSS_COMPILE
ifdef HOST_NSPR_MDCPUCFG
HOST_CFLAGS += -DMDCPUCFG=$(HOST_NSPR_MDCPUCFG)
endif
endif
# The intermediate (.ii/.s) files for host and target can have the same name... # The intermediate (.ii/.s) files for host and target can have the same name...
# disable parallel builds # disable parallel builds
.NOTPARALLEL: .NOTPARALLEL:

View File

@ -710,7 +710,7 @@ pref("dom.min_background_timeout_value", 1000);
pref("dom.experimental_bindings", true); pref("dom.experimental_bindings", true);
// Run content XBL in a separate scope. // Run content XBL in a separate scope.
pref("dom.xbl_scopes", false); pref("dom.xbl_scopes", true);
// Don't use new input types // Don't use new input types
pref("dom.experimental_forms", false); pref("dom.experimental_forms", false);

View File

@ -86,12 +86,6 @@ MoveCList(PRCList &from, PRCList &to)
} }
} }
static uint32_t
NowInMinutes()
{
return uint32_t(PR_Now() / int64_t(60 * PR_USEC_PER_SEC));
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
#if defined(RES_RETRY_ON_FAILURE) #if defined(RES_RETRY_ON_FAILURE)
@ -158,7 +152,7 @@ nsHostRecord::nsHostRecord(const nsHostKey *key)
flags = key->flags; flags = key->flags;
af = key->af; af = key->af;
expiration = NowInMinutes(); expiration = TimeStamp::NowLoRes();
PR_INIT_CLIST(this); PR_INIT_CLIST(this);
PR_INIT_CLIST(&callbacks); PR_INIT_CLIST(&callbacks);
@ -285,9 +279,8 @@ HostDB_ClearEntry(PLDHashTable *table,
if (!hr->addr_info) { if (!hr->addr_info) {
LOG(("No address info for host [%s].\n", hr->host)); LOG(("No address info for host [%s].\n", hr->host));
} else { } else {
int32_t now = (int32_t) NowInMinutes(); TimeDuration diff = hr->expiration - TimeStamp::NowLoRes();
int32_t diff = (int32_t) hr->expiration - now; LOG(("Record for [%s] expires in %f seconds.\n", hr->host, diff.ToSeconds()));
LOG(("Record for [%s] expires in %d minute(s).\n", hr->host, diff));
NetAddrElement *addrElement = nullptr; NetAddrElement *addrElement = nullptr;
char buf[kIPv6CStrBufSize]; char buf[kIPv6CStrBufSize];
@ -347,7 +340,7 @@ nsHostResolver::nsHostResolver(uint32_t maxCacheEntries,
uint32_t maxCacheLifetime, uint32_t maxCacheLifetime,
uint32_t lifetimeGracePeriod) uint32_t lifetimeGracePeriod)
: mMaxCacheEntries(maxCacheEntries) : mMaxCacheEntries(maxCacheEntries)
, mMaxCacheLifetime(maxCacheLifetime) , mMaxCacheLifetime(TimeDuration::FromSeconds(maxCacheLifetime * 60))
, mGracePeriod(lifetimeGracePeriod) , mGracePeriod(lifetimeGracePeriod)
, mLock("nsHostResolver.mLock") , mLock("nsHostResolver.mLock")
, mIdleThreadCV(mLock, "nsHostResolver.mIdleThreadCV") , mIdleThreadCV(mLock, "nsHostResolver.mIdleThreadCV")
@ -543,8 +536,7 @@ nsHostResolver::ResolveHost(const char *host,
// do we have a cached result that we can reuse? // do we have a cached result that we can reuse?
else if (!(flags & RES_BYPASS_CACHE) && else if (!(flags & RES_BYPASS_CACHE) &&
he->rec->HasResult() && he->rec->HasResult() &&
NowInMinutes() <= he->rec->expiration + mGracePeriod) { TimeStamp::NowLoRes() <= (he->rec->expiration + TimeDuration::FromSeconds(mGracePeriod * 60))) {
LOG(("Using cached record for host [%s].\n", host)); LOG(("Using cached record for host [%s].\n", host));
// put reference to host record on stack... // put reference to host record on stack...
result = he->rec; result = he->rec;
@ -553,7 +545,7 @@ nsHostResolver::ResolveHost(const char *host,
// For entries that are in the grace period with a failed connect, // For entries that are in the grace period with a failed connect,
// or all cached negative entries, use the cache but start a new lookup in // or all cached negative entries, use the cache but start a new lookup in
// the background // the background
if ((((NowInMinutes() > he->rec->expiration) && if ((((TimeStamp::NowLoRes() > he->rec->expiration) &&
he->rec->mBlacklistedItems.Length()) || he->rec->mBlacklistedItems.Length()) ||
he->rec->negative) && !he->rec->resolving) { he->rec->negative) && !he->rec->resolving) {
LOG(("Using %s cache entry for host [%s] but starting async renewal.", LOG(("Using %s cache entry for host [%s] but starting async renewal.",
@ -855,13 +847,13 @@ nsHostResolver::OnLookupComplete(nsHostRecord *rec, nsresult status, AddrInfo *r
} }
delete old_addr_info; delete old_addr_info;
rec->expiration = NowInMinutes(); rec->expiration = TimeStamp::NowLoRes();
if (result) { if (result) {
rec->expiration += mMaxCacheLifetime; rec->expiration += mMaxCacheLifetime;
rec->negative = false; rec->negative = false;
} }
else { else {
rec->expiration += 1; /* one minute for negative cache */ rec->expiration += TimeDuration::FromSeconds(60); /* one minute for negative cache */
rec->negative = true; rec->negative = true;
} }
rec->resolving = false; rec->resolving = false;
@ -886,9 +878,10 @@ nsHostResolver::OnLookupComplete(nsHostRecord *rec, nsresult status, AddrInfo *r
if (!head->negative) { if (!head->negative) {
// record the age of the entry upon eviction. // record the age of the entry upon eviction.
uint32_t age = TimeDuration age = TimeStamp::NowLoRes() -
NowInMinutes() - (head->expiration - mMaxCacheLifetime); (head->expiration - mMaxCacheLifetime);
Telemetry::Accumulate(Telemetry::DNS_CLEANUP_AGE, age); Telemetry::Accumulate(Telemetry::DNS_CLEANUP_AGE,
static_cast<uint32_t>(age.ToSeconds() / 60));
} }
// release reference to rec owned by mEvictionQ // release reference to rec owned by mEvictionQ
@ -955,8 +948,6 @@ nsHostResolver::CancelAsyncRequest(const char *host,
} }
} }
//----------------------------------------------------------------------------
void void
nsHostResolver::ThreadFunc(void *arg) nsHostResolver::ThreadFunc(void *arg)
{ {
@ -1025,8 +1016,6 @@ nsHostResolver::ThreadFunc(void *arg)
LOG(("DNS lookup thread ending execution.\n")); LOG(("DNS lookup thread ending execution.\n"));
} }
//----------------------------------------------------------------------------
nsresult nsresult
nsHostResolver::Create(uint32_t maxCacheEntries, nsHostResolver::Create(uint32_t maxCacheEntries,
uint32_t maxCacheLifetime, uint32_t maxCacheLifetime,
@ -1067,7 +1056,7 @@ CacheEntryEnumerator(PLDHashTable *table, PLDHashEntryHdr *entry,
DNSCacheEntries info; DNSCacheEntries info;
info.hostname = rec->host; info.hostname = rec->host;
info.family = rec->af; info.family = rec->af;
info.expiration = ((int64_t)rec->expiration - NowInMinutes()) * 60; info.expiration = (int64_t)(rec->expiration - TimeStamp::NowLoRes()).ToSeconds();
if (info.expiration <= 0) { if (info.expiration <= 0) {
// We only need valid DNS cache entries // We only need valid DNS cache entries
return PL_DHASH_NEXT; return PL_DHASH_NEXT;

View File

@ -19,6 +19,7 @@
#include "nsTArray.h" #include "nsTArray.h"
#include "mozilla/net/DNS.h" #include "mozilla/net/DNS.h"
#include "mozilla/net/DashboardTypes.h" #include "mozilla/net/DashboardTypes.h"
#include "mozilla/TimeStamp.h"
class nsHostResolver; class nsHostResolver;
class nsHostRecord; class nsHostRecord;
@ -77,7 +78,7 @@ public:
(though never for more than 60 seconds), but a use (though never for more than 60 seconds), but a use
of that negative entry forces an asynchronous refresh. */ of that negative entry forces an asynchronous refresh. */
uint32_t expiration; /* measured in minutes since epoch */ mozilla::TimeStamp expiration;
bool HasResult() const { return addr_info || addr || negative; } bool HasResult() const { return addr_info || addr || negative; }
@ -259,7 +260,7 @@ private:
}; };
uint32_t mMaxCacheEntries; uint32_t mMaxCacheEntries;
uint32_t mMaxCacheLifetime; mozilla::TimeDuration mMaxCacheLifetime;
uint32_t mGracePeriod; uint32_t mGracePeriod;
Mutex mLock; Mutex mLock;
CondVar mIdleThreadCV; CondVar mIdleThreadCV;

View File

@ -27,6 +27,7 @@ var systemSettings = {
throw Components.results.NS_ERROR_NOT_IMPLEMENTED; throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
}, },
mainThreadOnly: true,
PACURI: "http://localhost:4444/redirect", PACURI: "http://localhost:4444/redirect",
getProxyForURI: function(aURI) { getProxyForURI: function(aURI) {
throw Components.results.NS_ERROR_NOT_IMPLEMENTED; throw Components.results.NS_ERROR_NOT_IMPLEMENTED;

View File

@ -138,6 +138,7 @@ let PACSystemSettings = {
// Replace this URI for each test to avoid caching. We want to ensure that // Replace this URI for each test to avoid caching. We want to ensure that
// each test gets a completely fresh setup. // each test gets a completely fresh setup.
mainThreadOnly: true,
PACURI: null, PACURI: null,
getProxyForURI: function getProxyForURI(aURI) { getProxyForURI: function getProxyForURI(aURI) {
throw Cr.NS_ERROR_NOT_IMPLEMENTED; throw Cr.NS_ERROR_NOT_IMPLEMENTED;

View File

@ -298,12 +298,11 @@ function resetValues() {
* Returns a content sandbox that can be used by the execute_foo functions. * Returns a content sandbox that can be used by the execute_foo functions.
*/ */
function createExecuteContentSandbox(aWindow, timeout) { function createExecuteContentSandbox(aWindow, timeout) {
let sandbox = new Cu.Sandbox(aWindow); let sandbox = new Cu.Sandbox(aWindow, {sandboxPrototype: aWindow});
sandbox.global = sandbox; sandbox.global = sandbox;
sandbox.window = aWindow; sandbox.window = aWindow;
sandbox.document = sandbox.window.document; sandbox.document = sandbox.window.document;
sandbox.navigator = sandbox.window.navigator; sandbox.navigator = sandbox.window.navigator;
sandbox.__proto__ = sandbox.window;
sandbox.testUtils = utils; sandbox.testUtils = utils;
let marionette = new Marionette(this, aWindow, "content", let marionette = new Marionette(this, aWindow, "content",

View File

@ -494,6 +494,14 @@ File.exists = function exists(path) {
* until the contents are fully written, the destination file is * until the contents are fully written, the destination file is
* not modified. * not modified.
* *
* By default, files are flushed for additional safety, i.e. to lower
* the risks of losing data in case the device is suddenly removed or
* in case of sudden shutdown. This additional safety is important
* for user-critical data (e.g. preferences, application data, etc.)
* but comes at a performance cost. For non-critical data (e.g. cache,
* thumbnails, etc.), you may wish to deactivate flushing by passing
* option |flush: false|.
*
* Important note: In the current implementation, option |tmpPath| * Important note: In the current implementation, option |tmpPath|
* is required. This requirement should disappear as part of bug 793660. * is required. This requirement should disappear as part of bug 793660.
* *
@ -506,6 +514,13 @@ File.exists = function exists(path) {
* - {string} tmpPath The path at which to write the temporary file. * - {string} tmpPath The path at which to write the temporary file.
* - {bool} noOverwrite - If set, this function will fail if a file already * - {bool} noOverwrite - If set, this function will fail if a file already
* exists at |path|. The |tmpPath| is not overwritten if |path| exist. * exists at |path|. The |tmpPath| is not overwritten if |path| exist.
* - {bool} flush - If set to |false|, the function will not flush the
* file. This improves performance considerably, but the resulting
* behavior is slightly less safe: if the system shuts down improperly
* (typically due to a kernel freeze or a power failure) or if the
* device is disconnected or removed before the buffer is flushed, the
* file may be corrupted.
*
* *
* @return {promise} * @return {promise}
* @resolves {number} The number of bytes actually written. * @resolves {number} The number of bytes actually written.

View File

@ -314,6 +314,14 @@ AbstractFile.read = function read(path, bytes) {
* until the contents are fully written, the destination file is * until the contents are fully written, the destination file is
* not modified. * not modified.
* *
* By default, files are flushed for additional safety, i.e. to lower
* the risks of losing data in case the device is suddenly removed or
* in case of sudden shutdown. This additional safety is important
* for user-critical data (e.g. preferences, application data, etc.)
* but comes at a performance cost. For non-critical data (e.g. cache,
* thumbnails, etc.), you may wish to deactivate flushing by passing
* option |flush: false|.
*
* Important note: In the current implementation, option |tmpPath| * Important note: In the current implementation, option |tmpPath|
* is required. This requirement should disappear as part of bug 793660. * is required. This requirement should disappear as part of bug 793660.
* *
@ -326,6 +334,12 @@ AbstractFile.read = function read(path, bytes) {
* - {string} tmpPath The path at which to write the temporary file. * - {string} tmpPath The path at which to write the temporary file.
* - {bool} noOverwrite - If set, this function will fail if a file already * - {bool} noOverwrite - If set, this function will fail if a file already
* exists at |path|. The |tmpPath| is not overwritten if |path| exist. * exists at |path|. The |tmpPath| is not overwritten if |path| exist.
* - {bool} flush - If set to |false|, the function will not flush the
* file. This improves performance considerably, but the resulting
* behavior is slightly less safe: if the system shuts down improperly
* (typically due to a kernel freeze or a power failure) or if the
* device is disconnected or removed before the buffer is flushed, the
* file may be corrupted.
* *
* @return {number} The number of bytes actually written. * @return {number} The number of bytes actually written.
*/ */
@ -347,7 +361,9 @@ AbstractFile.writeAtomic =
let bytesWritten; let bytesWritten;
try { try {
bytesWritten = tmpFile.write(buffer, options); bytesWritten = tmpFile.write(buffer, options);
tmpFile.flush(); if ("flush" in options && options.flush) {
tmpFile.flush();
}
} catch (x) { } catch (x) {
OS.File.remove(tmpPath); OS.File.remove(tmpPath);
throw x; throw x;

View File

@ -188,6 +188,7 @@ nsFaviconService::Notify(nsITimer* timer)
NS_IMETHODIMP NS_IMETHODIMP
nsFaviconService::SetFaviconUrlForPage(nsIURI* aPageURI, nsIURI* aFaviconURI) nsFaviconService::SetFaviconUrlForPage(nsIURI* aPageURI, nsIURI* aFaviconURI)
{ {
PLACES_WARN_DEPRECATED();
NS_ENSURE_ARG(aPageURI); NS_ENSURE_ARG(aPageURI);
NS_ENSURE_ARG(aFaviconURI); NS_ENSURE_ARG(aFaviconURI);
@ -342,6 +343,19 @@ nsFaviconService::SetAndLoadFaviconForPage(nsIURI* aPageURI,
bool aForceReload, bool aForceReload,
uint32_t aFaviconLoadType, uint32_t aFaviconLoadType,
nsIFaviconDataCallback* aCallback) nsIFaviconDataCallback* aCallback)
{
PLACES_WARN_DEPRECATED();
return SetAndFetchFaviconForPage(aPageURI, aFaviconURI,
aForceReload, aFaviconLoadType,
aCallback);
}
NS_IMETHODIMP
nsFaviconService::SetAndFetchFaviconForPage(nsIURI* aPageURI,
nsIURI* aFaviconURI,
bool aForceReload,
uint32_t aFaviconLoadType,
nsIFaviconDataCallback* aCallback)
{ {
NS_ENSURE_ARG(aPageURI); NS_ENSURE_ARG(aPageURI);
NS_ENSURE_ARG(aFaviconURI); NS_ENSURE_ARG(aFaviconURI);
@ -372,18 +386,6 @@ nsFaviconService::SetAndLoadFaviconForPage(nsIURI* aPageURI,
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP
nsFaviconService::SetAndFetchFaviconForPage(nsIURI* aPageURI,
nsIURI* aFaviconURI,
bool aForceReload,
uint32_t aFaviconLoadType,
nsIFaviconDataCallback* aCallback)
{
return SetAndLoadFaviconForPage(aPageURI, aFaviconURI,
aForceReload, aFaviconLoadType,
aCallback);
}
NS_IMETHODIMP NS_IMETHODIMP
nsFaviconService::ReplaceFaviconData(nsIURI* aFaviconURI, nsFaviconService::ReplaceFaviconData(nsIURI* aFaviconURI,
const uint8_t* aData, const uint8_t* aData,
@ -462,6 +464,7 @@ nsFaviconService::SetFaviconData(nsIURI* aFaviconURI, const uint8_t* aData,
uint32_t aDataLen, const nsACString& aMimeType, uint32_t aDataLen, const nsACString& aMimeType,
PRTime aExpiration) PRTime aExpiration)
{ {
PLACES_WARN_DEPRECATED();
NS_ENSURE_ARG(aFaviconURI); NS_ENSURE_ARG(aFaviconURI);
if (mFaviconsExpirationRunning) if (mFaviconsExpirationRunning)
@ -637,6 +640,7 @@ nsFaviconService::SetFaviconDataFromDataURL(nsIURI* aFaviconURI,
const nsAString& aDataURL, const nsAString& aDataURL,
PRTime aExpiration) PRTime aExpiration)
{ {
PLACES_WARN_DEPRECATED();
NS_ENSURE_ARG(aFaviconURI); NS_ENSURE_ARG(aFaviconURI);
if (mFaviconsExpirationRunning) if (mFaviconsExpirationRunning)
return NS_OK; return NS_OK;
@ -697,6 +701,7 @@ NS_IMETHODIMP
nsFaviconService::GetFaviconData(nsIURI* aFaviconURI, nsACString& aMimeType, nsFaviconService::GetFaviconData(nsIURI* aFaviconURI, nsACString& aMimeType,
uint32_t* aDataLen, uint8_t** aData) uint32_t* aDataLen, uint8_t** aData)
{ {
PLACES_WARN_DEPRECATED();
NS_ENSURE_ARG(aFaviconURI); NS_ENSURE_ARG(aFaviconURI);
NS_ENSURE_ARG_POINTER(aDataLen); NS_ENSURE_ARG_POINTER(aDataLen);
NS_ENSURE_ARG_POINTER(aData); NS_ENSURE_ARG_POINTER(aData);
@ -777,6 +782,7 @@ NS_IMETHODIMP
nsFaviconService::GetFaviconDataAsDataURL(nsIURI* aFaviconURI, nsFaviconService::GetFaviconDataAsDataURL(nsIURI* aFaviconURI,
nsAString& aDataURL) nsAString& aDataURL)
{ {
PLACES_WARN_DEPRECATED();
NS_ENSURE_ARG(aFaviconURI); NS_ENSURE_ARG(aFaviconURI);
uint8_t* data; uint8_t* data;
@ -811,6 +817,7 @@ nsFaviconService::GetFaviconDataAsDataURL(nsIURI* aFaviconURI,
NS_IMETHODIMP NS_IMETHODIMP
nsFaviconService::GetFaviconForPage(nsIURI* aPageURI, nsIURI** _retval) nsFaviconService::GetFaviconForPage(nsIURI* aPageURI, nsIURI** _retval)
{ {
PLACES_WARN_DEPRECATED();
NS_ENSURE_ARG(aPageURI); NS_ENSURE_ARG(aPageURI);
NS_ENSURE_ARG_POINTER(_retval); NS_ENSURE_ARG_POINTER(_retval);
@ -866,6 +873,7 @@ nsFaviconService::GetFaviconDataForPage(nsIURI* aPageURI,
NS_IMETHODIMP NS_IMETHODIMP
nsFaviconService::GetFaviconImageForPage(nsIURI* aPageURI, nsIURI** _retval) nsFaviconService::GetFaviconImageForPage(nsIURI* aPageURI, nsIURI** _retval)
{ {
PLACES_WARN_DEPRECATED();
NS_ENSURE_ARG(aPageURI); NS_ENSURE_ARG(aPageURI);
NS_ENSURE_ARG_POINTER(_retval); NS_ENSURE_ARG_POINTER(_retval);

View File

@ -30,6 +30,8 @@ interface nsIFaviconService : nsISupports
* @param aFaviconURI * @param aFaviconURI
* URI of the favicon to associate with the page. * URI of the favicon to associate with the page.
* @throws NS_ERROR_NOT_AVAILABLE if aPageURI doesn't exist in the database. * @throws NS_ERROR_NOT_AVAILABLE if aPageURI doesn't exist in the database.
*
* @deprecated Use mozIAsyncFavicons::setAndFetchFaviconForPage
*/ */
void setFaviconUrlForPage(in nsIURI aPageURI, void setFaviconUrlForPage(in nsIURI aPageURI,
in nsIURI aFaviconURI); in nsIURI aFaviconURI);
@ -75,8 +77,7 @@ interface nsIFaviconService : nsISupports
* Once we're done setting and/or loading the favicon, we invoke this * Once we're done setting and/or loading the favicon, we invoke this
* callback. * callback.
* *
* @deprecated Use the identical function * @deprecated Use mozIAsyncFavicons::setAndFetchFaviconForPage
* mozIAsyncFavicons::setAndFetchFaviconForPage.
*/ */
[deprecated] [deprecated]
void setAndLoadFaviconForPage(in nsIURI aPageURI, void setAndLoadFaviconForPage(in nsIURI aPageURI,
@ -177,6 +178,8 @@ interface nsIFaviconService : nsISupports
* Output parameter where the MIME type will be placed. * Output parameter where the MIME type will be placed.
* @throws NS_ERROR_NOT_AVAILABLE * @throws NS_ERROR_NOT_AVAILABLE
* Thrown when we have never heard of this favicon URI. * Thrown when we have never heard of this favicon URI.
*
* @deprecated Use mozIAsyncFavicons::getFaviconDataForPage
*/ */
void getFaviconData(in nsIURI aFaviconURI, void getFaviconData(in nsIURI aFaviconURI,
out AUTF8String aMimeType, out AUTF8String aMimeType,
@ -194,6 +197,8 @@ interface nsIFaviconService : nsISupports
* null if we have this URL but have no data associated with it. * null if we have this URL but have no data associated with it.
* @throws NS_ERROR_NOT_AVAILABLE * @throws NS_ERROR_NOT_AVAILABLE
* Thrown when we have never heard of this favicon URL. * Thrown when we have never heard of this favicon URL.
*
* @deprecated Use mozIAsyncFavicons::getFaviconDataForPage
*/ */
AString getFaviconDataAsDataURL(in nsIURI aFaviconURI); AString getFaviconDataAsDataURL(in nsIURI aFaviconURI);
@ -207,6 +212,8 @@ interface nsIFaviconService : nsISupports
* that we know what the favicon should be. * that we know what the favicon should be.
* @throws NS_ERROR_NOT_AVAILABLE * @throws NS_ERROR_NOT_AVAILABLE
* When the page is not found or it has no favicon. * When the page is not found or it has no favicon.
*
* @deprecated Use mozIAsyncFavicons::getFaviconURLForPage
*/ */
nsIURI getFaviconForPage(in nsIURI aPageURI); nsIURI getFaviconForPage(in nsIURI aPageURI);
@ -227,6 +234,8 @@ interface nsIFaviconService : nsISupports
* this service. For pages where we don't have a favicon, this will * this service. For pages where we don't have a favicon, this will
* be a chrome URI of the default icon. For chrome URIs, the * be a chrome URI of the default icon. For chrome URIs, the
* output will be the same as the input. * output will be the same as the input.
*
* @deprecated Use mozIAsyncFavicons::getFaviconURLForPage and getFaviconLinkForIcon
*/ */
nsIURI getFaviconImageForPage(in nsIURI aPageURI); nsIURI getFaviconImageForPage(in nsIURI aPageURI);

View File

@ -1317,6 +1317,8 @@ interface nsINavHistoryService : nsISupports
* @return The ID of the created visit. This will be 0 if the URI cannot * @return The ID of the created visit. This will be 0 if the URI cannot
* be added to history (canAddURI = false) or the visit is session * be added to history (canAddURI = false) or the visit is session
* persistent (TRANSITION_EMBED). * persistent (TRANSITION_EMBED).
*
* @deprecated Use mozIAsyncHistory::updatePlaces
*/ */
long long addVisit(in nsIURI aURI, in PRTime aTime, long long addVisit(in nsIURI aURI, in PRTime aTime,
in nsIURI aReferringURI, in long aTransitionType, in nsIURI aReferringURI, in long aTransitionType,

View File

@ -1285,6 +1285,7 @@ nsNavHistory::AddVisit(nsIURI* aURI, PRTime aTime, nsIURI* aReferringURI,
int32_t aTransitionType, bool aIsRedirect, int32_t aTransitionType, bool aIsRedirect,
int64_t aSessionID, int64_t* aVisitID) int64_t aSessionID, int64_t* aVisitID)
{ {
PLACES_WARN_DEPRECATED();
NS_ASSERTION(NS_IsMainThread(), "This can only be called on the main thread"); NS_ASSERTION(NS_IsMainThread(), "This can only be called on the main thread");
NS_ENSURE_ARG(aURI); NS_ENSURE_ARG(aURI);
NS_ENSURE_ARG_POINTER(aVisitID); NS_ENSURE_ARG_POINTER(aVisitID);
@ -3247,6 +3248,7 @@ NS_IMETHODIMP
nsNavHistory::AddURI(nsIURI *aURI, bool aRedirect, nsNavHistory::AddURI(nsIURI *aURI, bool aRedirect,
bool aToplevel, nsIURI *aReferrer) bool aToplevel, nsIURI *aReferrer)
{ {
PLACES_WARN_DEPRECATED();
NS_ASSERTION(NS_IsMainThread(), "This can only be called on the main thread"); NS_ASSERTION(NS_IsMainThread(), "This can only be called on the main thread");
NS_ENSURE_ARG(aURI); NS_ENSURE_ARG(aURI);
@ -3404,6 +3406,7 @@ nsNavHistory::AddVisitChain(nsIURI* aURI,
NS_IMETHODIMP NS_IMETHODIMP
nsNavHistory::IsVisited(nsIURI *aURI, bool *_retval) nsNavHistory::IsVisited(nsIURI *aURI, bool *_retval)
{ {
PLACES_WARN_DEPRECATED();
NS_ASSERTION(NS_IsMainThread(), "This can only be called on the main thread"); NS_ASSERTION(NS_IsMainThread(), "This can only be called on the main thread");
NS_ENSURE_ARG(aURI); NS_ENSURE_ARG(aURI);
NS_ENSURE_ARG_POINTER(_retval); NS_ENSURE_ARG_POINTER(_retval);
@ -3437,6 +3440,7 @@ NS_IMETHODIMP
nsNavHistory::SetPageTitle(nsIURI* aURI, nsNavHistory::SetPageTitle(nsIURI* aURI,
const nsAString& aTitle) const nsAString& aTitle)
{ {
PLACES_WARN_DEPRECATED();
NS_ASSERTION(NS_IsMainThread(), "This can only be called on the main thread"); NS_ASSERTION(NS_IsMainThread(), "This can only be called on the main thread");
NS_ENSURE_ARG(aURI); NS_ENSURE_ARG(aURI);

View File

@ -4,6 +4,12 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "prtypes.h" #include "prtypes.h"
#include "nsIConsoleService.h"
#include "nsIScriptError.h"
#ifndef __FUNCTION__
#define __FUNCTION__ __func__
#endif
// Call a method on each observer in a category cache, then call the same // Call a method on each observer in a category cache, then call the same
// method on the observer array. // method on the observer array.
@ -37,3 +43,19 @@
} \ } \
return _sInstance; \ return _sInstance; \
} }
#define PLACES_WARN_DEPRECATED() \
PR_BEGIN_MACRO \
nsCString msg = NS_LITERAL_CSTRING(__FUNCTION__); \
msg.AppendLiteral(" is deprecated and will be removed in the next version.");\
NS_WARNING(msg.get()); \
nsCOMPtr<nsIConsoleService> cs = do_GetService(NS_CONSOLESERVICE_CONTRACTID);\
if (cs) { \
nsCOMPtr<nsIScriptError> e = do_CreateInstance(NS_SCRIPTERROR_CONTRACTID); \
if (e && NS_SUCCEEDED(e->Init(NS_ConvertUTF8toUTF16(msg), EmptyString(), \
EmptyString(), 0, 0, \
nsIScriptError::errorFlag, "Places"))) { \
cs->LogMessage(e); \
} \
} \
PR_END_MACRO

View File

@ -130,12 +130,18 @@ FrameWorker.prototype = {
'setInterval', 'setTimeout', 'XMLHttpRequest', 'setInterval', 'setTimeout', 'XMLHttpRequest',
'MozBlobBuilder', 'FileReader', 'Blob', 'MozBlobBuilder', 'FileReader', 'Blob',
'location']; 'location'];
// Bug 798660 - XHR and WebSocket have issues in a sandbox and need
// to be unwrapped to work
let needsWaive = ['XMLHttpRequest', 'WebSocket'];
// Methods need to be bound with the proper |this|.
let needsBind = ['atob', 'btoa', 'dump', 'setInterval', 'clearInterval',
'setTimeout', 'clearTimeout'];
workerAPI.forEach(function(fn) { workerAPI.forEach(function(fn) {
try { try {
// Bug 798660 - XHR and WebSocket have issues in a sandbox and need if (needsWaive.indexOf(fn) != -1)
// to be unwrapped to work
if (fn == "XMLHttpRequest" || fn == "WebSocket")
sandbox[fn] = XPCNativeWrapper.unwrap(workerWindow)[fn]; sandbox[fn] = XPCNativeWrapper.unwrap(workerWindow)[fn];
else if (needsBind.indexOf(fn) != -1)
sandbox[fn] = workerWindow[fn].bind(workerWindow);
else else
sandbox[fn] = workerWindow[fn]; sandbox[fn] = workerWindow[fn];
} }

Some files were not shown because too many files have changed in this diff Show More