mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 20:35:50 +00:00
Merge the last PGO-green inbound changeset to m-c.
This commit is contained in:
commit
f0a8ded71f
@ -9,16 +9,11 @@ VPATH = @srcdir@
|
||||
|
||||
LIBRARY_NAME = AccessibleMarshal
|
||||
MODULE = accessibility
|
||||
XPIDL_MODULE = accessibility-msaa
|
||||
GRE_MODULE = 1
|
||||
DEFFILE = $(win_srcdir)/AccessibleMarshal.def
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
XPIDLSRCS = \
|
||||
nsIWinAccessNode.idl \
|
||||
$(NULL)
|
||||
|
||||
DEFINES += -DREGISTER_PROXY_DLL
|
||||
|
||||
GARBAGE += $(MIDL_GENERATED_FILES) done_gen dlldata.c
|
||||
|
@ -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);
|
||||
};
|
||||
|
@ -272,6 +272,16 @@ aria::MapToState(EStateRule aRule, dom::Element* aElement, uint64_t* aState)
|
||||
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:
|
||||
{
|
||||
static const TokenTypeData data(
|
||||
|
@ -39,6 +39,7 @@ enum EStateRule
|
||||
eARIAPressed,
|
||||
eARIAReadonly,
|
||||
eARIAReadonlyOrEditable,
|
||||
eARIAReadonlyOrEditableIfDefined,
|
||||
eARIARequired,
|
||||
eARIASelectable,
|
||||
eReadonlyUntilEditable,
|
||||
|
@ -53,7 +53,7 @@ AccEvent::CreateXPCOMObject()
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// 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_UNROOT_NATIVE(AccEvent, Release)
|
||||
|
@ -178,7 +178,7 @@ static nsRoleMapEntry sWAIRoleMaps[] =
|
||||
eSelect | eTable,
|
||||
states::FOCUSABLE,
|
||||
eARIAMultiSelectable,
|
||||
eARIAReadonly
|
||||
eARIAReadonlyOrEditable
|
||||
},
|
||||
{ // gridcell
|
||||
&nsGkAtoms::gridcell,
|
||||
@ -190,7 +190,7 @@ static nsRoleMapEntry sWAIRoleMaps[] =
|
||||
eTableCell,
|
||||
kNoReqStates,
|
||||
eARIASelectable,
|
||||
eARIAReadonly
|
||||
eARIAReadonlyOrEditableIfDefined
|
||||
},
|
||||
{ // group
|
||||
&nsGkAtoms::group,
|
||||
|
@ -22,6 +22,8 @@
|
||||
#include "RootAccessible.h"
|
||||
#include "States.h"
|
||||
#include "StyleInfo.h"
|
||||
#include "TableAccessible.h"
|
||||
#include "TableCellAccessible.h"
|
||||
#include "TreeWalker.h"
|
||||
|
||||
#include "nsContentUtils.h"
|
||||
@ -1597,6 +1599,22 @@ Accessible::ApplyARIAState(uint64_t* aState) const
|
||||
if (aria::MapToState(mRoleMapEntry->attributeMap1, element, aState) &&
|
||||
aria::MapToState(mRoleMapEntry->attributeMap2, 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
|
||||
|
@ -514,6 +514,8 @@ public:
|
||||
virtual TableAccessible* AsTable() { return nullptr; }
|
||||
|
||||
virtual TableCellAccessible* AsTableCell() { return nullptr; }
|
||||
const TableCellAccessible* AsTableCell() const
|
||||
{ return const_cast<Accessible*>(this)->AsTableCell(); }
|
||||
|
||||
bool IsTableRow() const { return HasGenericType(eTableRow); }
|
||||
|
||||
|
@ -45,18 +45,7 @@ nsAccessNodeWrap::~nsAccessNodeWrap()
|
||||
// nsISupports methods
|
||||
//-----------------------------------------------------
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(nsAccessNodeWrap, nsAccessNode, nsIWinAccessNode)
|
||||
|
||||
//-----------------------------------------------------
|
||||
// nsIWinAccessNode methods
|
||||
//-----------------------------------------------------
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsAccessNodeWrap::QueryNativeInterface(REFIID aIID, void** aInstancePtr)
|
||||
{
|
||||
// XXX Wrong for E_NOINTERFACE
|
||||
return static_cast<nsresult>(QueryInterface(aIID, aInstancePtr));
|
||||
}
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(nsAccessNodeWrap, nsAccessNode)
|
||||
|
||||
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
|
||||
if (guidService == IID_IAccessibleApplication ||
|
||||
(Compatibility::IsJAWS() && iid == IID_IAccessibleApplication)) {
|
||||
ApplicationAccessible* applicationAcc = ApplicationAcc();
|
||||
ApplicationAccessibleWrap* applicationAcc =
|
||||
static_cast<ApplicationAccessibleWrap*>(ApplicationAcc());
|
||||
if (!applicationAcc)
|
||||
return E_NOINTERFACE;
|
||||
|
||||
nsresult rv = applicationAcc->QueryNativeInterface(iid, ppv);
|
||||
return NS_SUCCEEDED(rv) ? S_OK : E_NOINTERFACE;
|
||||
return applicationAcc->QueryInterface(iid, ppv);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIAccessible.h"
|
||||
#include "nsIAccessibleEvent.h"
|
||||
#include "nsIWinAccessNode.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsAccessNode.h"
|
||||
@ -55,12 +54,10 @@ namespace a11y {
|
||||
#endif
|
||||
|
||||
class nsAccessNodeWrap : public nsAccessNode,
|
||||
public nsIWinAccessNode,
|
||||
public IServiceProvider
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIWINACCESSNODE
|
||||
|
||||
public: // construction, destruction
|
||||
nsAccessNodeWrap(nsIContent* aContent, DocAccessible* aDoc);
|
||||
|
@ -43,59 +43,6 @@ nsWinUtils::GetComputedStyleDeclaration(nsIContent* aContent)
|
||||
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
|
||||
nsWinUtils::MaybeStartWindowEmulation()
|
||||
{
|
||||
|
@ -30,13 +30,6 @@ public:
|
||||
static already_AddRefed<nsIDOMCSSStyleDeclaration>
|
||||
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.
|
||||
*/
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "AccessibleHyperlink_i.c"
|
||||
|
||||
#include "AccessibleWrap.h"
|
||||
#include "nsIWinAccessNode.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
|
@ -45,17 +45,12 @@ ia2AccessibleHypertext::get_hyperlink(long aLinkIndex,
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
Accessible* hyperLink = hyperText->GetLinkAt(aLinkIndex);
|
||||
nsCOMPtr<nsIWinAccessNode> winAccessNode(do_QueryObject(hyperLink));
|
||||
if (!winAccessNode)
|
||||
if (!hyperText)
|
||||
return E_FAIL;
|
||||
|
||||
void *instancePtr = NULL;
|
||||
nsresult rv = winAccessNode->QueryNativeInterface(IID_IAccessibleHyperlink,
|
||||
&instancePtr);
|
||||
if (NS_FAILED(rv))
|
||||
return E_FAIL;
|
||||
|
||||
*aHyperlink = static_cast<IAccessibleHyperlink*>(instancePtr);
|
||||
*aHyperlink =
|
||||
static_cast<IAccessibleHyperlink*>(static_cast<AccessibleWrap*>(hyperLink));
|
||||
(*aHyperlink)->AddRef();
|
||||
return S_OK;
|
||||
|
||||
A11Y_TRYBLOCK_END
|
||||
|
@ -163,7 +163,11 @@ ia2AccessibleRelation::get_target(long aTargetIndex, IUnknown **aTarget)
|
||||
if (aTargetIndex < 0 || (uint32_t)aTargetIndex >= mTargets.Length() || !aTarget)
|
||||
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;
|
||||
|
||||
A11Y_TRYBLOCK_END
|
||||
|
@ -110,6 +110,20 @@
|
||||
// aria-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
|
||||
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">
|
||||
Mozilla Bug 762876
|
||||
</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>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
@ -265,7 +284,26 @@
|
||||
<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_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 id="aria_selectable_listitem" role="option" aria-selected="true">Item1</div>
|
||||
</div>
|
||||
@ -313,7 +351,7 @@
|
||||
<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_navigation_link" role="navigation" href="foo">nav</a>
|
||||
|
||||
|
||||
<!-- landmarks: anchors -->
|
||||
<a id="aria_application_anchor" role="application" name="app_anchor">app</a>
|
||||
<a id="aria_main_anchor" role="main" name="main_anchor">main</a>
|
||||
|
@ -129,7 +129,6 @@
|
||||
#ifdef ACCESSIBILITY
|
||||
#ifdef XP_WIN32
|
||||
@BINPATH@/AccessibleMarshal.dll
|
||||
@BINPATH@/components/accessibility-msaa.xpt
|
||||
#endif
|
||||
@BINPATH@/components/accessibility.xpt
|
||||
#endif
|
||||
|
@ -119,10 +119,6 @@ ifeq ($(OS_ARCH),WINNT) #{
|
||||
#
|
||||
ifndef GNU_CC #{
|
||||
LDFLAGS += /HEAP:0x40000
|
||||
ifeq ($(OS_TEST),x86_64) #{
|
||||
# set stack to 2MB on x64 build. See bug 582910
|
||||
LDFLAGS += -STACK:2097152
|
||||
endif #}
|
||||
endif #}
|
||||
endif #}
|
||||
|
||||
|
@ -265,7 +265,6 @@
|
||||
class="social-panel"
|
||||
type="arrow"
|
||||
hidden="true"
|
||||
consumeoutsideclicks="false"
|
||||
noautofocus="true"/>
|
||||
<panel id="social-flyout-panel"
|
||||
class="social-panel"
|
||||
|
@ -139,7 +139,6 @@
|
||||
#ifdef ACCESSIBILITY
|
||||
#ifdef XP_WIN32
|
||||
@BINPATH@/AccessibleMarshal.dll
|
||||
@BINPATH@/components/accessibility-msaa.xpt
|
||||
#endif
|
||||
@BINPATH@/components/accessibility.xpt
|
||||
#endif
|
||||
|
@ -56,13 +56,13 @@ fi
|
||||
CLANG_CC=
|
||||
CLANG_CXX=
|
||||
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
|
||||
fi
|
||||
fi
|
||||
|
||||
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
|
||||
fi
|
||||
fi
|
||||
|
@ -589,6 +589,13 @@ 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
|
||||
# import lib, because that import lib will collide with the name of a
|
||||
# static version of the same library.
|
||||
|
@ -267,6 +267,14 @@ class SectionFinder(object):
|
||||
syms.append((tmp[-1], tmp[0]))
|
||||
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():
|
||||
parser = OptionParser()
|
||||
parser.add_option("--depend", dest="depend", metavar="FILE",
|
||||
@ -302,15 +310,15 @@ def main():
|
||||
args.makelist()
|
||||
|
||||
if options.verbose:
|
||||
print >>sys.stderr, "Executing: " + " ".join(args)
|
||||
for tmp in [f for f in args.tmp if os.path.isfile(f)]:
|
||||
print >>sys.stderr, tmp + ":"
|
||||
with open(tmp) as file:
|
||||
print >>sys.stderr, "".join([" " + l for l in file.readlines()])
|
||||
sys.stderr.flush()
|
||||
ret = subprocess.call(args)
|
||||
if ret:
|
||||
exit(ret)
|
||||
print_command(sys.stderr, args)
|
||||
proc = subprocess.Popen(args, stdout = subprocess.PIPE, stderr = subprocess.STDOUT)
|
||||
(stdout, stderr) = proc.communicate()
|
||||
if proc.returncode and not options.verbose:
|
||||
print_command(sys.stderr, args)
|
||||
sys.stderr.write(stdout)
|
||||
sys.stderr.flush()
|
||||
if proc.returncode:
|
||||
exit(proc.returncode)
|
||||
if not options.depend:
|
||||
return
|
||||
ensureParentDir(options.depend)
|
||||
|
@ -32,8 +32,3 @@ ifneq (,$(filter OS2 WINNT,$(OS_ARCH))) # {
|
||||
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)
|
||||
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)
|
||||
|
@ -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
|
@ -18,7 +18,7 @@ interface nsINode;
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
[scriptable, uuid(12cf5a4d-fffb-4f2f-9cec-c65195661d76)]
|
||||
[scriptable, builtinclass, uuid(12cf5a4d-fffb-4f2f-9cec-c65195661d76)]
|
||||
interface nsISelection : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -31,7 +31,7 @@ struct ScrollAxis;
|
||||
native nsDirection(nsDirection);
|
||||
native ScrollAxis(nsIPresShell::ScrollAxis);
|
||||
|
||||
[scriptable, uuid(2e44b10f-7d6d-4bf4-92e2-f9551d22f422)]
|
||||
[scriptable, builtinclass, uuid(2e44b10f-7d6d-4bf4-92e2-f9551d22f422)]
|
||||
interface nsISelectionPrivate : nsISelection
|
||||
{
|
||||
const short ENDOFPRECEDINGLINE=0;
|
||||
|
@ -6123,15 +6123,15 @@ nsContentUtils::CheckCCWrapperTraversal(void* aScriptObjectHolder,
|
||||
DebugWrapperTraversalCallback callback(wrapper);
|
||||
|
||||
aTracer->Traverse(aScriptObjectHolder, callback);
|
||||
NS_ASSERTION(callback.mFound,
|
||||
"Cycle collection participant didn't traverse to preserved "
|
||||
"wrapper! This will probably crash.");
|
||||
MOZ_ASSERT(callback.mFound,
|
||||
"Cycle collection participant didn't traverse to preserved "
|
||||
"wrapper! This will probably crash.");
|
||||
|
||||
callback.mFound = false;
|
||||
aTracer->Trace(aScriptObjectHolder, DebugWrapperTraceCallback, &callback);
|
||||
NS_ASSERTION(callback.mFound,
|
||||
"Cycle collection participant didn't trace preserved wrapper! "
|
||||
"This will probably crash.");
|
||||
MOZ_ASSERT(callback.mFound,
|
||||
"Cycle collection participant didn't trace preserved wrapper! "
|
||||
"This will probably crash.");
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -34,12 +34,11 @@
|
||||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIEnumerator.h"
|
||||
#include "nsIParserService.h"
|
||||
#include "nsIScriptContext.h"
|
||||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsISelection.h"
|
||||
#include "mozilla/Selection.h"
|
||||
#include "nsISelectionPrivate.h"
|
||||
#include "nsITransferable.h" // for kUnicodeMime
|
||||
#include "nsContentUtils.h"
|
||||
@ -1348,19 +1347,17 @@ nsHTMLCopyEncoder::SetSelection(nsISelection* aSelection)
|
||||
|
||||
nsCOMPtr<nsIDOMRange> range;
|
||||
nsCOMPtr<nsIDOMNode> commonParent;
|
||||
int32_t count = 0;
|
||||
|
||||
nsresult rv = aSelection->GetRangeCount(&count);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
Selection* selection = static_cast<Selection*>(aSelection);
|
||||
uint32_t rangeCount = selection->GetRangeCount();
|
||||
|
||||
// if selection is uninitialized return
|
||||
if (!count)
|
||||
if (!rangeCount)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// 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
|
||||
// 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);
|
||||
if (!range)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
@ -1412,25 +1409,10 @@ nsHTMLCopyEncoder::SetSelection(nsISelection* aSelection)
|
||||
//NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_NewDomSelection(getter_AddRefs(mSelection));
|
||||
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
|
||||
enumerator->First();
|
||||
nsCOMPtr<nsISupports> currentItem;
|
||||
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);
|
||||
for (uint32_t rangeIdx = 0; rangeIdx < rangeCount; ++rangeIdx) {
|
||||
range = selection->GetRangeAt(rangeIdx);
|
||||
NS_ENSURE_TRUE(range, NS_ERROR_FAILURE);
|
||||
nsCOMPtr<nsIDOMRange> myRange;
|
||||
range->CloneRange(getter_AddRefs(myRange));
|
||||
@ -1442,8 +1424,6 @@ nsHTMLCopyEncoder::SetSelection(nsISelection* aSelection)
|
||||
|
||||
rv = mSelection->AddRange(myRange);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
enumerator->Next();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -142,12 +142,13 @@ CPPSRCS = \
|
||||
ifdef MOZ_MEDIA
|
||||
EXPORTS_mozilla/dom += \
|
||||
HTMLSourceElement.h \
|
||||
MediaError.h \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS += \
|
||||
nsHTMLAudioElement.cpp \
|
||||
nsHTMLMediaElement.cpp \
|
||||
nsMediaError.cpp \
|
||||
MediaError.cpp \
|
||||
nsMediaFragmentURIParser.cpp \
|
||||
HTMLSourceElement.cpp \
|
||||
nsTimeRanges.cpp \
|
||||
|
50
content/html/content/src/MediaError.cpp
Normal file
50
content/html/content/src/MediaError.cpp
Normal 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
|
54
content/html/content/src/MediaError.h
Normal file
54
content/html/content/src/MediaError.h
Normal 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
|
@ -38,7 +38,7 @@
|
||||
#include "nsITimer.h"
|
||||
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsMediaError.h"
|
||||
#include "MediaError.h"
|
||||
#include "MediaDecoder.h"
|
||||
#include "nsICategoryManager.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(mLoadBlockedDoc)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSourceLoadCandidate)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mError)
|
||||
for (uint32_t i = 0; i < tmp->mOutputStreams.Length(); ++i) {
|
||||
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(mLoadBlockedDoc)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mSourceLoadCandidate)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mError)
|
||||
for (uint32_t i = 0; i < tmp->mOutputStreams.Length(); ++i) {
|
||||
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?");
|
||||
|
||||
mError = new nsMediaError(nsIDOMMediaError::MEDIA_ERR_SRC_NOT_SUPPORTED);
|
||||
mError = new MediaError(this, nsIDOMMediaError::MEDIA_ERR_SRC_NOT_SUPPORTED);
|
||||
mNetworkState = nsIDOMHTMLMediaElement::NETWORK_NO_SOURCE;
|
||||
DispatchAsyncEvent(NS_LITERAL_STRING("error"));
|
||||
// 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_ABORTED,
|
||||
"Only use nsIDOMMediaError codes!");
|
||||
mError = new nsMediaError(aErrorCode);
|
||||
mError = new MediaError(this, aErrorCode);
|
||||
mBegun = false;
|
||||
DispatchAsyncEvent(NS_LITERAL_STRING("error"));
|
||||
if (mReadyState == nsIDOMHTMLMediaElement::HAVE_NOTHING) {
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsIDOMProgressEvent.h"
|
||||
#include "nsMediaError.h"
|
||||
#include "MediaError.h"
|
||||
#include "MediaDecoder.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
@ -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;
|
||||
}
|
@ -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;
|
||||
};
|
@ -2305,11 +2305,8 @@ int64_t MediaDecoderStateMachine::GetVideoStreamPosition()
|
||||
|
||||
int64_t pos = DurationToUsecs(TimeStamp::Now() - mPlayStartTime) + mPlayDuration;
|
||||
pos -= mBasePosition;
|
||||
if (pos >= 0) {
|
||||
int64_t final = mBasePosition + pos * mPlaybackRate + mStartTime;
|
||||
return final;
|
||||
}
|
||||
return mPlayDuration + mStartTime;
|
||||
NS_ASSERTION(pos >= 0, "Video stream position should be positive.");
|
||||
return mBasePosition + pos * mPlaybackRate + mStartTime;
|
||||
}
|
||||
|
||||
int64_t MediaDecoderStateMachine::GetClock() {
|
||||
@ -2768,12 +2765,14 @@ void MediaDecoderStateMachine::SetPlaybackRate(double aPlaybackRate)
|
||||
// Get position of the last time we changed the rate.
|
||||
if (!HasAudio()) {
|
||||
// mBasePosition is a position in the video stream, not an absolute time.
|
||||
mBasePosition = GetVideoStreamPosition();
|
||||
if (IsPlaying()) {
|
||||
mPlayDuration = mBasePosition - mStartTime;
|
||||
mResetPlayStartTime = true;
|
||||
mPlayStartTime = TimeStamp::Now();
|
||||
if (mState == DECODER_STATE_SEEKING) {
|
||||
mBasePosition = mSeekTime;
|
||||
} else {
|
||||
mBasePosition = GetVideoStreamPosition();
|
||||
}
|
||||
mPlayDuration = mBasePosition - mStartTime;
|
||||
mResetPlayStartTime = true;
|
||||
mPlayStartTime = TimeStamp::Now();
|
||||
}
|
||||
|
||||
mPlaybackRate = aPlaybackRate;
|
||||
|
@ -235,9 +235,6 @@ this.AppsUtils = {
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure that non-updatable fields contains the current app value
|
||||
AppsUtils.normalizeManifest(aManifest, app);
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
@ -257,33 +254,24 @@ this.AppsUtils = {
|
||||
* Method to apply modifications to webapp manifests file saved internally.
|
||||
* For now, only ensure app can't rename itself.
|
||||
*/
|
||||
normalizeManifest: function normalizeManifest(aManifest, 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;
|
||||
|
||||
ensureSameAppName: function ensureSameAppName(aOldManifest, aNewManifest, aApp) {
|
||||
// Ensure that app name can't be updated
|
||||
aManifest.name = aApp.name;
|
||||
aNewManifest.name = aApp.name;
|
||||
|
||||
// Nor through localized names
|
||||
if ('locales' in aManifest) {
|
||||
let defaultName = new ManifestHelper(aManifest, aApp.origin).name;
|
||||
for (let locale in aManifest.locales) {
|
||||
let entry = aManifest.locales[locale];
|
||||
if ('locales' in aNewManifest) {
|
||||
let defaultName = new ManifestHelper(aOldManifest, aApp.origin).name;
|
||||
for (let locale in aNewManifest.locales) {
|
||||
let entry = aNewManifest.locales[locale];
|
||||
if (!entry.name) {
|
||||
continue;
|
||||
}
|
||||
// In case previous manifest didn't had a name,
|
||||
// we use the default app name
|
||||
let localizedName = defaultName;
|
||||
if (previousManifest && 'locales' in previousManifest &&
|
||||
locale in previousManifest.locales) {
|
||||
localizedName = previousManifest.locales[locale].name;
|
||||
if (aOldManifest && 'locales' in aOldManifest &&
|
||||
locale in aOldManifest.locales) {
|
||||
localizedName = aOldManifest.locales[locale].name;
|
||||
}
|
||||
entry.name = localizedName;
|
||||
}
|
||||
|
@ -393,6 +393,7 @@ WebappsApplication.prototype = {
|
||||
this.initHelper(aWindow, ["Webapps:OfflineCache",
|
||||
"Webapps:CheckForUpdate:Return:OK",
|
||||
"Webapps:CheckForUpdate:Return:KO",
|
||||
"Webapps:Launch:Return:KO",
|
||||
"Webapps:PackageEvent"]);
|
||||
|
||||
cpmm.sendAsyncMessage("Webapps:RegisterForMessages",
|
||||
|
@ -1482,20 +1482,8 @@ this.DOMApplicationRegistry = {
|
||||
return;
|
||||
}
|
||||
|
||||
// Try to download a new manifest.
|
||||
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);
|
||||
|
||||
xhr.addEventListener("load", (function() {
|
||||
// On xhr load request event
|
||||
function onload(xhr, oldManifest) {
|
||||
debug("Got http status=" + xhr.status + " for " + aData.manifestURL);
|
||||
let oldHash = app.manifestHash;
|
||||
let isPackage = app.origin.startsWith("app://");
|
||||
@ -1514,6 +1502,8 @@ this.DOMApplicationRegistry = {
|
||||
sendError("INSTALL_FROM_DENIED");
|
||||
return;
|
||||
} else {
|
||||
AppsUtils.ensureSameAppName(oldManifest, manifest, app);
|
||||
|
||||
let hash = this.computeManifestHash(manifest);
|
||||
debug("Manifest hash = " + hash);
|
||||
if (isPackage) {
|
||||
@ -1543,12 +1533,10 @@ this.DOMApplicationRegistry = {
|
||||
this._saveApps();
|
||||
}
|
||||
} else {
|
||||
this._readManifests([{ id: id }], (function(aResult) {
|
||||
// Update only the appcache if the manifest has not changed
|
||||
// based on the hash value.
|
||||
updateHostedApp.call(this, aResult[0].manifest,
|
||||
oldHash == hash ? null : manifest);
|
||||
}).bind(this));
|
||||
// Update only the appcache if the manifest has not changed
|
||||
// based on the hash value.
|
||||
updateHostedApp.call(this, oldManifest,
|
||||
oldHash == hash ? null : manifest);
|
||||
}
|
||||
}
|
||||
} else if (xhr.status == 304) {
|
||||
@ -1567,21 +1555,40 @@ this.DOMApplicationRegistry = {
|
||||
} else {
|
||||
// For hosted apps, even if the manifest has not changed, we check
|
||||
// for offline cache updates.
|
||||
this._readManifests([{ id: id }], (function(aResult) {
|
||||
updateHostedApp.call(this, aResult[0].manifest, null);
|
||||
}).bind(this));
|
||||
updateHostedApp.call(this, oldManifest, null);
|
||||
}
|
||||
} else {
|
||||
sendError("MANIFEST_URL_ERROR");
|
||||
}
|
||||
}).bind(this), false);
|
||||
}
|
||||
|
||||
xhr.addEventListener("error", (function() {
|
||||
sendError("NETWORK_ERROR");
|
||||
}).bind(this), false);
|
||||
// Try to download a new manifest.
|
||||
function doRequest(oldManifest) {
|
||||
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.send(null);
|
||||
xhr.addEventListener("load", onload.bind(this, xhr, oldManifest), false);
|
||||
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.
|
||||
@ -2305,13 +2312,14 @@ this.DOMApplicationRegistry = {
|
||||
let manifest = JSON.parse(converter.ConvertToUnicode(NetUtil.readInputStreamToString(istream,
|
||||
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)) {
|
||||
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,
|
||||
aManifest._manifest)) {
|
||||
throw "MANIFEST_MISMATCH";
|
||||
|
@ -601,6 +601,10 @@ DOMInterfaces = {
|
||||
'register': False
|
||||
},
|
||||
|
||||
'MediaError': {
|
||||
'hasInstanceInterface': 'nsIDOMMediaError',
|
||||
},
|
||||
|
||||
'MediaStream': [{
|
||||
'nativeType': 'nsIDOMMediaStream',
|
||||
},
|
||||
|
@ -144,6 +144,8 @@ static nsAutoPtr<RawDBusConnection> gThreadConnection;
|
||||
static nsDataHashtable<nsStringHashKey, DBusMessage* > sPairingReqTable;
|
||||
static nsDataHashtable<nsStringHashKey, DBusMessage* > sAuthorizeReqTable;
|
||||
static PRInt32 sIsPairing = 0;
|
||||
static nsString sAdapterPath;
|
||||
|
||||
typedef void (*UnpackFunc)(DBusMessage*, DBusError*, BluetoothValue&, nsAString&);
|
||||
|
||||
class RemoveDeviceTask : public nsRunnable {
|
||||
@ -780,6 +782,22 @@ BluetoothDBusService::AddReservedServicesInternal(const nsAString& aAdapterPath,
|
||||
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
|
||||
{
|
||||
public:
|
||||
@ -1653,7 +1671,10 @@ BluetoothDBusService::StopInternal()
|
||||
// This could block. It should never be run on the main thread.
|
||||
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) {
|
||||
StopDBus();
|
||||
@ -2409,6 +2430,9 @@ BluetoothDBusService::PrepareAdapterInternal(const nsAString& aPath)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// Keep the adapter path for further use
|
||||
sAdapterPath = aPath;
|
||||
|
||||
nsRefPtr<nsRunnable> func(new PrepareAdapterRunnable(aPath));
|
||||
if (NS_FAILED(mBluetoothCommandThread->Dispatch(func, NS_DISPATCH_NORMAL))) {
|
||||
NS_WARNING("Cannot dispatch task!");
|
||||
|
@ -167,6 +167,8 @@ private:
|
||||
nsresult SendSetPropertyMessage(const nsString& aPath, const char* aInterface,
|
||||
const BluetoothNamedValue& aValue,
|
||||
BluetoothReplyRunnable* aRunnable);
|
||||
|
||||
void DisconnectAllAcls(const nsAString& aAdapterPath);
|
||||
};
|
||||
|
||||
END_BLUETOOTH_NAMESPACE
|
||||
|
@ -32,6 +32,7 @@ MOCHITEST_FILES = \
|
||||
test_peerConnection_bug827843.html \
|
||||
test_peerConnection_bug825703.html \
|
||||
test_peerConnection_bug834153.html \
|
||||
test_peerConnection_bug840344.html \
|
||||
head.js \
|
||||
mediaStreamPlayback.js \
|
||||
pc.js \
|
||||
|
129
dom/media/tests/mochitest/test_peerConnection_bug840344.html
Normal file
129
dom/media/tests/mochitest/test_peerConnection_bug840344.html
Normal 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>
|
@ -39,7 +39,7 @@ function test() {
|
||||
let sandbox = new Cu.Sandbox(workerWindow);
|
||||
// inject some functions from the window into the sandbox.
|
||||
// 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");
|
||||
Cu.evalInSandbox(sandboxCode, sandbox, "1.8");
|
||||
}, true);
|
||||
|
22
dom/webidl/MediaError.webidl
Normal file
22
dom/webidl/MediaError.webidl
Normal 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;
|
||||
};
|
@ -223,6 +223,7 @@ endif
|
||||
ifdef MOZ_MEDIA
|
||||
webidl_files += \
|
||||
HTMLSourceElement.webidl \
|
||||
MediaError.webidl \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
|
@ -72,7 +72,6 @@
|
||||
#include "nsIEditActionListener.h" // for nsIEditActionListener
|
||||
#include "nsIEditorObserver.h" // for nsIEditorObserver
|
||||
#include "nsIEditorSpellCheck.h" // for nsIEditorSpellCheck
|
||||
#include "nsIEnumerator.h" // for nsIEnumerator, etc
|
||||
#include "nsIFrame.h" // for nsIFrame
|
||||
#include "nsIInlineSpellChecker.h" // for nsIInlineSpellChecker, etc
|
||||
#include "nsIMEStateManager.h" // for nsIMEStateManager
|
||||
@ -3892,21 +3891,13 @@ nsEditor::GetStartNodeAndOffset(nsISelection *aSelection,
|
||||
*outStartNode = nullptr;
|
||||
*outStartOffset = 0;
|
||||
|
||||
nsCOMPtr<nsISelectionPrivate>selPrivate(do_QueryInterface(aSelection));
|
||||
nsCOMPtr<nsIEnumerator> enumerator;
|
||||
nsresult result = selPrivate->GetEnumerator(getter_AddRefs(enumerator));
|
||||
NS_ENSURE_SUCCESS(result, result);
|
||||
NS_ENSURE_TRUE(enumerator, NS_ERROR_FAILURE);
|
||||
Selection* selection = static_cast<Selection*>(aSelection);
|
||||
NS_ENSURE_TRUE(selection->GetRangeCount(), NS_ERROR_FAILURE);
|
||||
|
||||
enumerator->First();
|
||||
nsCOMPtr<nsISupports> currentItem;
|
||||
result = enumerator->CurrentItem(getter_AddRefs(currentItem));
|
||||
NS_ENSURE_SUCCESS(result, result);
|
||||
|
||||
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
|
||||
nsRange* range = selection->GetRangeAt(0);
|
||||
NS_ENSURE_TRUE(range, NS_ERROR_FAILURE);
|
||||
|
||||
result = range->GetStartContainer(outStartNode);
|
||||
nsresult result = range->GetStartContainer(outStartNode);
|
||||
NS_ENSURE_SUCCESS(result, result);
|
||||
|
||||
result = range->GetStartOffset(outStartOffset);
|
||||
@ -3928,18 +3919,11 @@ nsEditor::GetEndNodeAndOffset(nsISelection *aSelection,
|
||||
|
||||
*outEndNode = nullptr;
|
||||
|
||||
nsCOMPtr<nsISelectionPrivate>selPrivate(do_QueryInterface(aSelection));
|
||||
nsCOMPtr<nsIEnumerator> enumerator;
|
||||
nsresult result = selPrivate->GetEnumerator(getter_AddRefs(enumerator));
|
||||
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;
|
||||
Selection* selection = static_cast<Selection*>(aSelection);
|
||||
NS_ENSURE_TRUE(selection, NS_ERROR_FAILURE);
|
||||
NS_ENSURE_TRUE(selection->GetRangeCount(), NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
|
||||
nsRange* range = selection->GetRangeAt(0);
|
||||
NS_ENSURE_TRUE(range, NS_ERROR_FAILURE);
|
||||
|
||||
if (NS_FAILED(range->GetEndContainer(outEndNode)))
|
||||
|
@ -38,7 +38,6 @@
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIDOMRange.h"
|
||||
#include "nsIDOMText.h"
|
||||
#include "nsIEnumerator.h"
|
||||
#include "nsIHTMLAbsPosEditor.h"
|
||||
#include "nsIHTMLDocument.h"
|
||||
#include "nsINode.h"
|
||||
@ -2306,22 +2305,13 @@ nsHTMLEditRules::WillDeleteSelection(Selection* aSelection,
|
||||
|
||||
// else blocks not same type, or not siblings. Delete everything except
|
||||
// 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;
|
||||
|
||||
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);
|
||||
uint32_t rangeCount = aSelection->GetRangeCount();
|
||||
for (uint32_t rangeIdx = 0; rangeIdx < rangeCount; ++rangeIdx) {
|
||||
nsRefPtr<nsRange> range = aSelection->GetRangeAt(rangeIdx);
|
||||
|
||||
// build a list of nodes in the range
|
||||
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
|
||||
nsCOMArray<nsIDOMNode> arrayOfNodes;
|
||||
nsTrivialFunctor functor;
|
||||
nsDOMSubtreeIterator iter;
|
||||
@ -5776,25 +5766,15 @@ nsHTMLEditRules::GetListActionNodes(nsCOMArray<nsIDOMNode> &outArrayOfNodes,
|
||||
nsCOMPtr<nsISelection>selection;
|
||||
res = mHTMLEditor->GetSelection(getter_AddRefs(selection));
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
nsCOMPtr<nsISelectionPrivate> selPriv(do_QueryInterface(selection));
|
||||
NS_ENSURE_TRUE(selPriv, NS_ERROR_FAILURE);
|
||||
Selection* sel = static_cast<Selection*>(selection.get());
|
||||
NS_ENSURE_TRUE(sel, NS_ERROR_FAILURE);
|
||||
// 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.
|
||||
if (aEntireList)
|
||||
{
|
||||
nsCOMPtr<nsIEnumerator> enumerator;
|
||||
res = selPriv->GetEnumerator(getter_AddRefs(enumerator));
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
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) );
|
||||
uint32_t rangeCount = sel->GetRangeCount();
|
||||
for (uint32_t rangeIdx = 0; rangeIdx < rangeCount; ++rangeIdx) {
|
||||
nsRefPtr<nsRange> range = sel->GetRangeAt(rangeIdx);
|
||||
nsCOMPtr<nsIDOMNode> commonParent, parent, tmp;
|
||||
range->GetCommonAncestorContainer(getter_AddRefs(commonParent));
|
||||
if (commonParent)
|
||||
@ -7797,21 +7777,11 @@ nsHTMLEditRules::SelectionEndpointInNode(nsINode* aNode, bool* aResult)
|
||||
nsCOMPtr<nsISelection>selection;
|
||||
nsresult res = mHTMLEditor->GetSelection(getter_AddRefs(selection));
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
nsCOMPtr<nsISelectionPrivate>selPriv(do_QueryInterface(selection));
|
||||
|
||||
nsCOMPtr<nsIEnumerator> enumerator;
|
||||
res = selPriv->GetEnumerator(getter_AddRefs(enumerator));
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
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) );
|
||||
Selection* sel = static_cast<Selection*>(selection.get());
|
||||
uint32_t rangeCount = sel->GetRangeCount();
|
||||
for (uint32_t rangeIdx = 0; rangeIdx < rangeCount; ++rangeIdx) {
|
||||
nsRefPtr<nsRange> range = sel->GetRangeAt(rangeIdx);
|
||||
nsCOMPtr<nsIDOMNode> startParent, endParent;
|
||||
range->GetStartContainer(getter_AddRefs(startParent));
|
||||
if (startParent)
|
||||
|
@ -37,7 +37,6 @@
|
||||
#include "nsCSSStyleSheet.h"
|
||||
#include "nsIDOMStyleSheet.h"
|
||||
|
||||
#include "nsIEnumerator.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIContentIterator.h"
|
||||
#include "nsIDOMRange.h"
|
||||
@ -2388,7 +2387,7 @@ nsHTMLEditor::GetSelectedElement(const nsAString& aTagName, nsIDOMElement** aRet
|
||||
nsresult res = GetSelection(getter_AddRefs(selection));
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
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 isCollapsed = selection->Collapsed();
|
||||
@ -2453,7 +2452,7 @@ nsHTMLEditor::GetSelectedElement(const nsAString& aTagName, nsIDOMElement** aRet
|
||||
int32_t anchorOffset = -1;
|
||||
if (anchorNode)
|
||||
selection->GetAnchorOffset(&anchorOffset);
|
||||
|
||||
|
||||
nsCOMPtr<nsIDOMNode> focusNode;
|
||||
res = selection->GetFocusNode(getter_AddRefs(focusNode));
|
||||
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
|
||||
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;
|
||||
res = GetElementOrParentByTagName(NS_LITERAL_STRING("href"), anchorNode, getter_AddRefs(parentLinkOfAnchor));
|
||||
// XXX: ERROR_HANDLING can parentLinkOfAnchor be null?
|
||||
@ -2493,7 +2479,7 @@ nsHTMLEditor::GetSelectedElement(const nsAString& aTagName, nsIDOMElement** aRet
|
||||
if (NS_SUCCEEDED(res) && parentLinkOfFocus == parentLinkOfAnchor)
|
||||
bNodeFound = true;
|
||||
}
|
||||
|
||||
|
||||
// We found a link node parent
|
||||
if (bNodeFound) {
|
||||
// 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
|
||||
{
|
||||
nsCOMPtr<nsIEnumerator> enumerator;
|
||||
res = selPriv->GetEnumerator(getter_AddRefs(enumerator));
|
||||
if (NS_SUCCEEDED(res))
|
||||
{
|
||||
if(!enumerator)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
nsRefPtr<nsRange> currange = sel->GetRangeAt(0);
|
||||
if (currange) {
|
||||
nsCOMPtr<nsIContentIterator> iter =
|
||||
do_CreateInstance("@mozilla.org/content/post-content-iterator;1", &res);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
|
||||
enumerator->First();
|
||||
nsCOMPtr<nsISupports> currentItem;
|
||||
res = enumerator->CurrentItem(getter_AddRefs(currentItem));
|
||||
if ((NS_SUCCEEDED(res)) && currentItem)
|
||||
iter->Init(currange);
|
||||
// loop through the content iterator for each content node
|
||||
while (!iter->IsDone())
|
||||
{
|
||||
nsCOMPtr<nsIDOMRange> currange( do_QueryInterface(currentItem) );
|
||||
nsCOMPtr<nsIContentIterator> iter =
|
||||
do_CreateInstance("@mozilla.org/content/post-content-iterator;1", &res);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
|
||||
iter->Init(currange);
|
||||
// loop through the content iterator for each content node
|
||||
while (!iter->IsDone())
|
||||
// Query interface to cast nsIContent to nsIDOMNode
|
||||
// then get tagType to compare to aTagName
|
||||
// Clone node of each desired type and append it to the aDomFrag
|
||||
selectedElement = do_QueryInterface(iter->GetCurrentNode());
|
||||
if (selectedElement)
|
||||
{
|
||||
// Query interface to cast nsIContent to nsIDOMNode
|
||||
// then get tagType to compare to aTagName
|
||||
// Clone node of each desired type and append it to the aDomFrag
|
||||
selectedElement = do_QueryInterface(iter->GetCurrentNode());
|
||||
if (selectedElement)
|
||||
// If we already found a node, then we have another element,
|
||||
// thus there's not just one element selected
|
||||
if (bNodeFound)
|
||||
{
|
||||
// If we already found a node, then we have another element,
|
||||
// thus there's not just one element selected
|
||||
if (bNodeFound)
|
||||
{
|
||||
bNodeFound = false;
|
||||
break;
|
||||
}
|
||||
|
||||
selectedElement->GetNodeName(domTagName);
|
||||
ToLowerCase(domTagName);
|
||||
|
||||
if (anyTag)
|
||||
{
|
||||
// Get name of first selected element
|
||||
selectedElement->GetTagName(TagName);
|
||||
ToLowerCase(TagName);
|
||||
anyTag = false;
|
||||
}
|
||||
|
||||
// The "A" tag is a pain,
|
||||
// used for both link(href is set) and "Named Anchor"
|
||||
nsCOMPtr<nsIDOMNode> selectedNode = do_QueryInterface(selectedElement);
|
||||
if ( (isLinkTag && nsHTMLEditUtils::IsLink(selectedNode)) ||
|
||||
(isNamedAnchorTag && nsHTMLEditUtils::IsNamedAnchor(selectedNode)) )
|
||||
{
|
||||
bNodeFound = true;
|
||||
} else if (TagName == domTagName) { // All other tag names are handled here
|
||||
bNodeFound = true;
|
||||
}
|
||||
if (!bNodeFound)
|
||||
{
|
||||
// Check if node we have is really part of the selection???
|
||||
break;
|
||||
}
|
||||
bNodeFound = false;
|
||||
break;
|
||||
}
|
||||
|
||||
selectedElement->GetNodeName(domTagName);
|
||||
ToLowerCase(domTagName);
|
||||
|
||||
if (anyTag)
|
||||
{
|
||||
// Get name of first selected element
|
||||
selectedElement->GetTagName(TagName);
|
||||
ToLowerCase(TagName);
|
||||
anyTag = false;
|
||||
}
|
||||
|
||||
// The "A" tag is a pain,
|
||||
// used for both link(href is set) and "Named Anchor"
|
||||
nsCOMPtr<nsIDOMNode> selectedNode = do_QueryInterface(selectedElement);
|
||||
if ( (isLinkTag && nsHTMLEditUtils::IsLink(selectedNode)) ||
|
||||
(isNamedAnchorTag && nsHTMLEditUtils::IsNamedAnchor(selectedNode)) )
|
||||
{
|
||||
bNodeFound = true;
|
||||
} else if (TagName == domTagName) { // All other tag names are handled here
|
||||
bNodeFound = true;
|
||||
}
|
||||
if (!bNodeFound)
|
||||
{
|
||||
// Check if node we have is really part of the selection???
|
||||
break;
|
||||
}
|
||||
iter->Next();
|
||||
}
|
||||
} else {
|
||||
// Should never get here?
|
||||
isCollapsed = true;
|
||||
printf("isCollapsed was FALSE, but no elements found in selection\n");
|
||||
iter->Next();
|
||||
}
|
||||
} 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);
|
||||
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
|
||||
enumerator->First();
|
||||
nsCOMPtr<nsISupports> currentItem;
|
||||
nsAutoString bgcolor; bgcolor.AssignLiteral("bgcolor");
|
||||
nsCOMPtr<nsIDOMNode> cachedBlockParent = nullptr;
|
||||
while (static_cast<nsresult>(NS_ENUMERATOR_FALSE) == enumerator->IsDone()) {
|
||||
res = enumerator->CurrentItem(getter_AddRefs(currentItem));
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
NS_ENSURE_TRUE(currentItem, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
|
||||
uint32_t rangeCount = selection->GetRangeCount();
|
||||
for (uint32_t rangeIdx = 0; rangeIdx < rangeCount; ++rangeIdx) {
|
||||
nsCOMPtr<nsIDOMNode> cachedBlockParent = nullptr;
|
||||
nsRefPtr<nsRange> range = selection->GetRangeAt(rangeIdx);
|
||||
NS_ENSURE_TRUE(range, NS_ERROR_FAILURE);
|
||||
|
||||
// check for easy case: both range endpoints in same text node
|
||||
nsCOMPtr<nsIDOMNode> startNode, endNode;
|
||||
@ -4854,7 +4816,6 @@ nsHTMLEditor::SetCSSBackgroundColor(const nsAString& aColor)
|
||||
}
|
||||
}
|
||||
}
|
||||
enumerator->Next();
|
||||
}
|
||||
}
|
||||
if (!cancel)
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include "nsIDOMRange.h"
|
||||
#include "nsIEditor.h"
|
||||
#include "nsIEditorIMESupport.h"
|
||||
#include "nsIEnumerator.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsINode.h"
|
||||
#include "nsISelection.h"
|
||||
@ -144,22 +143,10 @@ nsHTMLEditor::SetInlineProperty(nsIAtom *aProperty,
|
||||
nsresult res = mRules->WillDoAction(selection, &ruleInfo, &cancel, &handled);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
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
|
||||
nsCOMPtr<nsISupports> currentItem;
|
||||
for (enumerator->First();
|
||||
static_cast<nsresult>(NS_ENUMERATOR_FALSE) == enumerator->IsDone();
|
||||
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));
|
||||
uint32_t rangeCount = selection->GetRangeCount();
|
||||
for (uint32_t rangeIdx = 0; rangeIdx < rangeCount; ++rangeIdx) {
|
||||
nsRefPtr<nsRange> range = selection->GetRangeAt(rangeIdx);
|
||||
|
||||
// adjust range to include any ancestors whose children are entirely
|
||||
// selected
|
||||
@ -1115,23 +1102,15 @@ nsHTMLEditor::GetInlinePropertyBase(nsIAtom *aProperty,
|
||||
result = GetSelection(getter_AddRefs(selection));
|
||||
NS_ENSURE_SUCCESS(result, result);
|
||||
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();
|
||||
nsCOMPtr<nsIDOMNode> collapsedNode;
|
||||
nsCOMPtr<nsIEnumerator> enumerator;
|
||||
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));
|
||||
nsRefPtr<nsRange> range = sel->GetRangeAt(0);
|
||||
// XXX: should be a while loop, to get each separate range
|
||||
// XXX: ERROR_HANDLING can currentItem be null?
|
||||
if (NS_SUCCEEDED(result) && currentItem) {
|
||||
if (range) {
|
||||
bool firstNodeInRange = true; // for each range, set a flag
|
||||
nsCOMPtr<nsIDOMRange> range(do_QueryInterface(currentItem));
|
||||
|
||||
if (isCollapsed) {
|
||||
range->GetStartContainer(getter_AddRefs(collapsedNode));
|
||||
@ -1379,22 +1358,10 @@ nsresult nsHTMLEditor::RemoveInlinePropertyImpl(nsIAtom *aProperty, const nsAStr
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
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
|
||||
enumerator->First();
|
||||
nsCOMPtr<nsISupports> currentItem;
|
||||
while (static_cast<nsresult>(NS_ENUMERATOR_FALSE) == enumerator->IsDone()) {
|
||||
res = enumerator->CurrentItem(getter_AddRefs(currentItem));
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
NS_ENSURE_TRUE(currentItem, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
|
||||
|
||||
uint32_t rangeCount = selection->GetRangeCount();
|
||||
for (uint32_t rangeIdx = 0; rangeIdx < rangeCount; ++rangeIdx) {
|
||||
nsRefPtr<nsRange> range = selection->GetRangeAt(rangeIdx);
|
||||
if (aProperty == nsEditProperty::name)
|
||||
{
|
||||
// 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();
|
||||
}
|
||||
enumerator->Next();
|
||||
}
|
||||
}
|
||||
if (!cancel)
|
||||
@ -1566,24 +1532,13 @@ nsHTMLEditor::RelativeFontChange( int32_t aSizeChange)
|
||||
nsAutoSelectionReset selectionResetter(selection, 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
|
||||
enumerator->First();
|
||||
nsCOMPtr<nsISupports> currentItem;
|
||||
while (static_cast<nsresult>(NS_ENUMERATOR_FALSE) == enumerator->IsDone()) {
|
||||
res = enumerator->CurrentItem(getter_AddRefs(currentItem));
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
NS_ENSURE_TRUE(currentItem, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIDOMRange> range( do_QueryInterface(currentItem) );
|
||||
uint32_t rangeCount = selection->GetRangeCount();
|
||||
for (uint32_t rangeIdx = 0; rangeIdx < rangeCount; ++rangeIdx) {
|
||||
nsRefPtr<nsRange> range = selection->GetRangeAt(rangeIdx);
|
||||
|
||||
// adjust range to include any ancestors who's children are entirely selected
|
||||
res = PromoteInlineRange(range);
|
||||
nsresult res = PromoteInlineRange(range);
|
||||
NS_ENSURE_SUCCESS(res, res);
|
||||
|
||||
// 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);
|
||||
}
|
||||
}
|
||||
enumerator->Next();
|
||||
}
|
||||
|
||||
return res;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -76,10 +76,6 @@ include $(topsrcdir)/config/rules.mk
|
||||
#
|
||||
ifndef GNU_CC
|
||||
LDFLAGS += /HEAP:0x40000
|
||||
ifeq ($(OS_TEST),x86_64)
|
||||
# set stack to 2MB on x64 build. See bug 582910
|
||||
LDFLAGS += -STACK:2097152
|
||||
endif
|
||||
endif
|
||||
|
||||
# Get rid of console window
|
||||
|
@ -77,10 +77,6 @@ ifeq ($(OS_ARCH),WINNT) #{
|
||||
#
|
||||
ifndef GNU_CC #{
|
||||
LDFLAGS += /HEAP:0x40000
|
||||
ifeq ($(OS_TEST),x86_64) #{
|
||||
# set stack to 2MB on x64 build. See bug 582910
|
||||
LDFLAGS += -STACK:2097152
|
||||
endif #}
|
||||
endif #}
|
||||
endif #}
|
||||
|
||||
|
@ -510,7 +510,7 @@ public:
|
||||
|
||||
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)
|
||||
@ -1157,25 +1157,26 @@ public:
|
||||
|
||||
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);
|
||||
m_assembler.floatTransfer(true, dest, address.base, address.offset);
|
||||
m_assembler.vcvt(m_assembler.FloatReg32, m_assembler.FloatReg64, (FPRegisterID)(dest*2), dest);
|
||||
// as long as this is a sane mapping, (*2) should just work
|
||||
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)
|
||||
{
|
||||
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.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)
|
||||
{
|
||||
FPRegisterID dest_s = floatShadow(dest);
|
||||
DataLabelPtr label = moveWithPatch(ImmPtr(address), ARMRegisters::S0);
|
||||
m_assembler.fmem_imm_off(true, false, true, (FPRegisterID)(dest*2), ARMRegisters::S0, 0);
|
||||
m_assembler.vcvt(m_assembler.FloatReg32, m_assembler.FloatReg64, (FPRegisterID)(dest*2), dest);
|
||||
m_assembler.fmem_imm_off(true, false, true, dest_s, ARMRegisters::S0, 0);
|
||||
m_assembler.vcvt(m_assembler.FloatReg32, m_assembler.FloatReg64, dest_s, dest);
|
||||
return label;
|
||||
}
|
||||
|
||||
@ -1208,14 +1209,16 @@ public:
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
m_assembler.baseIndexFloatTransfer(false, false, src,
|
||||
m_assembler.baseIndexFloatTransfer(false, false, floatShadow(src),
|
||||
address.base, address.index,
|
||||
address.scale, address.offset);
|
||||
}
|
||||
@ -1329,7 +1332,7 @@ public:
|
||||
|
||||
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)
|
||||
|
@ -56,13 +56,13 @@ fi
|
||||
CLANG_CC=
|
||||
CLANG_CXX=
|
||||
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
|
||||
fi
|
||||
fi
|
||||
|
||||
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
|
||||
fi
|
||||
fi
|
||||
|
@ -589,6 +589,13 @@ 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
|
||||
# import lib, because that import lib will collide with the name of a
|
||||
# static version of the same library.
|
||||
|
@ -267,6 +267,14 @@ class SectionFinder(object):
|
||||
syms.append((tmp[-1], tmp[0]))
|
||||
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():
|
||||
parser = OptionParser()
|
||||
parser.add_option("--depend", dest="depend", metavar="FILE",
|
||||
@ -302,15 +310,15 @@ def main():
|
||||
args.makelist()
|
||||
|
||||
if options.verbose:
|
||||
print >>sys.stderr, "Executing: " + " ".join(args)
|
||||
for tmp in [f for f in args.tmp if os.path.isfile(f)]:
|
||||
print >>sys.stderr, tmp + ":"
|
||||
with open(tmp) as file:
|
||||
print >>sys.stderr, "".join([" " + l for l in file.readlines()])
|
||||
sys.stderr.flush()
|
||||
ret = subprocess.call(args)
|
||||
if ret:
|
||||
exit(ret)
|
||||
print_command(sys.stderr, args)
|
||||
proc = subprocess.Popen(args, stdout = subprocess.PIPE, stderr = subprocess.STDOUT)
|
||||
(stdout, stderr) = proc.communicate()
|
||||
if proc.returncode and not options.verbose:
|
||||
print_command(sys.stderr, args)
|
||||
sys.stderr.write(stdout)
|
||||
sys.stderr.flush()
|
||||
if proc.returncode:
|
||||
exit(proc.returncode)
|
||||
if not options.depend:
|
||||
return
|
||||
ensureParentDir(options.depend)
|
||||
|
@ -2091,7 +2091,7 @@ arm*-*)
|
||||
ENABLE_ION=1
|
||||
ENABLE_MONOIC=1
|
||||
ENABLE_POLYIC=1
|
||||
ENABLE_POLYIC_TYPED_ARRAY=1
|
||||
ENABLE_METHODJIT_TYPED_ARRAY=1
|
||||
AC_DEFINE(JS_CPU_ARM)
|
||||
AC_DEFINE(JS_NUNBOX32)
|
||||
;;
|
||||
|
@ -494,7 +494,7 @@ ion::RecompileForInlining()
|
||||
return BAILOUT_RETURN_FATAL_ERROR;
|
||||
|
||||
// Invalidation should not reset the use count.
|
||||
JS_ASSERT(script->getUseCount() >= js_IonOptions.usesBeforeInlining);
|
||||
JS_ASSERT(script->getUseCount() >= js_IonOptions.usesBeforeInlining());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -99,10 +99,10 @@ struct IonOptions
|
||||
uint32_t usesBeforeCompileNoJaeger;
|
||||
|
||||
// How many invocations or loop iterations are needed before calls
|
||||
// are inlined.
|
||||
// are inlined, as a fraction of usesBeforeCompile.
|
||||
//
|
||||
// Default: 10,240
|
||||
uint32_t usesBeforeInlining;
|
||||
// Default: .125
|
||||
double usesBeforeInliningFactor;
|
||||
|
||||
// How many actual arguments are accepted on the C stack.
|
||||
//
|
||||
@ -133,15 +133,6 @@ struct IonOptions
|
||||
// Default: 100
|
||||
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.
|
||||
//
|
||||
// Default: 4
|
||||
@ -149,7 +140,7 @@ struct IonOptions
|
||||
|
||||
// The maximum total bytecode size of an inline call site.
|
||||
//
|
||||
// Default: 800
|
||||
// Default: 1000
|
||||
uint32_t inlineMaxTotalBytecodeLength;
|
||||
|
||||
// Minimal ratio between the use counts of the caller and the callee to
|
||||
@ -184,10 +175,6 @@ struct IonOptions
|
||||
eagerCompilation = true;
|
||||
usesBeforeCompile = usesBeforeCompileNoJaeger = 0;
|
||||
|
||||
// Eagerly inline calls to improve test coverage.
|
||||
usesBeforeInlining = 0;
|
||||
smallFunctionUsesBeforeInlining = 0;
|
||||
|
||||
parallelCompilation = false;
|
||||
}
|
||||
|
||||
@ -205,14 +192,13 @@ struct IonOptions
|
||||
parallelCompilation(false),
|
||||
usesBeforeCompile(10240),
|
||||
usesBeforeCompileNoJaeger(40),
|
||||
usesBeforeInlining(usesBeforeCompile),
|
||||
usesBeforeInliningFactor(.125),
|
||||
maxStackArgs(4096),
|
||||
maxInlineDepth(3),
|
||||
smallFunctionMaxInlineDepth(10),
|
||||
smallFunctionMaxBytecodeLength(100),
|
||||
smallFunctionUsesBeforeInlining(usesBeforeInlining / 4),
|
||||
polyInlineMax(4),
|
||||
inlineMaxTotalBytecodeLength(800),
|
||||
inlineMaxTotalBytecodeLength(1000),
|
||||
inlineUseCountRatio(128),
|
||||
eagerCompilation(false),
|
||||
slowCallLimit(512),
|
||||
@ -220,6 +206,10 @@ struct IonOptions
|
||||
usesBeforeCompileParallel(1)
|
||||
{
|
||||
}
|
||||
|
||||
uint32_t usesBeforeInlining() {
|
||||
return usesBeforeCompile * usesBeforeInliningFactor;
|
||||
}
|
||||
};
|
||||
|
||||
enum MethodStatus
|
||||
|
@ -3099,7 +3099,6 @@ IonBuilder::makeInliningDecision(AutoObjectVector &targets)
|
||||
uint32_t callerUses = script()->getUseCount();
|
||||
|
||||
uint32_t totalSize = 0;
|
||||
uint32_t checkUses = js_IonOptions.usesBeforeInlining;
|
||||
uint32_t maxInlineDepth = js_IonOptions.maxInlineDepth;
|
||||
bool allFunctionsAreSmall = true;
|
||||
RootedFunction target(cx);
|
||||
@ -3126,15 +3125,13 @@ IonBuilder::makeInliningDecision(AutoObjectVector &targets)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (allFunctionsAreSmall) {
|
||||
checkUses = js_IonOptions.smallFunctionUsesBeforeInlining;
|
||||
if (allFunctionsAreSmall)
|
||||
maxInlineDepth = js_IonOptions.smallFunctionMaxInlineDepth;
|
||||
}
|
||||
|
||||
if (inliningDepth >= maxInlineDepth)
|
||||
return false;
|
||||
|
||||
if (script()->getUseCount() < checkUses) {
|
||||
if (script()->getUseCount() < js_IonOptions.usesBeforeInlining()) {
|
||||
IonSpew(IonSpew_Inlining, "Not inlining, caller is not hot");
|
||||
return false;
|
||||
}
|
||||
@ -4789,7 +4786,7 @@ IonBuilder::insertRecompileCheck()
|
||||
return;
|
||||
|
||||
// Don't recompile if we are already inlining.
|
||||
if (script()->getUseCount() >= js_IonOptions.usesBeforeInlining)
|
||||
if (script()->getUseCount() >= js_IonOptions.usesBeforeInlining())
|
||||
return;
|
||||
|
||||
// Don't recompile if the oracle cannot provide inlining information
|
||||
|
@ -73,40 +73,84 @@ template void MacroAssembler::guardTypeSet(const ValueOperand &value, const type
|
||||
void
|
||||
MacroAssembler::PushRegsInMask(RegisterSet set)
|
||||
{
|
||||
size_t diff = set.gprs().size() * STACK_SLOT_SIZE +
|
||||
set.fpus().size() * sizeof(double);
|
||||
int32_t diffF = set.fpus().size() * sizeof(double);
|
||||
int32_t diffG = set.gprs().size() * STACK_SLOT_SIZE;
|
||||
|
||||
reserveStack(diff);
|
||||
|
||||
for (GeneralRegisterIterator iter(set.gprs()); iter.more(); iter++) {
|
||||
diff -= STACK_SLOT_SIZE;
|
||||
storePtr(*iter, Address(StackPointer, diff));
|
||||
reserveStack(diffG);
|
||||
#ifdef JS_CPU_ARM
|
||||
if (set.gprs().size() > 1) {
|
||||
startDataTransferM(IsStore, 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;
|
||||
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++) {
|
||||
diff -= sizeof(double);
|
||||
storeDouble(*iter, Address(StackPointer, diff));
|
||||
diffF -= sizeof(double);
|
||||
storeDouble(*iter, Address(StackPointer, diffF));
|
||||
}
|
||||
#endif
|
||||
JS_ASSERT(diffF == 0);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssembler::PopRegsInMaskIgnore(RegisterSet set, RegisterSet ignore)
|
||||
{
|
||||
size_t diff = set.gprs().size() * STACK_SLOT_SIZE +
|
||||
set.fpus().size() * sizeof(double);
|
||||
size_t reserved = diff;
|
||||
int32_t diffG = set.gprs().size() * STACK_SLOT_SIZE;
|
||||
int32_t diffF = set.fpus().size() * sizeof(double);
|
||||
const int32_t reservedG = diffG;
|
||||
const int32_t reservedF = diffF;
|
||||
|
||||
for (GeneralRegisterIterator iter(set.gprs()); iter.more(); iter++) {
|
||||
diff -= STACK_SLOT_SIZE;
|
||||
if (!ignore.has(*iter))
|
||||
loadPtr(Address(StackPointer, diff), *iter);
|
||||
}
|
||||
for (FloatRegisterIterator iter(set.fpus()); iter.more(); iter++) {
|
||||
diff -= sizeof(double);
|
||||
if (!ignore.has(*iter))
|
||||
loadDouble(Address(StackPointer, diff), *iter);
|
||||
#ifdef JS_CPU_ARM
|
||||
// ARM can load multiple registers at once, but only if we want back all
|
||||
// the registers we previously saved to the stack.
|
||||
if (ignore.empty(true)) {
|
||||
diffF -= transferMultipleByRuns(set.fpus(), IsLoad, StackPointer, IA);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
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>
|
||||
|
@ -318,6 +318,11 @@ class TypedRegisterSet
|
||||
bool has(T reg) const {
|
||||
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) {
|
||||
bits_ |= (1 << reg.code());
|
||||
}
|
||||
@ -344,12 +349,23 @@ class TypedRegisterSet
|
||||
JS_FLOOR_LOG2(ireg, bits_);
|
||||
return T::FromCode(ireg);
|
||||
}
|
||||
T getFirst() const {
|
||||
JS_ASSERT(!empty());
|
||||
int ireg = js_bitscan_ctz32(bits_);
|
||||
return T::FromCode(ireg);
|
||||
}
|
||||
T takeAny() {
|
||||
JS_ASSERT(!empty());
|
||||
T reg = getAny();
|
||||
take(reg);
|
||||
return reg;
|
||||
}
|
||||
T takeFirst() {
|
||||
JS_ASSERT(!empty());
|
||||
T reg = getFirst();
|
||||
take(reg);
|
||||
return reg;
|
||||
}
|
||||
void clear() {
|
||||
bits_ = 0;
|
||||
}
|
||||
@ -533,6 +549,7 @@ class RegisterSet {
|
||||
}
|
||||
};
|
||||
|
||||
// iterates backwards, that is, rn to r0
|
||||
template <typename T>
|
||||
class TypedRegisterIterator
|
||||
{
|
||||
@ -552,13 +569,48 @@ class TypedRegisterIterator
|
||||
regset_.takeAny();
|
||||
return old;
|
||||
}
|
||||
TypedRegisterIterator<T>& operator ++() {
|
||||
regset_.takeAny();
|
||||
return *this;
|
||||
}
|
||||
T operator *() const {
|
||||
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<FloatRegister> FloatRegisterIterator;
|
||||
typedef TypedRegisterForwardIterator<Register> GeneralRegisterForwardIterator;
|
||||
typedef TypedRegisterForwardIterator<FloatRegister> FloatRegisterForwardIterator;
|
||||
|
||||
class AnyRegisterIterator
|
||||
{
|
||||
|
@ -1383,6 +1383,37 @@ MacroAssemblerARM::ma_vstr(VFPRegister src, Register base, Register index, int32
|
||||
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
|
||||
MacroAssemblerARMCompat::buildFakeExitFrame(const Register &scratch, uint32_t *offset)
|
||||
{
|
||||
|
@ -330,6 +330,14 @@ class MacroAssemblerARM : public Assembler
|
||||
void ma_callIonHalfPush(const Register reg);
|
||||
|
||||
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
|
||||
|
@ -3366,6 +3366,9 @@ TypeCompartment::fixObjectType(JSContext *cx, HandleObject obj)
|
||||
return;
|
||||
}
|
||||
|
||||
if (obj->isIndexed())
|
||||
objType->setFlags(cx, OBJECT_FLAG_SPARSE_INDEXES);
|
||||
|
||||
jsid *ids = cx->pod_calloc<jsid>(obj->slotSpan());
|
||||
if (!ids) {
|
||||
cx->compartment->types.setPendingNukeTypes(cx);
|
||||
|
@ -52,13 +52,6 @@ LIBS += $(NSPR_LIBS)
|
||||
|
||||
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)
|
||||
LIBS += $(JEMALLOC_LIBS)
|
||||
endif
|
||||
|
@ -285,7 +285,8 @@ DEBUG_CheckUnwrapSafety(JSObject *obj, js::Wrapper *handler,
|
||||
MOZ_ASSERT(!handler->isSafeToUnwrap());
|
||||
} else if (AccessCheck::needsSystemOnlyWrapper(obj)) {
|
||||
// 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 {
|
||||
// Otherwise, it should depend on whether the target subsumes the origin.
|
||||
MOZ_ASSERT(handler->isSafeToUnwrap() == AccessCheck::subsumes(target, origin));
|
||||
|
@ -5305,10 +5305,10 @@ nsCSSFrameConstructor::AddFrameConstructionItemsInternal(nsFrameConstructorState
|
||||
|
||||
// Don't create frames for non-SVG element children of SVG elements.
|
||||
if (aNameSpaceID != kNameSpaceID_SVG &&
|
||||
aParentFrame &&
|
||||
IsFrameForSVG(aParentFrame) &&
|
||||
!aParentFrame->IsFrameOfType(nsIFrame::eSVGForeignObject)
|
||||
) {
|
||||
((aParentFrame &&
|
||||
IsFrameForSVG(aParentFrame) &&
|
||||
!aParentFrame->IsFrameOfType(nsIFrame::eSVGForeignObject)) ||
|
||||
(aFlags & ITEM_IS_WITHIN_SVG_TEXT))) {
|
||||
SetAsUndisplayedContent(aItems, element, styleContext,
|
||||
isGeneratedContent);
|
||||
return;
|
||||
|
@ -1605,11 +1605,14 @@ nsDisplayBackgroundImage::AppendBackgroundItemsToTop(nsDisplayListBuilder* aBuil
|
||||
drawBackgroundImage, drawBackgroundColor);
|
||||
}
|
||||
|
||||
// Even if we don't actually have a background color to paint, we still need
|
||||
// to create the item because it's used for hit testing.
|
||||
aList->AppendNewToTop(
|
||||
new (aBuilder) nsDisplayBackgroundColor(aBuilder, aFrame, bg,
|
||||
drawBackgroundColor ? color : NS_RGBA(0, 0, 0, 0)));
|
||||
// Even if we don't actually have a background color to paint, we may still need
|
||||
// to create an item for hit testing.
|
||||
if ((drawBackgroundColor && color != NS_RGBA(0,0,0,0)) ||
|
||||
aBuilder->IsForEventDelivery()) {
|
||||
aList->AppendNewToTop(
|
||||
new (aBuilder) nsDisplayBackgroundColor(aBuilder, aFrame, bg,
|
||||
drawBackgroundColor ? color : NS_RGBA(0, 0, 0, 0)));
|
||||
}
|
||||
|
||||
if (isThemed) {
|
||||
nsDisplayBackgroundImage* bgItem =
|
||||
|
@ -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
|
||||
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-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
|
||||
|
||||
fails-if(d2d) == linear-onestopposition-1.html linear-onestopposition-1-ref.html # bug 638664
|
||||
|
9
layout/reftests/svg/text/display-none-4.svg
Normal file
9
layout/reftests/svg/text/display-none-4.svg
Normal 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 |
12
layout/reftests/svg/text/ignore-invalid-child-2-ref.svg
Normal file
12
layout/reftests/svg/text/ignore-invalid-child-2-ref.svg
Normal 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 |
13
layout/reftests/svg/text/ignore-invalid-child-2.svg
Normal file
13
layout/reftests/svg/text/ignore-invalid-child-2.svg
Normal 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 |
7
layout/reftests/svg/text/pseudo-first-letter-2-ref.svg
Normal file
7
layout/reftests/svg/text/pseudo-first-letter-2-ref.svg
Normal 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">́t</text>
|
||||
</svg>
|
After Width: | Height: | Size: 262 B |
10
layout/reftests/svg/text/pseudo-first-letter-2.svg
Normal file
10
layout/reftests/svg/text/pseudo-first-letter-2.svg
Normal 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">́t</text>
|
||||
</svg>
|
After Width: | Height: | Size: 326 B |
@ -99,6 +99,7 @@ HTTP(../..) == simple-transform-rotate.svg simple-transform-rotate-ref.svg
|
||||
== display-none-1.svg simple.svg
|
||||
== display-none-2.svg simple.svg
|
||||
== display-none-3.svg simple.svg
|
||||
== display-none-4.svg simple.svg
|
||||
|
||||
== simple-multiline.svg simple-multiline-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-2.svg pseudo-first-line-2-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
|
||||
|
||||
# invalid child nodes
|
||||
== ignore-invalid-child.svg ignore-invalid-child-ref.svg
|
||||
== ignore-invalid-child-2.svg ignore-invalid-child-2-ref.svg
|
||||
|
||||
# text inside a link
|
||||
== link-surrounding.svg simple.svg
|
||||
|
@ -273,11 +273,7 @@ IsNonEmptyTextFrame(nsIFrame* aFrame)
|
||||
return false;
|
||||
}
|
||||
|
||||
nsIContent* content = textFrame->GetContent();
|
||||
NS_ASSERTION(content && content->IsNodeOfType(nsINode::eTEXT),
|
||||
"unexpected content type for nsTextFrame");
|
||||
|
||||
return static_cast<nsTextNode*>(content)->TextLength() != 0;
|
||||
return textFrame->GetContentLength() != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1440,6 +1436,9 @@ TextNodeCorrespondenceRecorder::TraverseAndRecord(nsIFrame* aFrame)
|
||||
* * what nsInlineFrame corresponding to a <textPath> element it is a
|
||||
* descendant of
|
||||
* * 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
|
||||
{
|
||||
@ -4424,9 +4423,9 @@ nsSVGTextFrame2::DoGlyphPositioning()
|
||||
// Get the x, y, dx, dy, rotate values for the subtree.
|
||||
nsTArray<gfxPoint> deltas;
|
||||
if (!ResolvePositions(deltas)) {
|
||||
// We shouldn't reach here because DetermineCharPositions should have been
|
||||
// empty if we fail to resolve any positions.
|
||||
NS_NOTREACHED("unexpected result from ResolvePositions");
|
||||
// If ResolvePositions returned false, it means that there were some
|
||||
// characters in the DOM but none of them are displayed. Clear out
|
||||
// mPositions so that we don't attempt to do any painting later.
|
||||
mPositions.Clear();
|
||||
return;
|
||||
}
|
||||
|
@ -1023,6 +1023,7 @@ fsmdef_init_dcb (fsmdef_dcb_t *dcb, callid_t call_id,
|
||||
|
||||
dcb->remote_sdp_present = FALSE;
|
||||
dcb->remote_sdp_in_ack = FALSE;
|
||||
dcb->local_sdp_complete = FALSE;
|
||||
|
||||
dcb->sdp = NULL;
|
||||
dcb->src_sdp_version = 0;
|
||||
@ -2865,6 +2866,8 @@ fsmdef_ev_createoffer (sm_event_t *event) {
|
||||
char *ice_pwd = NULL;
|
||||
short vcm_res;
|
||||
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__));
|
||||
|
||||
@ -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__));
|
||||
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;
|
||||
|
||||
if (msg->data.session.constraints) {
|
||||
@ -2935,6 +2961,8 @@ fsmdef_ev_createoffer (sm_event_t *event) {
|
||||
return (fsmdef_release(fcb, cause, FALSE));
|
||||
}
|
||||
|
||||
dcb->local_sdp_complete = TRUE;
|
||||
|
||||
/* Pass offer SDP back to UI */
|
||||
ui_create_offer(evCreateOffer, line, call_id,
|
||||
dcb->caller_id.call_instance_id,
|
||||
@ -2974,6 +3002,8 @@ fsmdef_ev_createanswer (sm_event_t *event) {
|
||||
boolean has_audio;
|
||||
boolean has_video;
|
||||
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__));
|
||||
|
||||
@ -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__));
|
||||
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;
|
||||
|
||||
if (msg->data.session.constraints) {
|
||||
@ -3069,6 +3122,8 @@ fsmdef_ev_createanswer (sm_event_t *event) {
|
||||
return (fsmdef_release(fcb, cause, FALSE));
|
||||
}
|
||||
|
||||
dcb->local_sdp_complete = TRUE;
|
||||
|
||||
/* Pass SDP back to UI */
|
||||
ui_create_answer(evCreateAnswer, line, call_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;
|
||||
line_t line = msg->line;
|
||||
cc_causes_t lsm_rc;
|
||||
char *local_sdp = 0;
|
||||
char *local_sdp = NULL;
|
||||
uint32_t local_sdp_len = 0;
|
||||
|
||||
FSM_DEBUG_SM(DEB_F_PREFIX"Entered.\n", DEB_F_PREFIX_ARGS(FSM, __FUNCTION__));
|
||||
|
@ -293,6 +293,7 @@ typedef struct {
|
||||
*/
|
||||
boolean remote_sdp_present;
|
||||
boolean remote_sdp_in_ack;
|
||||
boolean local_sdp_complete;
|
||||
uint16_t src_sdp_version;
|
||||
cc_sdp_t *sdp;
|
||||
|
||||
|
@ -1215,7 +1215,8 @@ TEST_F(SignalingTest, CreateOfferDontReceiveVideo)
|
||||
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;
|
||||
constraints.setBooleanConstraint("OfferToReceiveAudio", true, false);
|
||||
@ -1224,7 +1225,8 @@ TEST_F(SignalingTest, CreateOfferRemoveAudioStream)
|
||||
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;
|
||||
constraints.setBooleanConstraint("OfferToReceiveAudio", false, false);
|
||||
@ -1233,7 +1235,8 @@ TEST_F(SignalingTest, CreateOfferDontReceiveAudioRemoveAudioStream)
|
||||
SHOULD_SENDRECV_VIDEO);
|
||||
}
|
||||
|
||||
TEST_F(SignalingTest, CreateOfferDontReceiveVideoRemoveVideoStream)
|
||||
// XXX Disabled pending resolution of Bug 840728
|
||||
TEST_F(SignalingTest, DISABLED_CreateOfferDontReceiveVideoRemoveVideoStream)
|
||||
{
|
||||
sipcc::MediaConstraints constraints;
|
||||
constraints.setBooleanConstraint("OfferToReceiveAudio", true, false);
|
||||
|
@ -128,7 +128,6 @@
|
||||
#ifdef ACCESSIBILITY
|
||||
#ifdef XP_WIN32
|
||||
@BINPATH@/AccessibleMarshal.dll
|
||||
@BINPATH@/components/accessibility-msaa.xpt
|
||||
#endif
|
||||
@BINPATH@/components/accessibility.xpt
|
||||
#endif
|
||||
|
@ -43,12 +43,6 @@ EXPORTS = \
|
||||
|
||||
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...
|
||||
# disable parallel builds
|
||||
.NOTPARALLEL:
|
||||
|
@ -39,12 +39,6 @@ EXPORTS = \
|
||||
|
||||
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...
|
||||
# disable parallel builds
|
||||
.NOTPARALLEL:
|
||||
|
@ -710,7 +710,7 @@ pref("dom.min_background_timeout_value", 1000);
|
||||
pref("dom.experimental_bindings", true);
|
||||
|
||||
// Run content XBL in a separate scope.
|
||||
pref("dom.xbl_scopes", false);
|
||||
pref("dom.xbl_scopes", true);
|
||||
|
||||
// Don't use new input types
|
||||
pref("dom.experimental_forms", false);
|
||||
|
@ -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)
|
||||
@ -158,7 +152,7 @@ nsHostRecord::nsHostRecord(const nsHostKey *key)
|
||||
flags = key->flags;
|
||||
af = key->af;
|
||||
|
||||
expiration = NowInMinutes();
|
||||
expiration = TimeStamp::NowLoRes();
|
||||
|
||||
PR_INIT_CLIST(this);
|
||||
PR_INIT_CLIST(&callbacks);
|
||||
@ -285,9 +279,8 @@ HostDB_ClearEntry(PLDHashTable *table,
|
||||
if (!hr->addr_info) {
|
||||
LOG(("No address info for host [%s].\n", hr->host));
|
||||
} else {
|
||||
int32_t now = (int32_t) NowInMinutes();
|
||||
int32_t diff = (int32_t) hr->expiration - now;
|
||||
LOG(("Record for [%s] expires in %d minute(s).\n", hr->host, diff));
|
||||
TimeDuration diff = hr->expiration - TimeStamp::NowLoRes();
|
||||
LOG(("Record for [%s] expires in %f seconds.\n", hr->host, diff.ToSeconds()));
|
||||
|
||||
NetAddrElement *addrElement = nullptr;
|
||||
char buf[kIPv6CStrBufSize];
|
||||
@ -347,7 +340,7 @@ nsHostResolver::nsHostResolver(uint32_t maxCacheEntries,
|
||||
uint32_t maxCacheLifetime,
|
||||
uint32_t lifetimeGracePeriod)
|
||||
: mMaxCacheEntries(maxCacheEntries)
|
||||
, mMaxCacheLifetime(maxCacheLifetime)
|
||||
, mMaxCacheLifetime(TimeDuration::FromSeconds(maxCacheLifetime * 60))
|
||||
, mGracePeriod(lifetimeGracePeriod)
|
||||
, mLock("nsHostResolver.mLock")
|
||||
, mIdleThreadCV(mLock, "nsHostResolver.mIdleThreadCV")
|
||||
@ -543,8 +536,7 @@ nsHostResolver::ResolveHost(const char *host,
|
||||
// do we have a cached result that we can reuse?
|
||||
else if (!(flags & RES_BYPASS_CACHE) &&
|
||||
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));
|
||||
// put reference to host record on stack...
|
||||
result = he->rec;
|
||||
@ -553,7 +545,7 @@ nsHostResolver::ResolveHost(const char *host,
|
||||
// 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
|
||||
// the background
|
||||
if ((((NowInMinutes() > he->rec->expiration) &&
|
||||
if ((((TimeStamp::NowLoRes() > he->rec->expiration) &&
|
||||
he->rec->mBlacklistedItems.Length()) ||
|
||||
he->rec->negative) && !he->rec->resolving) {
|
||||
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;
|
||||
|
||||
rec->expiration = NowInMinutes();
|
||||
rec->expiration = TimeStamp::NowLoRes();
|
||||
if (result) {
|
||||
rec->expiration += mMaxCacheLifetime;
|
||||
rec->negative = false;
|
||||
}
|
||||
else {
|
||||
rec->expiration += 1; /* one minute for negative cache */
|
||||
rec->expiration += TimeDuration::FromSeconds(60); /* one minute for negative cache */
|
||||
rec->negative = true;
|
||||
}
|
||||
rec->resolving = false;
|
||||
@ -886,9 +878,10 @@ nsHostResolver::OnLookupComplete(nsHostRecord *rec, nsresult status, AddrInfo *r
|
||||
|
||||
if (!head->negative) {
|
||||
// record the age of the entry upon eviction.
|
||||
uint32_t age =
|
||||
NowInMinutes() - (head->expiration - mMaxCacheLifetime);
|
||||
Telemetry::Accumulate(Telemetry::DNS_CLEANUP_AGE, age);
|
||||
TimeDuration age = TimeStamp::NowLoRes() -
|
||||
(head->expiration - mMaxCacheLifetime);
|
||||
Telemetry::Accumulate(Telemetry::DNS_CLEANUP_AGE,
|
||||
static_cast<uint32_t>(age.ToSeconds() / 60));
|
||||
}
|
||||
|
||||
// release reference to rec owned by mEvictionQ
|
||||
@ -955,8 +948,6 @@ nsHostResolver::CancelAsyncRequest(const char *host,
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
void
|
||||
nsHostResolver::ThreadFunc(void *arg)
|
||||
{
|
||||
@ -1025,8 +1016,6 @@ nsHostResolver::ThreadFunc(void *arg)
|
||||
LOG(("DNS lookup thread ending execution.\n"));
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
nsresult
|
||||
nsHostResolver::Create(uint32_t maxCacheEntries,
|
||||
uint32_t maxCacheLifetime,
|
||||
@ -1067,7 +1056,7 @@ CacheEntryEnumerator(PLDHashTable *table, PLDHashEntryHdr *entry,
|
||||
DNSCacheEntries info;
|
||||
info.hostname = rec->host;
|
||||
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) {
|
||||
// We only need valid DNS cache entries
|
||||
return PL_DHASH_NEXT;
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "nsTArray.h"
|
||||
#include "mozilla/net/DNS.h"
|
||||
#include "mozilla/net/DashboardTypes.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
|
||||
class nsHostResolver;
|
||||
class nsHostRecord;
|
||||
@ -77,7 +78,7 @@ public:
|
||||
(though never for more than 60 seconds), but a use
|
||||
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; }
|
||||
|
||||
@ -259,7 +260,7 @@ private:
|
||||
};
|
||||
|
||||
uint32_t mMaxCacheEntries;
|
||||
uint32_t mMaxCacheLifetime;
|
||||
mozilla::TimeDuration mMaxCacheLifetime;
|
||||
uint32_t mGracePeriod;
|
||||
Mutex mLock;
|
||||
CondVar mIdleThreadCV;
|
||||
|
@ -27,6 +27,7 @@ var systemSettings = {
|
||||
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
||||
},
|
||||
|
||||
mainThreadOnly: true,
|
||||
PACURI: "http://localhost:4444/redirect",
|
||||
getProxyForURI: function(aURI) {
|
||||
throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
@ -138,6 +138,7 @@ let PACSystemSettings = {
|
||||
|
||||
// Replace this URI for each test to avoid caching. We want to ensure that
|
||||
// each test gets a completely fresh setup.
|
||||
mainThreadOnly: true,
|
||||
PACURI: null,
|
||||
getProxyForURI: function getProxyForURI(aURI) {
|
||||
throw Cr.NS_ERROR_NOT_IMPLEMENTED;
|
||||
|
@ -298,12 +298,11 @@ function resetValues() {
|
||||
* Returns a content sandbox that can be used by the execute_foo functions.
|
||||
*/
|
||||
function createExecuteContentSandbox(aWindow, timeout) {
|
||||
let sandbox = new Cu.Sandbox(aWindow);
|
||||
let sandbox = new Cu.Sandbox(aWindow, {sandboxPrototype: aWindow});
|
||||
sandbox.global = sandbox;
|
||||
sandbox.window = aWindow;
|
||||
sandbox.document = sandbox.window.document;
|
||||
sandbox.navigator = sandbox.window.navigator;
|
||||
sandbox.__proto__ = sandbox.window;
|
||||
sandbox.testUtils = utils;
|
||||
|
||||
let marionette = new Marionette(this, aWindow, "content",
|
||||
|
@ -494,6 +494,14 @@ File.exists = function exists(path) {
|
||||
* until the contents are fully written, the destination file is
|
||||
* 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|
|
||||
* 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.
|
||||
* - {bool} noOverwrite - If set, this function will fail if a file already
|
||||
* 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}
|
||||
* @resolves {number} The number of bytes actually written.
|
||||
|
@ -314,6 +314,14 @@ AbstractFile.read = function read(path, bytes) {
|
||||
* until the contents are fully written, the destination file is
|
||||
* 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|
|
||||
* 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.
|
||||
* - {bool} noOverwrite - If set, this function will fail if a file already
|
||||
* 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.
|
||||
*/
|
||||
@ -347,7 +361,9 @@ AbstractFile.writeAtomic =
|
||||
let bytesWritten;
|
||||
try {
|
||||
bytesWritten = tmpFile.write(buffer, options);
|
||||
tmpFile.flush();
|
||||
if ("flush" in options && options.flush) {
|
||||
tmpFile.flush();
|
||||
}
|
||||
} catch (x) {
|
||||
OS.File.remove(tmpPath);
|
||||
throw x;
|
||||
|
@ -188,6 +188,7 @@ nsFaviconService::Notify(nsITimer* timer)
|
||||
NS_IMETHODIMP
|
||||
nsFaviconService::SetFaviconUrlForPage(nsIURI* aPageURI, nsIURI* aFaviconURI)
|
||||
{
|
||||
PLACES_WARN_DEPRECATED();
|
||||
NS_ENSURE_ARG(aPageURI);
|
||||
NS_ENSURE_ARG(aFaviconURI);
|
||||
|
||||
@ -342,6 +343,19 @@ nsFaviconService::SetAndLoadFaviconForPage(nsIURI* aPageURI,
|
||||
bool aForceReload,
|
||||
uint32_t aFaviconLoadType,
|
||||
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(aFaviconURI);
|
||||
@ -372,18 +386,6 @@ nsFaviconService::SetAndLoadFaviconForPage(nsIURI* aPageURI,
|
||||
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
|
||||
nsFaviconService::ReplaceFaviconData(nsIURI* aFaviconURI,
|
||||
const uint8_t* aData,
|
||||
@ -462,6 +464,7 @@ nsFaviconService::SetFaviconData(nsIURI* aFaviconURI, const uint8_t* aData,
|
||||
uint32_t aDataLen, const nsACString& aMimeType,
|
||||
PRTime aExpiration)
|
||||
{
|
||||
PLACES_WARN_DEPRECATED();
|
||||
NS_ENSURE_ARG(aFaviconURI);
|
||||
|
||||
if (mFaviconsExpirationRunning)
|
||||
@ -637,6 +640,7 @@ nsFaviconService::SetFaviconDataFromDataURL(nsIURI* aFaviconURI,
|
||||
const nsAString& aDataURL,
|
||||
PRTime aExpiration)
|
||||
{
|
||||
PLACES_WARN_DEPRECATED();
|
||||
NS_ENSURE_ARG(aFaviconURI);
|
||||
if (mFaviconsExpirationRunning)
|
||||
return NS_OK;
|
||||
@ -697,6 +701,7 @@ NS_IMETHODIMP
|
||||
nsFaviconService::GetFaviconData(nsIURI* aFaviconURI, nsACString& aMimeType,
|
||||
uint32_t* aDataLen, uint8_t** aData)
|
||||
{
|
||||
PLACES_WARN_DEPRECATED();
|
||||
NS_ENSURE_ARG(aFaviconURI);
|
||||
NS_ENSURE_ARG_POINTER(aDataLen);
|
||||
NS_ENSURE_ARG_POINTER(aData);
|
||||
@ -777,6 +782,7 @@ NS_IMETHODIMP
|
||||
nsFaviconService::GetFaviconDataAsDataURL(nsIURI* aFaviconURI,
|
||||
nsAString& aDataURL)
|
||||
{
|
||||
PLACES_WARN_DEPRECATED();
|
||||
NS_ENSURE_ARG(aFaviconURI);
|
||||
|
||||
uint8_t* data;
|
||||
@ -811,6 +817,7 @@ nsFaviconService::GetFaviconDataAsDataURL(nsIURI* aFaviconURI,
|
||||
NS_IMETHODIMP
|
||||
nsFaviconService::GetFaviconForPage(nsIURI* aPageURI, nsIURI** _retval)
|
||||
{
|
||||
PLACES_WARN_DEPRECATED();
|
||||
NS_ENSURE_ARG(aPageURI);
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
|
||||
@ -866,6 +873,7 @@ nsFaviconService::GetFaviconDataForPage(nsIURI* aPageURI,
|
||||
NS_IMETHODIMP
|
||||
nsFaviconService::GetFaviconImageForPage(nsIURI* aPageURI, nsIURI** _retval)
|
||||
{
|
||||
PLACES_WARN_DEPRECATED();
|
||||
NS_ENSURE_ARG(aPageURI);
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
|
||||
|
@ -30,6 +30,8 @@ interface nsIFaviconService : nsISupports
|
||||
* @param aFaviconURI
|
||||
* URI of the favicon to associate with the page.
|
||||
* @throws NS_ERROR_NOT_AVAILABLE if aPageURI doesn't exist in the database.
|
||||
*
|
||||
* @deprecated Use mozIAsyncFavicons::setAndFetchFaviconForPage
|
||||
*/
|
||||
void setFaviconUrlForPage(in nsIURI aPageURI,
|
||||
in nsIURI aFaviconURI);
|
||||
@ -75,8 +77,7 @@ interface nsIFaviconService : nsISupports
|
||||
* Once we're done setting and/or loading the favicon, we invoke this
|
||||
* callback.
|
||||
*
|
||||
* @deprecated Use the identical function
|
||||
* mozIAsyncFavicons::setAndFetchFaviconForPage.
|
||||
* @deprecated Use mozIAsyncFavicons::setAndFetchFaviconForPage
|
||||
*/
|
||||
[deprecated]
|
||||
void setAndLoadFaviconForPage(in nsIURI aPageURI,
|
||||
@ -177,6 +178,8 @@ interface nsIFaviconService : nsISupports
|
||||
* Output parameter where the MIME type will be placed.
|
||||
* @throws NS_ERROR_NOT_AVAILABLE
|
||||
* Thrown when we have never heard of this favicon URI.
|
||||
*
|
||||
* @deprecated Use mozIAsyncFavicons::getFaviconDataForPage
|
||||
*/
|
||||
void getFaviconData(in nsIURI aFaviconURI,
|
||||
out AUTF8String aMimeType,
|
||||
@ -194,6 +197,8 @@ interface nsIFaviconService : nsISupports
|
||||
* null if we have this URL but have no data associated with it.
|
||||
* @throws NS_ERROR_NOT_AVAILABLE
|
||||
* Thrown when we have never heard of this favicon URL.
|
||||
*
|
||||
* @deprecated Use mozIAsyncFavicons::getFaviconDataForPage
|
||||
*/
|
||||
AString getFaviconDataAsDataURL(in nsIURI aFaviconURI);
|
||||
|
||||
@ -207,6 +212,8 @@ interface nsIFaviconService : nsISupports
|
||||
* that we know what the favicon should be.
|
||||
* @throws NS_ERROR_NOT_AVAILABLE
|
||||
* When the page is not found or it has no favicon.
|
||||
*
|
||||
* @deprecated Use mozIAsyncFavicons::getFaviconURLForPage
|
||||
*/
|
||||
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
|
||||
* be a chrome URI of the default icon. For chrome URIs, the
|
||||
* output will be the same as the input.
|
||||
*
|
||||
* @deprecated Use mozIAsyncFavicons::getFaviconURLForPage and getFaviconLinkForIcon
|
||||
*/
|
||||
nsIURI getFaviconImageForPage(in nsIURI aPageURI);
|
||||
|
||||
|
@ -1317,6 +1317,8 @@ interface nsINavHistoryService : nsISupports
|
||||
* @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
|
||||
* persistent (TRANSITION_EMBED).
|
||||
*
|
||||
* @deprecated Use mozIAsyncHistory::updatePlaces
|
||||
*/
|
||||
long long addVisit(in nsIURI aURI, in PRTime aTime,
|
||||
in nsIURI aReferringURI, in long aTransitionType,
|
||||
|
@ -1285,6 +1285,7 @@ nsNavHistory::AddVisit(nsIURI* aURI, PRTime aTime, nsIURI* aReferringURI,
|
||||
int32_t aTransitionType, bool aIsRedirect,
|
||||
int64_t aSessionID, int64_t* aVisitID)
|
||||
{
|
||||
PLACES_WARN_DEPRECATED();
|
||||
NS_ASSERTION(NS_IsMainThread(), "This can only be called on the main thread");
|
||||
NS_ENSURE_ARG(aURI);
|
||||
NS_ENSURE_ARG_POINTER(aVisitID);
|
||||
@ -3247,6 +3248,7 @@ NS_IMETHODIMP
|
||||
nsNavHistory::AddURI(nsIURI *aURI, bool aRedirect,
|
||||
bool aToplevel, nsIURI *aReferrer)
|
||||
{
|
||||
PLACES_WARN_DEPRECATED();
|
||||
NS_ASSERTION(NS_IsMainThread(), "This can only be called on the main thread");
|
||||
NS_ENSURE_ARG(aURI);
|
||||
|
||||
@ -3404,6 +3406,7 @@ nsNavHistory::AddVisitChain(nsIURI* aURI,
|
||||
NS_IMETHODIMP
|
||||
nsNavHistory::IsVisited(nsIURI *aURI, bool *_retval)
|
||||
{
|
||||
PLACES_WARN_DEPRECATED();
|
||||
NS_ASSERTION(NS_IsMainThread(), "This can only be called on the main thread");
|
||||
NS_ENSURE_ARG(aURI);
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
@ -3437,6 +3440,7 @@ NS_IMETHODIMP
|
||||
nsNavHistory::SetPageTitle(nsIURI* aURI,
|
||||
const nsAString& aTitle)
|
||||
{
|
||||
PLACES_WARN_DEPRECATED();
|
||||
NS_ASSERTION(NS_IsMainThread(), "This can only be called on the main thread");
|
||||
NS_ENSURE_ARG(aURI);
|
||||
|
||||
|
@ -4,6 +4,12 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#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
|
||||
// method on the observer array.
|
||||
@ -37,3 +43,19 @@
|
||||
} \
|
||||
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
|
||||
|
@ -130,12 +130,18 @@ FrameWorker.prototype = {
|
||||
'setInterval', 'setTimeout', 'XMLHttpRequest',
|
||||
'MozBlobBuilder', 'FileReader', 'Blob',
|
||||
'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) {
|
||||
try {
|
||||
// Bug 798660 - XHR and WebSocket have issues in a sandbox and need
|
||||
// to be unwrapped to work
|
||||
if (fn == "XMLHttpRequest" || fn == "WebSocket")
|
||||
if (needsWaive.indexOf(fn) != -1)
|
||||
sandbox[fn] = XPCNativeWrapper.unwrap(workerWindow)[fn];
|
||||
else if (needsBind.indexOf(fn) != -1)
|
||||
sandbox[fn] = workerWindow[fn].bind(workerWindow);
|
||||
else
|
||||
sandbox[fn] = workerWindow[fn];
|
||||
}
|
||||
|
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user