mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge inbound to m-c. a=merge
This commit is contained in:
commit
f6c057a8b4
@ -596,6 +596,10 @@ this.UtteranceGenerator = { // jshint ignore:line
|
||||
aOutput.push({string: 'stateUnavailable'});
|
||||
}
|
||||
|
||||
if (aState.contains(States.READONLY)) {
|
||||
aOutput.push({string: 'stateReadonly'});
|
||||
}
|
||||
|
||||
// Don't utter this in Jelly Bean, we let TalkBack do it for us there.
|
||||
// This is because we expose the checked information on the node itself.
|
||||
// XXX: this means the checked state is always appended to the end,
|
||||
|
@ -232,6 +232,22 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=753984
|
||||
{"string": "entry"}]],
|
||||
expectedBraille: [[{"string": "entryAbbr"}, "I am required"],
|
||||
["I am required", {"string": "entryAbbr"}]]
|
||||
}, {
|
||||
// test unavailable state utterance on inputs
|
||||
accOrElmOrID: "readonlyInput",
|
||||
expectedUtterance: [[{"string": "stateReadonly"}, {"string": "entry"},
|
||||
"No edits"], ["No edits", {"string": "stateReadonly"},
|
||||
{"string": "entry"}]],
|
||||
expectedBraille: [[{"string": "entryAbbr"}, "No edits"],
|
||||
["No edits", {"string": "entryAbbr"}]]
|
||||
}, {
|
||||
// test unavailable state utterance on textareas
|
||||
accOrElmOrID: "readonlyTextarea",
|
||||
expectedUtterance: [[{"string": "stateReadonly"}, {"string": "textarea"},
|
||||
"No editing"], ["No editing", {"string": "stateReadonly"},
|
||||
{"string": "textarea"}]],
|
||||
expectedBraille: [[{"string": "textareaAbbr"}, "No editing"],
|
||||
["No editing", {"string": "textareaAbbr"}]]
|
||||
}, {
|
||||
// test has popup state utterance
|
||||
accOrElmOrID: "hasPopupButton",
|
||||
@ -486,6 +502,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=753984
|
||||
<button id="expandedButton" aria-expanded="true">I am expanded</button>
|
||||
<button id="collapsedButton" aria-expanded="false">I am collapsed</button>
|
||||
<input id="requiredInput" required placeholder="I am required" />
|
||||
<input id="readonlyInput" readonly value="No edits" />
|
||||
<textarea id="readonlyTextarea" readonly>No editing</textarea>
|
||||
<button id="hasPopupButton" aria-haspopup="true">I have a popup</button>
|
||||
<div role="tablist">
|
||||
<a id="tab1" href="#" role="tab" aria-selected="true">Account</a>
|
||||
|
@ -971,7 +971,7 @@ pref("apz.x_stationary_size_multiplier", "1.5");
|
||||
pref("apz.y_stationary_size_multiplier", "1.8");
|
||||
pref("apz.enlarge_displayport_when_clipped", true);
|
||||
// Use "sticky" axis locking
|
||||
pref("apz.axis_lock_mode", 2);
|
||||
pref("apz.axis_lock.mode", 2);
|
||||
pref("apz.subframe.enabled", true);
|
||||
|
||||
// Overscroll-related settings
|
||||
|
@ -57,7 +57,7 @@ pref("apz.x_skate_size_multiplier", "2.5");
|
||||
pref("apz.y_skate_size_multiplier", "2.5");
|
||||
pref("apz.min_skate_speed", "10.0");
|
||||
// 0 = free, 1 = standard, 2 = sticky
|
||||
pref("apz.axis_lock_mode", 2);
|
||||
pref("apz.axis_lock.mode", 2);
|
||||
pref("apz.cross_slide.enabled", true);
|
||||
pref("apz.subframe.enabled", true);
|
||||
|
||||
|
@ -399,6 +399,10 @@ def do_file(filename, inclname, file_kind, f, all_inclnames, included_h_inclname
|
||||
|
||||
# Extract the #include statements as a tree of IBlocks and IIncludes.
|
||||
for linenum, line in enumerate(f, start=1):
|
||||
# We're only interested in lines that contain a '#'.
|
||||
if not '#' in line:
|
||||
continue
|
||||
|
||||
# Look for a |#include "..."| line.
|
||||
m = re.match(r'\s*#\s*include\s+"([^"]*)"', line)
|
||||
if m is not None:
|
||||
@ -482,16 +486,12 @@ def do_file(filename, inclname, file_kind, f, all_inclnames, included_h_inclname
|
||||
error(filename, str(include1.linenum) + ':' + str(include2.linenum),
|
||||
include1.quote() + ' should be included after ' + include2.quote())
|
||||
|
||||
# The #include statements in the files in assembler/ have all manner of implicit
|
||||
# ordering requirements. Boo. Ignore them.
|
||||
skip_order_checking = inclname.startswith('assembler/')
|
||||
|
||||
# Check the extracted #include statements, both individually, and the ordering of
|
||||
# adjacent pairs that live in the same block.
|
||||
def pair_traverse(prev, this):
|
||||
if this.isLeaf():
|
||||
check_include_statement(this)
|
||||
if prev is not None and prev.isLeaf() and not skip_order_checking:
|
||||
if prev is not None and prev.isLeaf():
|
||||
check_includes_order(prev, this)
|
||||
else:
|
||||
for prev2, this2 in zip([None] + this.kids[0:-1], this.kids):
|
||||
|
@ -9,10 +9,6 @@
|
||||
#include "base/string_util.h"
|
||||
#include "base/process_util.h"
|
||||
|
||||
#ifdef XP_WIN
|
||||
#include <codecvt>
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
|
||||
using std::vector;
|
||||
@ -50,9 +46,8 @@ GMPProcessParent::Launch(int32_t aTimeoutMs)
|
||||
vector<string> args;
|
||||
args.push_back(mGMPPath);
|
||||
|
||||
#ifdef XP_WIN
|
||||
std::wstring_convert<std::codecvt_utf8<wchar_t>> converter;
|
||||
std::wstring wGMPPath = converter.from_bytes(mGMPPath.c_str());
|
||||
#if defined(XP_WIN) && defined(MOZ_SANDBOX)
|
||||
std::wstring wGMPPath = UTF8ToWide(mGMPPath.c_str());
|
||||
mAllowedFilesRead.push_back(wGMPPath + L"\\*");
|
||||
#endif
|
||||
|
||||
|
@ -82,7 +82,7 @@ GetGMPStorageDir(nsIFile** aTempDir, const nsString& aOrigin)
|
||||
// process (a UUID or somesuch), we can just append it un-hashed here.
|
||||
// This should reduce the chance of hash collsions exposing data.
|
||||
nsAutoString nodeIdHash;
|
||||
nodeIdHash.AppendInt(HashString(aOrigin.get()));
|
||||
nodeIdHash.AppendInt(HashString(static_cast<const char16_t*>(aOrigin.get())));
|
||||
rv = tmpFile->Append(nodeIdHash);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
|
@ -1227,15 +1227,6 @@ nsDOMClassInfo::HasInstance(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMClassInfo::OuterObject(nsIXPConnectWrappedNative *wrapper, JSContext * cx,
|
||||
JSObject * obj, JSObject * *_retval)
|
||||
{
|
||||
NS_WARNING("nsDOMClassInfo::OuterObject Don't call me!");
|
||||
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
static nsresult
|
||||
GetExternalClassInfo(nsScriptNameSpaceManager *aNameSpaceManager,
|
||||
const nsAString &aName,
|
||||
|
@ -1216,6 +1216,7 @@ def UnionTypes(descriptors, dictionaries, callbacks, config):
|
||||
def addHeadersForType(f):
|
||||
if f.nullable():
|
||||
headers.add("mozilla/dom/Nullable.h")
|
||||
isSequence = f.isSequence()
|
||||
f = f.unroll()
|
||||
if f.isInterface():
|
||||
if f.isSpiderMonkeyInterface():
|
||||
@ -1227,10 +1228,14 @@ def UnionTypes(descriptors, dictionaries, callbacks, config):
|
||||
typeDesc = p.getDescriptor(f.inner.identifier.name)
|
||||
except NoSuchDescriptorError:
|
||||
continue
|
||||
if typeDesc.interface.isCallback():
|
||||
if typeDesc.interface.isCallback() or isSequence:
|
||||
# Callback interfaces always use strong refs, so
|
||||
# we need to include the right header to be able
|
||||
# to Release() in our inlined code.
|
||||
#
|
||||
# Similarly, sequences always contain strong
|
||||
# refs, so we'll need the header to handler
|
||||
# those.
|
||||
headers.add(typeDesc.headerFile)
|
||||
else:
|
||||
declarations.add((typeDesc.nativeType, False))
|
||||
@ -4651,7 +4656,7 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None,
|
||||
|
||||
if type.isSpiderMonkeyInterface():
|
||||
assert not isEnforceRange and not isClamp
|
||||
name = type.name
|
||||
name = type.unroll().name # unroll() because it may be nullable
|
||||
arrayType = CGGeneric(name)
|
||||
declType = arrayType
|
||||
if type.nullable():
|
||||
@ -6202,8 +6207,6 @@ def getUnionMemberName(type):
|
||||
return type.inner.identifier.name
|
||||
if type.isEnum():
|
||||
return type.inner.identifier.name
|
||||
if type.isArray() or type.isSequence() or type.isMozMap():
|
||||
return str(type)
|
||||
return type.name
|
||||
|
||||
|
||||
@ -12448,7 +12451,8 @@ class CGNativeMember(ClassMethod):
|
||||
if not self.typedArraysAreStructs:
|
||||
return "JS::Handle<JSObject*>", False, False
|
||||
|
||||
return type.name, True, True
|
||||
# Unroll for the name, in case we're nullable.
|
||||
return type.unroll().name, True, True
|
||||
|
||||
if type.isDOMString() or type.isScalarValueString():
|
||||
if isMember:
|
||||
|
@ -1764,7 +1764,10 @@ class IDLNullableType(IDLType):
|
||||
assert not innerType.isVoid()
|
||||
assert not innerType == BuiltinTypes[IDLBuiltinType.Types.any]
|
||||
|
||||
IDLType.__init__(self, location, innerType.name)
|
||||
name = innerType.name
|
||||
if innerType.isComplete():
|
||||
name += "OrNull"
|
||||
IDLType.__init__(self, location, name)
|
||||
self.inner = innerType
|
||||
self.builtin = False
|
||||
|
||||
@ -1877,7 +1880,7 @@ class IDLNullableType(IDLType):
|
||||
"be a union type that itself has a nullable "
|
||||
"type as a member type", [self.location])
|
||||
|
||||
self.name = self.inner.name
|
||||
self.name = self.inner.name + "OrNull"
|
||||
return self
|
||||
|
||||
def unroll(self):
|
||||
@ -1900,6 +1903,10 @@ class IDLSequenceType(IDLType):
|
||||
IDLType.__init__(self, location, parameterType.name)
|
||||
self.inner = parameterType
|
||||
self.builtin = False
|
||||
# Need to set self.name up front if our inner type is already complete,
|
||||
# since in that case our .complete() won't be called.
|
||||
if self.inner.isComplete():
|
||||
self.name = self.inner.name + "Sequence"
|
||||
|
||||
def __eq__(self, other):
|
||||
return isinstance(other, IDLSequenceType) and self.inner == other.inner
|
||||
@ -1961,7 +1968,7 @@ class IDLSequenceType(IDLType):
|
||||
|
||||
def complete(self, scope):
|
||||
self.inner = self.inner.complete(scope)
|
||||
self.name = self.inner.name
|
||||
self.name = self.inner.name + "Sequence"
|
||||
return self
|
||||
|
||||
def unroll(self):
|
||||
@ -1987,6 +1994,10 @@ class IDLMozMapType(IDLType):
|
||||
IDLType.__init__(self, location, parameterType.name)
|
||||
self.inner = parameterType
|
||||
self.builtin = False
|
||||
# Need to set self.name up front if our inner type is already complete,
|
||||
# since in that case our .complete() won't be called.
|
||||
if self.inner.isComplete():
|
||||
self.name = self.inner.name + "MozMap"
|
||||
|
||||
def __eq__(self, other):
|
||||
return isinstance(other, IDLMozMapType) and self.inner == other.inner
|
||||
@ -2012,7 +2023,7 @@ class IDLMozMapType(IDLType):
|
||||
|
||||
def complete(self, scope):
|
||||
self.inner = self.inner.complete(scope)
|
||||
self.name = self.inner.name
|
||||
self.name = self.inner.name + "MozMap"
|
||||
return self
|
||||
|
||||
def unroll(self):
|
||||
@ -2077,9 +2088,6 @@ class IDLUnionType(IDLType):
|
||||
return typeName(type._identifier.object())
|
||||
if isinstance(type, IDLObjectWithIdentifier):
|
||||
return typeName(type.identifier)
|
||||
if (isinstance(type, IDLType) and
|
||||
(type.isArray() or type.isSequence() or type.isMozMap)):
|
||||
return str(type)
|
||||
return type.name
|
||||
|
||||
for (i, type) in enumerate(self.memberTypes):
|
||||
|
@ -90,7 +90,7 @@ def checkEquivalent(iface, harness):
|
||||
for attr in dir(type1):
|
||||
if attr.startswith('_') or \
|
||||
attr in ['nullable', 'builtin', 'filename', 'location',
|
||||
'inner', 'QName', 'getDeps'] or \
|
||||
'inner', 'QName', 'getDeps', 'name'] or \
|
||||
(hasattr(type(type1), attr) and not callable(getattr(type1, attr))):
|
||||
continue
|
||||
|
||||
|
@ -12,7 +12,7 @@ def WebIDLTest(parser, harness):
|
||||
|
||||
results = parser.finish()
|
||||
|
||||
harness.check(results[2].members[1].type.name, "Long",
|
||||
harness.check(results[2].members[1].type.name, "LongOrNull",
|
||||
"Should expand typedefs")
|
||||
|
||||
parser = parser.reset()
|
||||
|
@ -603,6 +603,10 @@ public:
|
||||
void PassUnion20(JSContext*, const ObjectSequenceOrLong&);
|
||||
void PassUnion21(const LongMozMapOrLong&);
|
||||
void PassUnion22(JSContext*, const ObjectMozMapOrLong&);
|
||||
void PassUnion23(const ImageDataSequenceOrLong&);
|
||||
void PassUnion24(const ImageDataOrNullSequenceOrLong&);
|
||||
void PassUnion25(const ImageDataSequenceSequenceOrLong&);
|
||||
void PassUnion26(const ImageDataOrNullSequenceSequenceOrLong&);
|
||||
void PassUnionWithCallback(const EventHandlerNonNullOrNullOrLong& arg);
|
||||
void PassUnionWithByteString(const ByteStringOrLong&);
|
||||
void PassUnionWithMozMap(const StringMozMapOrString&);
|
||||
|
@ -567,6 +567,10 @@ interface TestInterface {
|
||||
void passUnion20(optional (sequence<object> or long) arg = []);
|
||||
void passUnion21((MozMap<long> or long) arg);
|
||||
void passUnion22((MozMap<object> or long) arg);
|
||||
void passUnion23((sequence<ImageData> or long) arg);
|
||||
void passUnion24((sequence<ImageData?> or long) arg);
|
||||
void passUnion25((sequence<sequence<ImageData>> or long) arg);
|
||||
void passUnion26((sequence<sequence<ImageData?>> or long) arg);
|
||||
void passUnionWithCallback((EventHandler or long) arg);
|
||||
void passUnionWithByteString((ByteString or long) arg);
|
||||
void passUnionWithMozMap((MozMap<DOMString> or DOMString) arg);
|
||||
|
@ -431,6 +431,10 @@ interface TestExampleInterface {
|
||||
void passUnion20(optional (sequence<object> or long) arg = []);
|
||||
void passUnion21((MozMap<long> or long) arg);
|
||||
void passUnion22((MozMap<object> or long) arg);
|
||||
void passUnion23((sequence<ImageData> or long) arg);
|
||||
void passUnion24((sequence<ImageData?> or long) arg);
|
||||
void passUnion25((sequence<sequence<ImageData>> or long) arg);
|
||||
void passUnion26((sequence<sequence<ImageData?>> or long) arg);
|
||||
void passUnionWithCallback((EventHandler or long) arg);
|
||||
void passUnionWithByteString((ByteString or long) arg);
|
||||
void passUnionWithMozMap((MozMap<DOMString> or DOMString) arg);
|
||||
|
@ -451,6 +451,10 @@ interface TestJSImplInterface {
|
||||
void passUnion20(optional (sequence<object> or long) arg = []);
|
||||
void passUnion21((MozMap<long> or long) arg);
|
||||
void passUnion22((MozMap<object> or long) arg);
|
||||
void passUnion23((sequence<ImageData> or long) arg);
|
||||
void passUnion24((sequence<ImageData?> or long) arg);
|
||||
void passUnion25((sequence<sequence<ImageData>> or long) arg);
|
||||
void passUnion26((sequence<sequence<ImageData?>> or long) arg);
|
||||
void passUnionWithCallback((EventHandler or long) arg);
|
||||
void passUnionWithByteString((ByteString or long) arg);
|
||||
void passUnionWithMozMap((MozMap<DOMString> or DOMString) arg);
|
||||
|
@ -564,7 +564,7 @@ DrawTarget* CanvasRenderingContext2D::sErrorTarget = nullptr;
|
||||
|
||||
|
||||
CanvasRenderingContext2D::CanvasRenderingContext2D()
|
||||
: mForceSoftware(false)
|
||||
: mRenderingMode(RenderingMode::OpenGLBackendMode)
|
||||
// these are the default values from the Canvas spec
|
||||
, mWidth(0), mHeight(0)
|
||||
, mZero(false), mOpaque(false)
|
||||
@ -577,6 +577,12 @@ CanvasRenderingContext2D::CanvasRenderingContext2D()
|
||||
{
|
||||
sNumLivingContexts++;
|
||||
SetIsDOMBinding();
|
||||
|
||||
// The default is to use OpenGL mode
|
||||
if (!gfxPlatform::GetPlatform()->UseAcceleratedSkiaCanvas()) {
|
||||
mRenderingMode = RenderingMode::SoftwareBackendMode;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
CanvasRenderingContext2D::~CanvasRenderingContext2D()
|
||||
@ -773,24 +779,25 @@ CanvasRenderingContext2D::RedrawUser(const gfxRect& r)
|
||||
Redraw(newr);
|
||||
}
|
||||
|
||||
void CanvasRenderingContext2D::Demote()
|
||||
bool CanvasRenderingContext2D::SwitchRenderingMode(RenderingMode aRenderingMode)
|
||||
{
|
||||
if (!IsTargetValid() || mForceSoftware || !mStream)
|
||||
return;
|
||||
|
||||
RemoveDemotableContext(this);
|
||||
if (!IsTargetValid() || mRenderingMode == aRenderingMode) {
|
||||
return false;
|
||||
}
|
||||
|
||||
RefPtr<SourceSurface> snapshot = mTarget->Snapshot();
|
||||
RefPtr<DrawTarget> oldTarget = mTarget;
|
||||
mTarget = nullptr;
|
||||
mStream = nullptr;
|
||||
mResetLayer = true;
|
||||
mForceSoftware = true;
|
||||
|
||||
// Recreate target, now demoted to software only
|
||||
EnsureTarget();
|
||||
// Recreate target using the new rendering mode
|
||||
RenderingMode attemptedMode = EnsureTarget(aRenderingMode);
|
||||
if (!IsTargetValid())
|
||||
return;
|
||||
return false;
|
||||
|
||||
// We succeeded, so update mRenderingMode to reflect reality
|
||||
mRenderingMode = attemptedMode;
|
||||
|
||||
// Restore the content from the old DrawTarget
|
||||
mgfx::Rect r(0, 0, mWidth, mHeight);
|
||||
@ -802,6 +809,15 @@ void CanvasRenderingContext2D::Demote()
|
||||
}
|
||||
|
||||
mTarget->SetTransform(oldTarget->GetTransform());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CanvasRenderingContext2D::Demote()
|
||||
{
|
||||
if (SwitchRenderingMode(RenderingMode::SoftwareBackendMode)) {
|
||||
RemoveDemotableContext(this);
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<CanvasRenderingContext2D*>&
|
||||
@ -821,7 +837,9 @@ CanvasRenderingContext2D::DemoteOldestContextIfNecessary()
|
||||
return;
|
||||
|
||||
CanvasRenderingContext2D* oldest = contexts.front();
|
||||
oldest->Demote();
|
||||
if (oldest->SwitchRenderingMode(RenderingMode::SoftwareBackendMode)) {
|
||||
RemoveDemotableContext(oldest);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -913,11 +931,16 @@ CanvasRenderingContext2D::CheckSizeForSkiaGL(IntSize size) {
|
||||
return threshold < 0 || (size.width * size.height) <= threshold;
|
||||
}
|
||||
|
||||
void
|
||||
CanvasRenderingContext2D::EnsureTarget()
|
||||
CanvasRenderingContext2D::RenderingMode
|
||||
CanvasRenderingContext2D::EnsureTarget(RenderingMode aRenderingMode)
|
||||
{
|
||||
if (mTarget) {
|
||||
return;
|
||||
// This would make no sense, so make sure we don't get ourselves in a mess
|
||||
MOZ_ASSERT(mRenderingMode != RenderingMode::DefaultBackendMode);
|
||||
|
||||
RenderingMode mode = (aRenderingMode == RenderingMode::DefaultBackendMode) ? mRenderingMode : aRenderingMode;
|
||||
|
||||
if (mTarget && mode == mRenderingMode) {
|
||||
return mRenderingMode;
|
||||
}
|
||||
|
||||
// Check that the dimensions are sane
|
||||
@ -938,9 +961,7 @@ CanvasRenderingContext2D::EnsureTarget()
|
||||
}
|
||||
|
||||
if (layerManager) {
|
||||
if (gfxPlatform::GetPlatform()->UseAcceleratedSkiaCanvas() &&
|
||||
!mForceSoftware &&
|
||||
CheckSizeForSkiaGL(size)) {
|
||||
if (mode == RenderingMode::OpenGLBackendMode && CheckSizeForSkiaGL(size)) {
|
||||
DemoteOldestContextIfNecessary();
|
||||
|
||||
SkiaGLGlue* glue = gfxPlatform::GetPlatform()->GetSkiaGLGlue();
|
||||
@ -954,6 +975,7 @@ CanvasRenderingContext2D::EnsureTarget()
|
||||
AddDemotableContext(this);
|
||||
} else {
|
||||
printf_stderr("Failed to create a SkiaGL DrawTarget, falling back to software\n");
|
||||
mode = RenderingMode::SoftwareBackendMode;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -962,8 +984,10 @@ CanvasRenderingContext2D::EnsureTarget()
|
||||
}
|
||||
} else
|
||||
mTarget = layerManager->CreateDrawTarget(size, format);
|
||||
mode = RenderingMode::SoftwareBackendMode;
|
||||
} else {
|
||||
mTarget = gfxPlatform::GetPlatform()->CreateOffscreenCanvasDrawTarget(size, format);
|
||||
mode = RenderingMode::SoftwareBackendMode;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1002,6 +1026,8 @@ CanvasRenderingContext2D::EnsureTarget()
|
||||
EnsureErrorTarget();
|
||||
mTarget = sErrorTarget;
|
||||
}
|
||||
|
||||
return mode;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
@ -1114,12 +1140,17 @@ CanvasRenderingContext2D::SetContextOptions(JSContext* aCx, JS::Handle<JS::Value
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// This shouldn't be called before drawing starts, so there should be no drawtarget yet
|
||||
MOZ_ASSERT(!mTarget);
|
||||
|
||||
ContextAttributes2D attributes;
|
||||
NS_ENSURE_TRUE(attributes.Init(aCx, aOptions), NS_ERROR_UNEXPECTED);
|
||||
|
||||
if (Preferences::GetBool("gfx.canvas.willReadFrequently.enable", false)) {
|
||||
// Use software when there is going to be a lot of readback
|
||||
mForceSoftware = attributes.mWillReadFrequently;
|
||||
if (attributes.mWillReadFrequently) {
|
||||
mRenderingMode = RenderingMode::SoftwareBackendMode;
|
||||
}
|
||||
}
|
||||
|
||||
if (!attributes.mAlpha) {
|
||||
|
@ -457,6 +457,15 @@ public:
|
||||
double h, const nsAString& bgColor, uint32_t flags,
|
||||
mozilla::ErrorResult& error);
|
||||
|
||||
enum RenderingMode {
|
||||
SoftwareBackendMode,
|
||||
OpenGLBackendMode,
|
||||
DefaultBackendMode
|
||||
};
|
||||
|
||||
bool SwitchRenderingMode(RenderingMode aRenderingMode);
|
||||
|
||||
// Eventually this should be deprecated. Keeping for now to keep the binding functional.
|
||||
void Demote();
|
||||
|
||||
nsresult Redraw();
|
||||
@ -644,8 +653,10 @@ protected:
|
||||
* in creating the target then it will put sErrorTarget in place. If there
|
||||
* is in turn an error in creating the sErrorTarget then they would both
|
||||
* be null so IsTargetValid() would still return null.
|
||||
*
|
||||
* Returns the actual rendering mode being used by the created target.
|
||||
*/
|
||||
void EnsureTarget();
|
||||
RenderingMode EnsureTarget(RenderingMode aRenderMode = RenderingMode::DefaultBackendMode);
|
||||
|
||||
/*
|
||||
* Disposes an old target and prepares to lazily create a new target.
|
||||
@ -688,8 +699,7 @@ protected:
|
||||
static void AddDemotableContext(CanvasRenderingContext2D* context);
|
||||
static void RemoveDemotableContext(CanvasRenderingContext2D* context);
|
||||
|
||||
// Do not use GL
|
||||
bool mForceSoftware;
|
||||
RenderingMode mRenderingMode;
|
||||
|
||||
// Member vars
|
||||
int32_t mWidth, mHeight;
|
||||
|
@ -157,6 +157,7 @@ statePressed = pressed
|
||||
stateExpanded = expanded
|
||||
stateCollapsed = collapsed
|
||||
stateUnavailable = unavailable
|
||||
stateReadonly = readonly
|
||||
stateRequired = required
|
||||
stateTraversed = visited
|
||||
stateHasPopup = has pop up
|
||||
|
@ -151,9 +151,29 @@ typedef mozilla::gfx::Matrix4x4 Matrix4x4;
|
||||
* The timeout for mAsyncScrollTimeoutTask delay task.
|
||||
* Units: milliseconds
|
||||
*
|
||||
* "apz.axis_lock_mode"
|
||||
* "apz.axis_lock.mode"
|
||||
* The preferred axis locking style. See AxisLockMode for possible values.
|
||||
*
|
||||
* "apz.axis_lock.lock_angle"
|
||||
* Angle from axis within which we stay axis-locked.
|
||||
* Units: radians
|
||||
*
|
||||
* "apz.axis_lock.breakout_threshold"
|
||||
* Distance in inches the user must pan before axis lock can be broken.
|
||||
* Units: (real-world, i.e. screen) inches
|
||||
*
|
||||
* "apz.axis_lock.breakout_angle"
|
||||
* Angle at which axis lock can be broken.
|
||||
* Units: radians
|
||||
*
|
||||
* "apz.axis_lock.direct_pan_angle"
|
||||
* If the angle from an axis to the line drawn by a pan move is less than
|
||||
* this value, we can assume that panning can be done in the allowed direction
|
||||
* (horizontal or vertical).
|
||||
* Currently used only for touch-action css property stuff and was addded to
|
||||
* keep behaviour consistent with IE.
|
||||
* Units: radians
|
||||
*
|
||||
* "apz.content_response_timeout"
|
||||
* Amount of time before we timeout response from content. For example, if
|
||||
* content is being unruly/slow and we don't get a response back within this
|
||||
@ -323,30 +343,6 @@ typedef mozilla::gfx::Matrix4x4 Matrix4x4;
|
||||
* Units: ms
|
||||
*/
|
||||
|
||||
/**
|
||||
* Angle from axis within which we stay axis-locked
|
||||
*/
|
||||
static const double AXIS_LOCK_ANGLE = M_PI / 6.0; // 30 degrees
|
||||
|
||||
/**
|
||||
* The distance in inches the user must pan before axis lock can be broken
|
||||
*/
|
||||
static const float AXIS_BREAKOUT_THRESHOLD = 1.0f/32.0f;
|
||||
|
||||
/**
|
||||
* The angle at which axis lock can be broken
|
||||
*/
|
||||
static const double AXIS_BREAKOUT_ANGLE = M_PI / 8.0; // 22.5 degrees
|
||||
|
||||
/**
|
||||
* Angle from axis to the line drawn by pan move.
|
||||
* If angle is less than this value we can assume that panning
|
||||
* can be done in allowed direction (horizontal or vertical).
|
||||
* Currently used only for touch-action css property stuff and was
|
||||
* added to keep behavior consistent with IE.
|
||||
*/
|
||||
static const double ALLOWED_DIRECT_PAN_ANGLE = M_PI / 3.0; // 60 degrees
|
||||
|
||||
/**
|
||||
* Computed time function used for sampling frames of a zoom to animation.
|
||||
*/
|
||||
@ -1712,10 +1708,10 @@ void AsyncPanZoomController::HandlePanningWithTouchAction(double aAngle) {
|
||||
// enabled by default.
|
||||
if (CurrentTouchBlock()->TouchActionAllowsPanningXY()) {
|
||||
if (mX.CanScrollNow() && mY.CanScrollNow()) {
|
||||
if (IsCloseToHorizontal(aAngle, AXIS_LOCK_ANGLE)) {
|
||||
if (IsCloseToHorizontal(aAngle, gfxPrefs::APZAxisLockAngle())) {
|
||||
mY.SetAxisLocked(true);
|
||||
SetState(PANNING_LOCKED_X);
|
||||
} else if (IsCloseToVertical(aAngle, AXIS_LOCK_ANGLE)) {
|
||||
} else if (IsCloseToVertical(aAngle, gfxPrefs::APZAxisLockAngle())) {
|
||||
mX.SetAxisLocked(true);
|
||||
SetState(PANNING_LOCKED_Y);
|
||||
} else {
|
||||
@ -1729,7 +1725,7 @@ void AsyncPanZoomController::HandlePanningWithTouchAction(double aAngle) {
|
||||
} else if (CurrentTouchBlock()->TouchActionAllowsPanningX()) {
|
||||
// Using bigger angle for panning to keep behavior consistent
|
||||
// with IE.
|
||||
if (IsCloseToHorizontal(aAngle, ALLOWED_DIRECT_PAN_ANGLE)) {
|
||||
if (IsCloseToHorizontal(aAngle, gfxPrefs::APZAllowedDirectPanAngle())) {
|
||||
mY.SetAxisLocked(true);
|
||||
SetState(PANNING_LOCKED_X);
|
||||
mPanDirRestricted = true;
|
||||
@ -1739,7 +1735,7 @@ void AsyncPanZoomController::HandlePanningWithTouchAction(double aAngle) {
|
||||
SetState(NOTHING);
|
||||
}
|
||||
} else if (CurrentTouchBlock()->TouchActionAllowsPanningY()) {
|
||||
if (IsCloseToVertical(aAngle, ALLOWED_DIRECT_PAN_ANGLE)) {
|
||||
if (IsCloseToVertical(aAngle, gfxPrefs::APZAllowedDirectPanAngle())) {
|
||||
mX.SetAxisLocked(true);
|
||||
SetState(PANNING_LOCKED_Y);
|
||||
mPanDirRestricted = true;
|
||||
@ -1755,7 +1751,7 @@ void AsyncPanZoomController::HandlePanning(double aAngle) {
|
||||
ReentrantMonitorAutoEnter lock(mMonitor);
|
||||
if (!gfxPrefs::APZCrossSlideEnabled() && (!mX.CanScrollNow() || !mY.CanScrollNow())) {
|
||||
SetState(PANNING);
|
||||
} else if (IsCloseToHorizontal(aAngle, AXIS_LOCK_ANGLE)) {
|
||||
} else if (IsCloseToHorizontal(aAngle, gfxPrefs::APZAxisLockAngle())) {
|
||||
mY.SetAxisLocked(true);
|
||||
if (mX.CanScrollNow()) {
|
||||
SetState(PANNING_LOCKED_X);
|
||||
@ -1763,7 +1759,7 @@ void AsyncPanZoomController::HandlePanning(double aAngle) {
|
||||
SetState(CROSS_SLIDING_X);
|
||||
mX.SetAxisLocked(true);
|
||||
}
|
||||
} else if (IsCloseToVertical(aAngle, AXIS_LOCK_ANGLE)) {
|
||||
} else if (IsCloseToVertical(aAngle, gfxPrefs::APZAxisLockAngle())) {
|
||||
mX.SetAxisLocked(true);
|
||||
if (mY.CanScrollNow()) {
|
||||
SetState(PANNING_LOCKED_Y);
|
||||
@ -1783,16 +1779,16 @@ void AsyncPanZoomController::HandlePanningUpdate(float aDX, float aDY) {
|
||||
double angle = atan2(aDY, aDX); // range [-pi, pi]
|
||||
angle = fabs(angle); // range [0, pi]
|
||||
|
||||
float breakThreshold = AXIS_BREAKOUT_THRESHOLD * APZCTreeManager::GetDPI();
|
||||
float breakThreshold = gfxPrefs::APZAxisBreakoutThreshold() * APZCTreeManager::GetDPI();
|
||||
|
||||
if (fabs(aDX) > breakThreshold || fabs(aDY) > breakThreshold) {
|
||||
if (mState == PANNING_LOCKED_X || mState == CROSS_SLIDING_X) {
|
||||
if (!IsCloseToHorizontal(angle, AXIS_BREAKOUT_ANGLE)) {
|
||||
if (!IsCloseToHorizontal(angle, gfxPrefs::APZAxisBreakoutAngle())) {
|
||||
mY.SetAxisLocked(false);
|
||||
SetState(PANNING);
|
||||
}
|
||||
} else if (mState == PANNING_LOCKED_Y || mState == CROSS_SLIDING_Y) {
|
||||
if (!IsCloseToVertical(angle, AXIS_BREAKOUT_ANGLE)) {
|
||||
if (!IsCloseToVertical(angle, gfxPrefs::APZAxisLockAngle())) {
|
||||
mX.SetAxisLocked(false);
|
||||
SetState(PANNING);
|
||||
}
|
||||
|
@ -721,15 +721,6 @@ CompositorOGL::BeginFrame(const nsIntRegion& aInvalidRegion,
|
||||
rect = gfx::Rect(0, 0, mSurfaceSize.width, mSurfaceSize.height);
|
||||
} else {
|
||||
rect = gfx::Rect(aRenderBounds.x, aRenderBounds.y, aRenderBounds.width, aRenderBounds.height);
|
||||
// If render bounds is not updated explicitly, try to infer it from widget
|
||||
if (rect.width == 0 || rect.height == 0) {
|
||||
// FIXME/bug XXXXXX this races with rotation changes on the main
|
||||
// thread, and undoes all the care we take with layers txns being
|
||||
// sent atomically with rotation changes
|
||||
nsIntRect intRect;
|
||||
mWidget->GetClientBounds(intRect);
|
||||
rect = gfx::Rect(0, 0, intRect.width, intRect.height);
|
||||
}
|
||||
}
|
||||
|
||||
rect = aTransform.TransformBounds(rect);
|
||||
|
@ -107,6 +107,10 @@ gfxHarfBuzzShaper::GetGlyph(hb_codepoint_t unicode,
|
||||
compat);
|
||||
}
|
||||
break;
|
||||
case 10:
|
||||
gid = gfxFontUtils::MapCharToGlyphFormat10(data + mSubtableOffset,
|
||||
compat);
|
||||
break;
|
||||
case 12:
|
||||
gid = gfxFontUtils::MapCharToGlyphFormat12(data + mSubtableOffset,
|
||||
compat);
|
||||
@ -125,6 +129,10 @@ gfxHarfBuzzShaper::GetGlyph(hb_codepoint_t unicode,
|
||||
gfxFontUtils::MapCharToGlyphFormat4(data + mSubtableOffset,
|
||||
unicode) : 0;
|
||||
break;
|
||||
case 10:
|
||||
gid = gfxFontUtils::MapCharToGlyphFormat10(data + mSubtableOffset,
|
||||
unicode);
|
||||
break;
|
||||
case 12:
|
||||
gid = gfxFontUtils::MapCharToGlyphFormat12(data + mSubtableOffset,
|
||||
unicode);
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/Constants.h" // for M_PI
|
||||
#include "mozilla/TypedEnum.h"
|
||||
|
||||
// First time gfxPrefs::GetSingleton() needs to be called on the main thread,
|
||||
@ -132,7 +133,11 @@ private:
|
||||
DECL_GFX_PREF(Live, "apz.allow_checkerboarding", APZAllowCheckerboarding, bool, true);
|
||||
DECL_GFX_PREF(Live, "apz.asyncscroll.throttle", APZAsyncScrollThrottleTime, int32_t, 100);
|
||||
DECL_GFX_PREF(Live, "apz.asyncscroll.timeout", APZAsyncScrollTimeout, int32_t, 300);
|
||||
DECL_GFX_PREF(Live, "apz.axis_lock_mode", APZAxisLockMode, int32_t, 0);
|
||||
DECL_GFX_PREF(Live, "apz.axis_lock.mode", APZAxisLockMode, int32_t, 0);
|
||||
DECL_GFX_PREF(Live, "apz.axis_lock.lock_angle", APZAxisLockAngle, float, float(M_PI / 6.0) /* 30 degrees */);
|
||||
DECL_GFX_PREF(Live, "apz.axis_lock.breakout_threshold", APZAxisBreakoutThreshold, float, 1.0f / 32.0f);
|
||||
DECL_GFX_PREF(Live, "apz.axis_lock.breakout_angle", APZAxisBreakoutAngle, float, float(M_PI / 8.0) /* 22.5 degrees */);
|
||||
DECL_GFX_PREF(Live, "apz.axis_lock.direct_pan_angle", APZAllowedDirectPanAngle, float, float(M_PI / 3.0) /* 60 degrees */);
|
||||
DECL_GFX_PREF(Live, "apz.content_response_timeout", APZContentResponseTimeout, int32_t, 300);
|
||||
DECL_GFX_PREF(Live, "apz.cross_slide.enabled", APZCrossSlideEnabled, bool, false);
|
||||
DECL_GFX_PREF(Live, "apz.danger_zone_x", APZDangerZoneX, int32_t, 50);
|
||||
|
@ -820,6 +820,7 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
|
||||
break;
|
||||
};
|
||||
|
||||
#ifdef MOZ_SANDBOX
|
||||
if (shouldSandboxCurrentProcess) {
|
||||
for (auto it = mAllowedFilesRead.begin();
|
||||
it != mAllowedFilesRead.end();
|
||||
@ -827,6 +828,7 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
|
||||
mSandboxBroker.AllowReadFile(it->c_str());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // XP_WIN
|
||||
|
||||
|
@ -114,8 +114,10 @@ static MOZ_CONSTEXPR_VAR Register FramePointer = InvalidReg;
|
||||
static MOZ_CONSTEXPR_VAR Register ReturnReg = v0;
|
||||
static MOZ_CONSTEXPR_VAR FloatRegister ReturnFloat32Reg = { FloatRegisters::f0, FloatRegister::Single };
|
||||
static MOZ_CONSTEXPR_VAR FloatRegister ReturnDoubleReg = { FloatRegisters::f0, FloatRegister::Double };
|
||||
static MOZ_CONSTEXPR_VAR FloatRegister ReturnSimdReg = InvalidFloatReg;
|
||||
static MOZ_CONSTEXPR_VAR FloatRegister ScratchFloat32Reg = { FloatRegisters::f18, FloatRegister::Single };
|
||||
static MOZ_CONSTEXPR_VAR FloatRegister ScratchDoubleReg = { FloatRegisters::f18, FloatRegister::Double };
|
||||
static MOZ_CONSTEXPR_VAR FloatRegister ScratchSimdReg = InvalidFloatReg;
|
||||
static MOZ_CONSTEXPR_VAR FloatRegister SecondScratchFloat32Reg = { FloatRegisters::f16, FloatRegister::Single };
|
||||
static MOZ_CONSTEXPR_VAR FloatRegister SecondScratchDoubleReg = { FloatRegisters::f16, FloatRegister::Double };
|
||||
|
||||
@ -1015,6 +1017,9 @@ class Assembler : public AssemblerShared
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
static bool SupportsSimd() {
|
||||
return js::jit::SupportsSimd;
|
||||
}
|
||||
|
||||
protected:
|
||||
InstImm invertBranch(InstImm branch, BOffImm16 skipOffset);
|
||||
|
@ -265,6 +265,21 @@ class CodeGeneratorMIPS : public CodeGeneratorShared
|
||||
bool visitEffectiveAddress(LEffectiveAddress *ins);
|
||||
bool visitUDiv(LUDiv *ins);
|
||||
bool visitUMod(LUMod *ins);
|
||||
|
||||
public:
|
||||
// Unimplemented SIMD instructions
|
||||
bool visitSimdValueX4(LSimdValueX4 *lir) { MOZ_CRASH("NYI"); }
|
||||
bool visitSimdSplatX4(LSimdSplatX4 *lir) { MOZ_CRASH("NYI"); }
|
||||
bool visitInt32x4(LInt32x4 *ins) { MOZ_CRASH("NYI"); }
|
||||
bool visitFloat32x4(LFloat32x4 *ins) { MOZ_CRASH("NYI"); }
|
||||
bool visitSimdExtractElementI(LSimdExtractElementI *ins) { MOZ_CRASH("NYI"); }
|
||||
bool visitSimdExtractElementF(LSimdExtractElementF *ins) { MOZ_CRASH("NYI"); }
|
||||
bool visitSimdSignMaskX4(LSimdSignMaskX4 *ins) { MOZ_CRASH("NYI"); }
|
||||
bool visitSimdBinaryCompIx4(LSimdBinaryCompIx4 *lir) { MOZ_CRASH("NYI"); }
|
||||
bool visitSimdBinaryCompFx4(LSimdBinaryCompFx4 *lir) { MOZ_CRASH("NYI"); }
|
||||
bool visitSimdBinaryArithIx4(LSimdBinaryArithIx4 *lir) { MOZ_CRASH("NYI"); }
|
||||
bool visitSimdBinaryArithFx4(LSimdBinaryArithFx4 *lir) { MOZ_CRASH("NYI"); }
|
||||
bool visitSimdBinaryBitwiseX4(LSimdBinaryBitwiseX4 *lir) { MOZ_CRASH("NYI"); }
|
||||
};
|
||||
|
||||
typedef CodeGeneratorMIPS CodeGeneratorSpecific;
|
||||
|
@ -1560,7 +1560,7 @@ MacroAssemblerMIPSCompat::freeStack(Register amount)
|
||||
void
|
||||
MacroAssembler::PushRegsInMask(RegisterSet set, FloatRegisterSet simdSet)
|
||||
{
|
||||
JS_ASSERT(!SupportsSimd && simdSet.size() == 0);
|
||||
JS_ASSERT(!SupportsSimd() && simdSet.size() == 0);
|
||||
int32_t diffF = set.fpus().getPushSizeInBytes();
|
||||
int32_t diffG = set.gprs().size() * sizeof(intptr_t);
|
||||
|
||||
@ -1588,7 +1588,7 @@ MacroAssembler::PushRegsInMask(RegisterSet set, FloatRegisterSet simdSet)
|
||||
void
|
||||
MacroAssembler::PopRegsInMaskIgnore(RegisterSet set, RegisterSet ignore, FloatRegisterSet simdSet)
|
||||
{
|
||||
JS_ASSERT(!SupportsSimd && simdSet.size() == 0);
|
||||
JS_ASSERT(!SupportsSimd() && simdSet.size() == 0);
|
||||
int32_t diffG = set.gprs().size() * sizeof(intptr_t);
|
||||
int32_t diffF = set.fpus().getPushSizeInBytes();
|
||||
const int32_t reservedG = diffG;
|
||||
@ -3285,7 +3285,7 @@ void
|
||||
MacroAssembler::alignFrameForICArguments(AfterICSaveLive &aic)
|
||||
{
|
||||
if (framePushed() % ABIStackAlignment != 0) {
|
||||
aic.alignmentPadding = ABIStackAlignment - (framePushed() % StackAlignment);
|
||||
aic.alignmentPadding = ABIStackAlignment - (framePushed() % ABIStackAlignment);
|
||||
reserveStack(aic.alignmentPadding);
|
||||
} else {
|
||||
aic.alignmentPadding = 0;
|
||||
|
@ -1067,6 +1067,16 @@ public:
|
||||
|
||||
void loadPrivate(const Address &address, Register dest);
|
||||
|
||||
void loadAlignedInt32x4(const Address &addr, FloatRegister dest) { MOZ_CRASH("NYI"); }
|
||||
void storeAlignedInt32x4(FloatRegister src, Address addr) { MOZ_CRASH("NYI"); }
|
||||
void loadUnalignedInt32x4(const Address &addr, FloatRegister dest) { MOZ_CRASH("NYI"); }
|
||||
void storeUnalignedInt32x4(FloatRegister src, Address addr) { MOZ_CRASH("NYI"); }
|
||||
|
||||
void loadAlignedFloat32x4(const Address &addr, FloatRegister dest) { MOZ_CRASH("NYI"); }
|
||||
void storeAlignedFloat32x4(FloatRegister src, Address addr) { MOZ_CRASH("NYI"); }
|
||||
void loadUnalignedFloat32x4(const Address &addr, FloatRegister dest) { MOZ_CRASH("NYI"); }
|
||||
void storeUnalignedFloat32x4(FloatRegister src, Address addr) { MOZ_CRASH("NYI"); }
|
||||
|
||||
void loadDouble(const Address &addr, FloatRegister dest);
|
||||
void loadDouble(const BaseIndex &src, FloatRegister dest);
|
||||
|
||||
|
@ -31,7 +31,7 @@ interface nsIXPConnectWrappedNative;
|
||||
* boolean to PR_TRUE before making the call. Implementations may skip writing
|
||||
* to *_retval unless they want to return PR_FALSE.
|
||||
*/
|
||||
[uuid(9bae4ff5-5618-4ccd-b106-8e21e3fb64d3)]
|
||||
[uuid(d945a647-a60e-462d-9635-c79d5fa694ce)]
|
||||
interface nsIXPCScriptable : nsISupports
|
||||
{
|
||||
/* bitflags used for 'flags' (only 32 bits available!) */
|
||||
@ -64,8 +64,6 @@ interface nsIXPCScriptable : nsISupports
|
||||
const uint32_t ALLOW_PROP_MODS_TO_PROTOTYPE = 1 << 25;
|
||||
const uint32_t IS_GLOBAL_OBJECT = 1 << 26;
|
||||
const uint32_t DONT_REFLECT_INTERFACE_NAMES = 1 << 27;
|
||||
// Unused bit here!
|
||||
const uint32_t WANT_OUTER_OBJECT = 1 << 29;
|
||||
|
||||
// The high order bit is RESERVED for consumers of these flags.
|
||||
// No implementor of this interface should ever return flags
|
||||
@ -140,9 +138,6 @@ interface nsIXPCScriptable : nsISupports
|
||||
in JSContextPtr cx, in JSObjectPtr obj,
|
||||
in jsval val, out boolean bp);
|
||||
|
||||
JSObjectPtr outerObject(in nsIXPConnectWrappedNative wrapper,
|
||||
in JSContextPtr cx, in JSObjectPtr obj);
|
||||
|
||||
void postCreatePrototype(in JSContextPtr cx, in JSObjectPtr proto);
|
||||
};
|
||||
|
||||
|
@ -76,9 +76,6 @@ XPC_MAP_CLASSNAME::GetScriptableFlags()
|
||||
#ifdef XPC_MAP_WANT_HASINSTANCE
|
||||
nsIXPCScriptable::WANT_HASINSTANCE |
|
||||
#endif
|
||||
#ifdef XPC_MAP_WANT_OUTER_OBJECT
|
||||
nsIXPCScriptable::WANT_OUTER_OBJECT |
|
||||
#endif
|
||||
#ifdef XPC_MAP_FLAGS
|
||||
XPC_MAP_FLAGS |
|
||||
#endif
|
||||
@ -166,11 +163,6 @@ NS_IMETHODIMP XPC_MAP_CLASSNAME::HasInstance(nsIXPConnectWrappedNative *wrapper,
|
||||
{NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;}
|
||||
#endif
|
||||
|
||||
#ifndef XPC_MAP_WANT_OUTER_OBJECT
|
||||
NS_IMETHODIMP XPC_MAP_CLASSNAME::OuterObject(nsIXPConnectWrappedNative *wrapper, JSContext * cx, JSObject * obj, JSObject * *_retval)
|
||||
{NS_ERROR("never called"); return NS_ERROR_NOT_IMPLEMENTED;}
|
||||
#endif
|
||||
|
||||
#ifndef XPC_MAP_WANT_POST_CREATE_PROTOTYPE
|
||||
NS_IMETHODIMP XPC_MAP_CLASSNAME::PostCreatePrototype(JSContext *cx, JSObject *proto)
|
||||
{return NS_OK;}
|
||||
@ -241,10 +233,6 @@ NS_IMETHODIMP XPC_MAP_CLASSNAME::PostCreatePrototype(JSContext *cx, JSObject *pr
|
||||
#undef XPC_MAP_WANT_HASINSTANCE
|
||||
#endif
|
||||
|
||||
#ifdef XPC_MAP_WANT_OUTER_OBJECT
|
||||
#undef XPC_MAP_WANT_OUTER_OBJECT
|
||||
#endif
|
||||
|
||||
#ifdef XPC_MAP_WANT_POST_CREATE_PROTOTYPE
|
||||
#undef XPC_MAP_WANT_POST_CREATE_PROTOTYPE
|
||||
#endif
|
||||
|
@ -629,42 +629,6 @@ XPC_WN_NoHelper_Resolve(JSContext *cx, HandleObject obj, HandleId id)
|
||||
JSPROP_PERMANENT, nullptr);
|
||||
}
|
||||
|
||||
static JSObject *
|
||||
XPC_WN_OuterObject(JSContext *cx, HandleObject objArg)
|
||||
{
|
||||
JSObject *obj = objArg;
|
||||
|
||||
XPCWrappedNative *wrapper = XPCWrappedNative::Get(obj);
|
||||
if (!wrapper) {
|
||||
Throw(NS_ERROR_XPC_BAD_OP_ON_WN_PROTO, cx);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!wrapper->IsValid()) {
|
||||
Throw(NS_ERROR_XPC_HAS_BEEN_SHUTDOWN, cx);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
XPCNativeScriptableInfo* si = wrapper->GetScriptableInfo();
|
||||
if (si && si->GetFlags().WantOuterObject()) {
|
||||
RootedObject newThis(cx);
|
||||
nsresult rv =
|
||||
si->GetCallback()->OuterObject(wrapper, cx, obj, newThis.address());
|
||||
|
||||
if (NS_FAILED(rv)) {
|
||||
Throw(rv, cx);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
obj = newThis;
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
const XPCWrappedNativeJSClass XPC_WN_NoHelper_JSClass = {
|
||||
{ // base
|
||||
"XPCWrappedNative_NoHelper", // name;
|
||||
@ -1172,24 +1136,8 @@ XPCNativeScriptableShared::PopulateJSClass()
|
||||
// We have to figure out resolve strategy at call time
|
||||
mJSClass.base.resolve = (JSResolveOp) XPC_WN_Helper_NewResolve;
|
||||
|
||||
// We need to respect content-defined toString() hooks on Window objects.
|
||||
// In particular, js::DefaultValue checks for a convert stub, and the one
|
||||
// we would install below ignores anything implemented in JS.
|
||||
//
|
||||
// We've always had this behavior for most XPCWrappedNative-implemented
|
||||
// objects. However, Window was special, because the outer-window proxy
|
||||
// had a null convert hook, which means that we'd end up with the default
|
||||
// JS-engine behavior (which respects toString() overrides). We've fixed
|
||||
// the convert hook on the outer-window proxy to invoke the defaultValue
|
||||
// hook on the proxy, which in this case invokes js::DefaultValue on the
|
||||
// target. So now we need to special-case this for Window to maintain
|
||||
// consistent behavior. This can go away once Window is on WebIDL bindings.
|
||||
//
|
||||
// Note that WantOuterObject() is true if and only if this is a Window object.
|
||||
if (mFlags.WantConvert())
|
||||
mJSClass.base.convert = XPC_WN_Helper_Convert;
|
||||
else if (mFlags.WantOuterObject())
|
||||
mJSClass.base.convert = JS_ConvertStub;
|
||||
else
|
||||
mJSClass.base.convert = XPC_WN_Shared_Convert;
|
||||
|
||||
@ -1216,9 +1164,6 @@ XPCNativeScriptableShared::PopulateJSClass()
|
||||
else
|
||||
mJSClass.base.trace = XPCWrappedNative::Trace;
|
||||
|
||||
if (mFlags.WantOuterObject())
|
||||
mJSClass.base.ext.outerObject = XPC_WN_OuterObject;
|
||||
|
||||
mJSClass.base.ext.isWrappedNative = true;
|
||||
}
|
||||
|
||||
|
@ -1623,7 +1623,6 @@ public:
|
||||
bool WantCall() GET_IT(WANT_CALL)
|
||||
bool WantConstruct() GET_IT(WANT_CONSTRUCT)
|
||||
bool WantHasInstance() GET_IT(WANT_HASINSTANCE)
|
||||
bool WantOuterObject() GET_IT(WANT_OUTER_OBJECT)
|
||||
bool UseJSStubForAddProperty() GET_IT(USE_JSSTUB_FOR_ADDPROPERTY)
|
||||
bool UseJSStubForDelProperty() GET_IT(USE_JSSTUB_FOR_DELPROPERTY)
|
||||
bool UseJSStubForSetProperty() GET_IT(USE_JSSTUB_FOR_SETPROPERTY)
|
||||
|
@ -439,8 +439,11 @@ pref("apz.asyncscroll.timeout", 300);
|
||||
// 0 = FREE (No locking at all)
|
||||
// 1 = STANDARD (Once locked, remain locked until scrolling ends)
|
||||
// 2 = STICKY (Allow lock to be broken, with hysteresis)
|
||||
pref("apz.axis_lock_mode", 0);
|
||||
|
||||
pref("apz.axis_lock.mode", 0);
|
||||
pref("apz.axis_lock.lock_angle", "0.5235987"); // PI / 6 (30 degrees)
|
||||
pref("apz.axis_lock.breakout_threshold", "0.03125"); // 1/32 inches
|
||||
pref("apz.axis_lock.breakout_angle", "0.3926991"); // PI / 8 (22.5 degrees)
|
||||
pref("apz.axis_lock.direct_pan_angle", "1.047197"); // PI / 3 (60 degrees)
|
||||
pref("apz.content_response_timeout", 300);
|
||||
pref("apz.cross_slide.enabled", false);
|
||||
pref("apz.danger_zone_x", 50);
|
||||
|
@ -79,6 +79,10 @@ static const char kCybertrust_Global_RootFingerprint[] =
|
||||
static const char kDigiCert_Assured_ID_Root_CAFingerprint[] =
|
||||
"I/Lt/z7ekCWanjD0Cvj5EqXls2lOaThEA0H2Bg4BT/o=";
|
||||
|
||||
/* DigiCert ECC Secure Server CA */
|
||||
static const char kDigiCert_ECC_Secure_Server_CAFingerprint[] =
|
||||
"PZXN3lRAy+8tBKk2Ox6F7jIlnzr2Yzmwqc3JnyfXoCw=";
|
||||
|
||||
/* DigiCert Global Root CA */
|
||||
static const char kDigiCert_Global_Root_CAFingerprint[] =
|
||||
"r/mIkG3eEpVdm+u/ko/cwxzOMo1bk4TyHIlByibiA5E=";
|
||||
@ -364,6 +368,7 @@ struct StaticPinset {
|
||||
|
||||
/* PreloadedHPKPins.json pinsets */
|
||||
static const char* kPinset_facebook_sha256_Data[] = {
|
||||
kDigiCert_ECC_Secure_Server_CAFingerprint,
|
||||
kVerisign_Class_3_Public_Primary_Certification_Authority___G3Fingerprint,
|
||||
kDigiCert_High_Assurance_EV_Root_CAFingerprint,
|
||||
};
|
||||
@ -1087,4 +1092,4 @@ static const TransportSecurityPreload kPublicKeyPinningPreloadList[] = {
|
||||
|
||||
static const int32_t kUnknownId = -1;
|
||||
|
||||
static const PRTime kPreloadPKPinsExpirationTime = INT64_C(1418465237331000);
|
||||
static const PRTime kPreloadPKPinsExpirationTime = INT64_C(1418659817121000);
|
||||
|
@ -19,6 +19,10 @@
|
||||
// name: (string) the DNS name of the host in question
|
||||
// include_subdomains: (optional bool) whether subdomains of |name| are also covered
|
||||
// pins: (string) the |name| member of an object in |pinsets|
|
||||
//
|
||||
// "extra_certs" is a list of base64-encoded certificates. These are used in
|
||||
// pinsets that reference certificates not in our root program (for example,
|
||||
// Facebook).
|
||||
|
||||
// equifax -> aus3
|
||||
// Geotrust Primary -> www.mozilla.org
|
||||
@ -186,13 +190,12 @@
|
||||
"XRamp Global CA Root"
|
||||
]
|
||||
},
|
||||
// For pinning tests on pinning.example.com, the certificate must be 'End
|
||||
// Entity Test Cert'
|
||||
{
|
||||
"name": "facebook",
|
||||
"sha256_hashes": [
|
||||
"Verisign Class 3 Public Primary Certification Authority - G3",
|
||||
"DigiCert High Assurance EV Root CA"
|
||||
"DigiCert High Assurance EV Root CA",
|
||||
"DigiCert ECC Secure Server CA"
|
||||
]
|
||||
}
|
||||
],
|
||||
@ -235,5 +238,10 @@
|
||||
// Facebook (not pinned by Chrome)
|
||||
{ "name": "facebook.com", "include_subdomains": true,
|
||||
"pins": "facebook", "test_mode": true }
|
||||
],
|
||||
|
||||
"extra_certificates": [
|
||||
// DigiCert ECC Secure Server CA (for Facebook)
|
||||
"MIIDrDCCApSgAwIBAgIQCssoukZe5TkIdnRw883GEjANBgkqhkiG9w0BAQwFADBhMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBDQTAeFw0xMzAzMDgxMjAwMDBaFw0yMzAzMDgxMjAwMDBaMEwxCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxJjAkBgNVBAMTHURpZ2lDZXJ0IEVDQyBTZWN1cmUgU2VydmVyIENBMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAE4ghC6nfYJN6gLGSkE85AnCNyqQIKDjc/ITa4jVMU9tWRlUvzlgKNcR7E2Munn17voOZ/WpIRllNv68DLP679Wz9HJOeaBy6Wvqgvu1cYr3GkvXg6HuhbPGtkESvMNCuMo4IBITCCAR0wEgYDVR0TAQH/BAgwBgEB/wIBADAOBgNVHQ8BAf8EBAMCAYYwNAYIKwYBBQUHAQEEKDAmMCQGCCsGAQUFBzABhhhodHRwOi8vb2NzcC5kaWdpY2VydC5jb20wQgYDVR0fBDswOTA3oDWgM4YxaHR0cDovL2NybDMuZGlnaWNlcnQuY29tL0RpZ2lDZXJ0R2xvYmFsUm9vdENBLmNybDA9BgNVHSAENjA0MDIGBFUdIAAwKjAoBggrBgEFBQcCARYcaHR0cHM6Ly93d3cuZGlnaWNlcnQuY29tL0NQUzAdBgNVHQ4EFgQUo53mH/naOU/AbuiRy5Wl2jHiCp8wHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUwDQYJKoZIhvcNAQEMBQADggEBAMeKoENL7HTJxavVHzA1Nm6YVntIrAVjrnuaVyRXzG/63qttnMe2uuzO58pzZNvfBDcKAEmzP58mrZGMIOgfiA4q+2Y3yDDo0sIkp0VILeoBUEoxlBPfjV/aKrtJPGHzecicZpIalir0ezZYoyxBEHQa0+1IttK7igZFcTMQMHp6mCHdJLnsnLWSB62DxsRq+HfmNb4TDydkskO/g+l3VtsIh5RHFPVfKK+jaEyDj2D3loB5hWp2Jp2VDCADjT7ueihlZGak2YPqmXTNbk19HOuNssWvFhtOyPNV6og4ETQdEa8/B6hPatJ0ES8q/HO3X8IVQwVs1n3aAr0im0/T+Xc="
|
||||
]
|
||||
}
|
||||
|
@ -336,7 +336,7 @@ function downloadAndParseChromePins(filename,
|
||||
|
||||
// Returns a pair of maps [certNameToSKD, certSKDToName] between cert
|
||||
// nicknames and digests of the SPKInfo for the mozilla trust store
|
||||
function loadNSSCertinfo(derTestFile) {
|
||||
function loadNSSCertinfo(derTestFile, extraCertificates) {
|
||||
let allCerts = gCertDB.getCerts();
|
||||
let enumerator = allCerts.getEnumerator();
|
||||
let certNameToSKD = {};
|
||||
@ -351,6 +351,14 @@ function loadNSSCertinfo(derTestFile) {
|
||||
certNameToSKD[name] = SKD;
|
||||
certSKDToName[SKD] = name;
|
||||
}
|
||||
|
||||
for (let cert of extraCertificates) {
|
||||
let name = cert.commonName;
|
||||
let SKD = cert.sha256SubjectPublicKeyInfoDigest;
|
||||
certNameToSKD[name] = SKD;
|
||||
certSKDToName[SKD] = name;
|
||||
}
|
||||
|
||||
{
|
||||
// A certificate for *.example.com.
|
||||
let der = readFileToString(derTestFile);
|
||||
@ -545,7 +553,17 @@ function writeFile(certNameToSKD, certSKDToName,
|
||||
writeString(genExpirationTime());
|
||||
}
|
||||
|
||||
let [ certNameToSKD, certSKDToName ] = loadNSSCertinfo(gTestCertFile);
|
||||
function loadExtraCertificates(certStringList) {
|
||||
let constructedCerts = [];
|
||||
for (let certString of certStringList) {
|
||||
constructedCerts.push(gCertDB.constructX509FromBase64(certString));
|
||||
}
|
||||
return constructedCerts;
|
||||
}
|
||||
|
||||
let extraCertificates = loadExtraCertificates(gStaticPins.extra_certificates);
|
||||
let [ certNameToSKD, certSKDToName ] = loadNSSCertinfo(gTestCertFile,
|
||||
extraCertificates);
|
||||
let [ chromeNameToHash, chromeNameToMozName ] = downloadAndParseChromeCerts(
|
||||
gStaticPins.chromium_data.cert_file_url, certSKDToName);
|
||||
let [ chromeImportedPinsets, chromeImportedEntries ] =
|
||||
|
@ -31,6 +31,7 @@ class ErrorCodes(object):
|
||||
INVALID_RESPONSE = 53
|
||||
FRAME_SEND_NOT_INITIALIZED_ERROR = 54
|
||||
FRAME_SEND_FAILURE_ERROR = 55
|
||||
UNSUPPORTED_OPERATION = 405
|
||||
MARIONETTE_ERROR = 500
|
||||
|
||||
class MarionetteException(Exception):
|
||||
@ -138,3 +139,6 @@ class FrameSendNotInitializedError(MarionetteException):
|
||||
|
||||
class FrameSendFailureError(MarionetteException):
|
||||
pass
|
||||
|
||||
class UnsupportedOperationException(MarionetteException):
|
||||
pass
|
||||
|
@ -708,6 +708,8 @@ class Marionette(object):
|
||||
raise errors.FrameSendNotInitializedError(message=message, status=status, stacktrace=stacktrace)
|
||||
elif status == errors.ErrorCodes.FRAME_SEND_FAILURE_ERROR:
|
||||
raise errors.FrameSendFailureError(message=message, status=status, stacktrace=stacktrace)
|
||||
elif status == errors.ErrorCodes.UNSUPPORTED_OPERATION:
|
||||
raise errors.UnsupportedOperationException(message=message, status=status, stacktrace=stacktrace)
|
||||
else:
|
||||
raise errors.MarionetteException(message=message, status=status, stacktrace=stacktrace)
|
||||
raise errors.MarionetteException(message=response, status=500)
|
||||
@ -883,7 +885,6 @@ class Marionette(object):
|
||||
:rtype: string
|
||||
|
||||
"""
|
||||
|
||||
self.window = self._send_message("getWindowHandle", "value")
|
||||
return self.window
|
||||
|
||||
@ -1515,3 +1516,31 @@ class Marionette(object):
|
||||
self._send_message("setScreenOrientation", "ok", orientation=orientation)
|
||||
if self.emulator:
|
||||
self.emulator.screen.orientation = orientation.lower()
|
||||
|
||||
@property
|
||||
def window_size(self):
|
||||
"""Get the current browser window size.
|
||||
|
||||
Will return the current browser window size in pixels. Refers to
|
||||
window outerWidth and outerHeight values, which include scroll bars,
|
||||
title bars, etc.
|
||||
|
||||
:returns: dictionary representation of current window width and height
|
||||
|
||||
"""
|
||||
return self._send_message("getWindowSize", "value")
|
||||
|
||||
def set_window_size(self, width, height):
|
||||
"""Resize the browser window currently in focus.
|
||||
|
||||
The supplied width and height values refer to the window outerWidth
|
||||
and outerHeight values, which include scroll bars, title bars, etc.
|
||||
|
||||
An error will be returned if the requested window size would result
|
||||
in the window being in the maximised state.
|
||||
|
||||
:param width: The width to resize the window to.
|
||||
:param height: The height to resize the window to.
|
||||
|
||||
"""
|
||||
self._send_message("setWindowSize", "ok", width=width, height=height)
|
||||
|
@ -0,0 +1,50 @@
|
||||
# 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/.
|
||||
|
||||
from errors import MarionetteException
|
||||
from marionette_test import MarionetteTestCase
|
||||
|
||||
class TestSetWindowSize(MarionetteTestCase):
|
||||
def setUp(self):
|
||||
super(MarionetteTestCase, self).setUp()
|
||||
self.start_size = self.marionette.window_size
|
||||
self.max_width = self.marionette.execute_script("return window.screen.availWidth;")
|
||||
self.max_height = self.marionette.execute_script("return window.screen.availHeight;")
|
||||
|
||||
def tearDown(self):
|
||||
# WebDriver spec says a resize cannot result in window being maximized, an
|
||||
# error is returned if that is the case; therefore if the window is maximized
|
||||
# at the start of this test, returning to the original size via set_window_size
|
||||
# size will result in error; so reset to original size minus 1 pixel width
|
||||
if self.start_size['width'] == self.max_width and self.start_size['height'] == self.max_height:
|
||||
self.start_size['width']-=1
|
||||
self.marionette.set_window_size(self.start_size['width'], self.start_size['height'])
|
||||
super(MarionetteTestCase, self).tearDown()
|
||||
|
||||
def test_set_window_size(self):
|
||||
# event handler
|
||||
self.marionette.execute_script("""
|
||||
window.wrappedJSObject.rcvd_event = false;
|
||||
window.onresize = function() {
|
||||
window.wrappedJSObject.rcvd_event = true;
|
||||
};
|
||||
""")
|
||||
|
||||
# valid size
|
||||
width = self.max_width - 100
|
||||
height = self.max_height - 100
|
||||
self.marionette.set_window_size(width, height)
|
||||
self.wait_for_condition(lambda m: m.execute_script("return window.wrappedJSObject.rcvd_event;"))
|
||||
size = self.marionette.window_size
|
||||
self.assertEqual(size['width'], width,
|
||||
"Window width is %s but should be %s" % (size['width'], width))
|
||||
self.assertEqual(size['height'], height,
|
||||
"Window height is %s but should be %s" % (size['height'], height))
|
||||
|
||||
# invalid size (cannot maximize)
|
||||
with self.assertRaisesRegexp(MarionetteException, "Invalid requested size"):
|
||||
self.marionette.set_window_size(self.max_width, self.max_height)
|
||||
size = self.marionette.window_size
|
||||
self.assertEqual(size['width'], width, "Window width should not have changed")
|
||||
self.assertEqual(size['height'], height, "Window height should not have changed")
|
@ -120,5 +120,7 @@ browser = false
|
||||
[test_click_scrolling.py]
|
||||
[test_profile_management.py]
|
||||
b2g = false
|
||||
[test_set_window_size.py]
|
||||
b2g = false
|
||||
|
||||
[include:oop/manifest.ini]
|
||||
|
@ -2353,6 +2353,59 @@ MarionetteServerConnection.prototype = {
|
||||
this.sendOk(this.command_id);
|
||||
},
|
||||
|
||||
/**
|
||||
* Get the size of the browser window currently in focus.
|
||||
*
|
||||
* Will return the current browser window size in pixels. Refers to
|
||||
* window outerWidth and outerHeight values, which include scroll bars,
|
||||
* title bars, etc.
|
||||
*
|
||||
*/
|
||||
getWindowSize: function MDA_getWindowSize(aRequest) {
|
||||
this.command_id = this.getCommandId();
|
||||
let curWindow = this.getCurrentWindow();
|
||||
let curWidth = curWindow.outerWidth;
|
||||
let curHeight = curWindow.outerHeight;
|
||||
this.sendResponse({width: curWidth, height: curHeight}, this.command_id);
|
||||
},
|
||||
|
||||
/**
|
||||
* Set the size of the browser window currently in focus.
|
||||
*
|
||||
* Not supported on B2G. The supplied width and height values refer to
|
||||
* the window outerWidth and outerHeight values, which include scroll
|
||||
* bars, title bars, etc.
|
||||
*
|
||||
* An error will be returned if the requested window size would result
|
||||
* in the window being in the maximized state.
|
||||
*/
|
||||
setWindowSize: function MDA_setWindowSize(aRequest) {
|
||||
this.command_id = this.getCommandId();
|
||||
|
||||
if (appName == "B2G") {
|
||||
this.sendError("Not supported on B2G", 405, null, this.command_id);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
var width = parseInt(aRequest.parameters.width);
|
||||
var height = parseInt(aRequest.parameters.height);
|
||||
}
|
||||
catch(e) {
|
||||
this.sendError(e.message, e.code, e.stack, this.command_id);
|
||||
return;
|
||||
}
|
||||
|
||||
let curWindow = this.getCurrentWindow();
|
||||
if (width >= curWindow.screen.availWidth && height >= curWindow.screen.availHeight) {
|
||||
this.sendError("Invalid requested size, cannot maximize", 405, null, this.command_id);
|
||||
return;
|
||||
}
|
||||
|
||||
curWindow.resizeTo(width, height);
|
||||
this.sendOk(this.command_id);
|
||||
},
|
||||
|
||||
/**
|
||||
* Helper function to convert an outerWindowID into a UID that Marionette
|
||||
* tracks.
|
||||
@ -2558,7 +2611,9 @@ MarionetteServerConnection.prototype.requestTypes = {
|
||||
"deleteCookie": MarionetteServerConnection.prototype.deleteCookie,
|
||||
"getActiveElement": MarionetteServerConnection.prototype.getActiveElement,
|
||||
"getScreenOrientation": MarionetteServerConnection.prototype.getScreenOrientation,
|
||||
"setScreenOrientation": MarionetteServerConnection.prototype.setScreenOrientation
|
||||
"setScreenOrientation": MarionetteServerConnection.prototype.setScreenOrientation,
|
||||
"getWindowSize": MarionetteServerConnection.prototype.getWindowSize,
|
||||
"setWindowSize": MarionetteServerConnection.prototype.setWindowSize
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -63,7 +63,7 @@
|
||||
COMPONENT(VARIANT, nsVariantConstructor)
|
||||
COMPONENT(INTERFACEINFOMANAGER_SERVICE, nsXPTIInterfaceInfoManagerGetSingleton)
|
||||
|
||||
COMPONENT(HASH_PROPERTY_BAG, nsHashPropertyBagConstructor)
|
||||
COMPONENT(HASH_PROPERTY_BAG, nsHashPropertyBagCCConstructor)
|
||||
|
||||
COMPONENT(UUID_GENERATOR, nsUUIDGeneratorConstructor)
|
||||
|
||||
|
@ -215,7 +215,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(VisualEventTracer)
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsVariant)
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsHashPropertyBag)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsHashPropertyBagCC)
|
||||
|
||||
NS_GENERIC_AGGREGATED_CONSTRUCTOR(nsProperties)
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* -*- Mode: C++; tab-width: 50; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* vim:set ts=4 sw=4 sts=4: */
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* 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/. */
|
||||
@ -12,37 +12,19 @@
|
||||
#include "nsVariant.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
nsresult
|
||||
NS_NewHashPropertyBag(nsIWritablePropertyBag** aResult)
|
||||
{
|
||||
nsRefPtr<nsHashPropertyBag> hpb = new nsHashPropertyBag();
|
||||
hpb.forget(aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*
|
||||
* nsHashPropertyBag impl
|
||||
* nsHashPropertyBagBase implementation.
|
||||
*/
|
||||
|
||||
NS_IMPL_ADDREF(nsHashPropertyBag)
|
||||
NS_IMPL_RELEASE(nsHashPropertyBag)
|
||||
NS_INTERFACE_MAP_BEGIN(nsHashPropertyBag)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWritablePropertyBag)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIPropertyBag, nsIWritablePropertyBag)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWritablePropertyBag)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIPropertyBag2)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWritablePropertyBag2)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHashPropertyBag::HasKey(const nsAString& aName, bool* aResult)
|
||||
nsHashPropertyBagBase::HasKey(const nsAString& aName, bool* aResult)
|
||||
{
|
||||
*aResult = mPropertyHash.Get(aName, nullptr);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHashPropertyBag::Get(const nsAString& aName, nsIVariant** aResult)
|
||||
nsHashPropertyBagBase::Get(const nsAString& aName, nsIVariant** aResult)
|
||||
{
|
||||
if (!mPropertyHash.Get(aName, aResult)) {
|
||||
*aResult = nullptr;
|
||||
@ -52,7 +34,7 @@ nsHashPropertyBag::Get(const nsAString& aName, nsIVariant** aResult)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHashPropertyBag::GetProperty(const nsAString& aName, nsIVariant** aResult)
|
||||
nsHashPropertyBagBase::GetProperty(const nsAString& aName, nsIVariant** aResult)
|
||||
{
|
||||
bool isFound = mPropertyHash.Get(aName, aResult);
|
||||
if (!isFound) {
|
||||
@ -63,7 +45,7 @@ nsHashPropertyBag::GetProperty(const nsAString& aName, nsIVariant** aResult)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHashPropertyBag::SetProperty(const nsAString& aName, nsIVariant* aValue)
|
||||
nsHashPropertyBagBase::SetProperty(const nsAString& aName, nsIVariant* aValue)
|
||||
{
|
||||
if (NS_WARN_IF(!aValue)) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
@ -75,7 +57,7 @@ nsHashPropertyBag::SetProperty(const nsAString& aName, nsIVariant* aValue)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHashPropertyBag::DeleteProperty(const nsAString& aName)
|
||||
nsHashPropertyBagBase::DeleteProperty(const nsAString& aName)
|
||||
{
|
||||
// is it too much to ask for ns*Hashtable to return
|
||||
// a boolean indicating whether RemoveEntry succeeded
|
||||
@ -145,7 +127,7 @@ PropertyHashToArrayFunc(const nsAString& aKey,
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHashPropertyBag::GetEnumerator(nsISimpleEnumerator** aResult)
|
||||
nsHashPropertyBagBase::GetEnumerator(nsISimpleEnumerator** aResult)
|
||||
{
|
||||
nsCOMPtr<nsIMutableArray> propertyArray = nsArray::Create();
|
||||
if (!propertyArray) {
|
||||
@ -159,7 +141,7 @@ nsHashPropertyBag::GetEnumerator(nsISimpleEnumerator** aResult)
|
||||
|
||||
#define IMPL_GETSETPROPERTY_AS(Name, Type) \
|
||||
NS_IMETHODIMP \
|
||||
nsHashPropertyBag::GetPropertyAs ## Name (const nsAString & prop, Type *_retval) \
|
||||
nsHashPropertyBagBase::GetPropertyAs ## Name (const nsAString & prop, Type *_retval) \
|
||||
{ \
|
||||
nsIVariant* v = mPropertyHash.GetWeak(prop); \
|
||||
if (!v) \
|
||||
@ -168,7 +150,7 @@ nsHashPropertyBag::GetPropertyAs ## Name (const nsAString & prop, Type *_retval)
|
||||
} \
|
||||
\
|
||||
NS_IMETHODIMP \
|
||||
nsHashPropertyBag::SetPropertyAs ## Name (const nsAString & prop, Type value) \
|
||||
nsHashPropertyBagBase::SetPropertyAs ## Name (const nsAString & prop, Type value) \
|
||||
{ \
|
||||
nsCOMPtr<nsIWritableVariant> var = new nsVariant(); \
|
||||
var->SetAs ## Name(value); \
|
||||
@ -184,7 +166,7 @@ IMPL_GETSETPROPERTY_AS(Bool, bool)
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHashPropertyBag::GetPropertyAsAString(const nsAString& aProp,
|
||||
nsHashPropertyBagBase::GetPropertyAsAString(const nsAString& aProp,
|
||||
nsAString& aResult)
|
||||
{
|
||||
nsIVariant* v = mPropertyHash.GetWeak(aProp);
|
||||
@ -195,7 +177,7 @@ nsHashPropertyBag::GetPropertyAsAString(const nsAString& aProp,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHashPropertyBag::GetPropertyAsACString(const nsAString& aProp,
|
||||
nsHashPropertyBagBase::GetPropertyAsACString(const nsAString& aProp,
|
||||
nsACString& aResult)
|
||||
{
|
||||
nsIVariant* v = mPropertyHash.GetWeak(aProp);
|
||||
@ -206,7 +188,7 @@ nsHashPropertyBag::GetPropertyAsACString(const nsAString& aProp,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHashPropertyBag::GetPropertyAsAUTF8String(const nsAString& aProp,
|
||||
nsHashPropertyBagBase::GetPropertyAsAUTF8String(const nsAString& aProp,
|
||||
nsACString& aResult)
|
||||
{
|
||||
nsIVariant* v = mPropertyHash.GetWeak(aProp);
|
||||
@ -217,7 +199,7 @@ nsHashPropertyBag::GetPropertyAsAUTF8String(const nsAString& aProp,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHashPropertyBag::GetPropertyAsInterface(const nsAString& aProp,
|
||||
nsHashPropertyBagBase::GetPropertyAsInterface(const nsAString& aProp,
|
||||
const nsIID& aIID,
|
||||
void** aResult)
|
||||
{
|
||||
@ -239,7 +221,7 @@ nsHashPropertyBag::GetPropertyAsInterface(const nsAString& aProp,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHashPropertyBag::SetPropertyAsAString(const nsAString& aProp,
|
||||
nsHashPropertyBagBase::SetPropertyAsAString(const nsAString& aProp,
|
||||
const nsAString& aValue)
|
||||
{
|
||||
nsCOMPtr<nsIWritableVariant> var = new nsVariant();
|
||||
@ -248,7 +230,7 @@ nsHashPropertyBag::SetPropertyAsAString(const nsAString& aProp,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHashPropertyBag::SetPropertyAsACString(const nsAString& aProp,
|
||||
nsHashPropertyBagBase::SetPropertyAsACString(const nsAString& aProp,
|
||||
const nsACString& aValue)
|
||||
{
|
||||
nsCOMPtr<nsIWritableVariant> var = new nsVariant();
|
||||
@ -257,7 +239,7 @@ nsHashPropertyBag::SetPropertyAsACString(const nsAString& aProp,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHashPropertyBag::SetPropertyAsAUTF8String(const nsAString& aProp,
|
||||
nsHashPropertyBagBase::SetPropertyAsAUTF8String(const nsAString& aProp,
|
||||
const nsACString& aValue)
|
||||
{
|
||||
nsCOMPtr<nsIWritableVariant> var = new nsVariant();
|
||||
@ -266,7 +248,7 @@ nsHashPropertyBag::SetPropertyAsAUTF8String(const nsAString& aProp,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsHashPropertyBag::SetPropertyAsInterface(const nsAString& aProp,
|
||||
nsHashPropertyBagBase::SetPropertyAsInterface(const nsAString& aProp,
|
||||
nsISupports* aValue)
|
||||
{
|
||||
nsCOMPtr<nsIWritableVariant> var = new nsVariant();
|
||||
@ -274,3 +256,36 @@ nsHashPropertyBag::SetPropertyAsInterface(const nsAString& aProp,
|
||||
return SetProperty(aProp, var);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* nsHashPropertyBag implementation.
|
||||
*/
|
||||
|
||||
NS_IMPL_ADDREF(nsHashPropertyBag)
|
||||
NS_IMPL_RELEASE(nsHashPropertyBag)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsHashPropertyBag)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWritablePropertyBag)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIPropertyBag, nsIWritablePropertyBag)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWritablePropertyBag)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIPropertyBag2)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWritablePropertyBag2)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
|
||||
/*
|
||||
* nsHashPropertyBagCC implementation.
|
||||
*/
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION(nsHashPropertyBagCC, mPropertyHash)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsHashPropertyBagCC)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsHashPropertyBagCC)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsHashPropertyBagCC)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWritablePropertyBag)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIPropertyBag, nsIWritablePropertyBag)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIWritablePropertyBag)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIPropertyBag2)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWritablePropertyBag2)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
@ -1,4 +1,5 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* 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/. */
|
||||
@ -9,16 +10,16 @@
|
||||
#include "nsIVariant.h"
|
||||
#include "nsIWritablePropertyBag.h"
|
||||
#include "nsIWritablePropertyBag2.h"
|
||||
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsInterfaceHashtable.h"
|
||||
|
||||
class nsHashPropertyBag
|
||||
class nsHashPropertyBagBase
|
||||
: public nsIWritablePropertyBag
|
||||
, public nsIWritablePropertyBag2
|
||||
{
|
||||
public:
|
||||
nsHashPropertyBag() {}
|
||||
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
nsHashPropertyBagBase() {}
|
||||
|
||||
NS_DECL_NSIPROPERTYBAG
|
||||
NS_DECL_NSIPROPERTYBAG2
|
||||
@ -29,12 +30,28 @@ public:
|
||||
protected:
|
||||
// a hash table of string -> nsIVariant
|
||||
nsInterfaceHashtable<nsStringHashKey, nsIVariant> mPropertyHash;
|
||||
};
|
||||
|
||||
class nsHashPropertyBag : public nsHashPropertyBagBase
|
||||
{
|
||||
public:
|
||||
nsHashPropertyBag() {}
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
|
||||
protected:
|
||||
virtual ~nsHashPropertyBag() {}
|
||||
};
|
||||
|
||||
// Note: NS_NewHashPropertyBag returns a HPB that
|
||||
// uses a non-thread-safe internal hash
|
||||
extern "C" nsresult NS_NewHashPropertyBag(nsIWritablePropertyBag** aResult);
|
||||
/* A cycle collected nsHashPropertyBag for main-thread-only use. */
|
||||
class nsHashPropertyBagCC MOZ_FINAL : public nsHashPropertyBagBase
|
||||
{
|
||||
public:
|
||||
nsHashPropertyBagCC() {}
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsHashPropertyBagCC,
|
||||
nsIWritablePropertyBag)
|
||||
protected:
|
||||
virtual ~nsHashPropertyBagCC() {}
|
||||
};
|
||||
|
||||
#endif /* nsHashPropertyBag_h___ */
|
||||
|
Loading…
Reference in New Issue
Block a user