Merge inbound to m-c. a=merge

This commit is contained in:
Ryan VanderMeulen 2015-07-22 16:34:07 -04:00
commit 716f0d7045
36 changed files with 873 additions and 845 deletions

View File

@ -627,7 +627,9 @@ pref("app.update.socket.maxErrors", 20);
pref("app.update.log", true);
// SystemUpdate API
#ifdef MOZ_WIDGET_GONK
pref("dom.system_update.active", "@mozilla.org/updates/update-prompt;1");
#endif
#else
// Explicitly disable the shutdown watchdog. It's enabled by default.
// When the updater is disabled, we want to know about shutdown hangs.

View File

@ -55,7 +55,6 @@ skip-if = !crashreporter
[browser_CTP_data_urls.js]
[browser_CTP_drag_drop.js]
[browser_CTP_hide_overlay.js]
skip-if = true # Bug 1160788
[browser_CTP_iframe.js]
skip-if = os == 'linux' || os == 'mac' # Bug 984821
[browser_CTP_multi_allow.js]

View File

@ -7212,8 +7212,12 @@ HTMLInputElement::SetFilePickerFiltersFromAccept(nsIFilePicker* filePicker)
filterBundle->GetStringFromName(MOZ_UTF16("videoFilter"),
getter_Copies(extensionListStr));
} else if (token.First() == '.') {
if (token.FindChar(';') >= 0 || token.FindChar('*') >= 0) {
// Ignore this filter as it contains reserved characters
continue;
}
extensionListStr = NS_LITERAL_STRING("*") + token;
filterName = extensionListStr + NS_LITERAL_STRING("; ");
filterName = extensionListStr;
atLeastOneFileExtensionFilter = true;
} else {
//... if no image/audio/video filter is found, check mime types filters
@ -7291,7 +7295,14 @@ HTMLInputElement::SetFilePickerFiltersFromAccept(nsIFilePicker* filePicker)
if (i == j) {
continue;
}
if (FindInReadable(filterToCheck.mFilter, filtersCopy[j].mFilter)) {
// Check if this filter's extension list is a substring of the other one.
// e.g. if filters are "*.jpeg" and "*.jpeg; *.jpg" the first one should
// be removed.
// Add an extra "; " to be sure the check will work and avoid cases like
// "*.xls" being a subtring of "*.xslx" while those are two differents
// filters and none should be removed.
if (FindInReadable(filterToCheck.mFilter + NS_LITERAL_STRING(";"),
filtersCopy[j].mFilter + NS_LITERAL_STRING(";"))) {
// We already have a similar, less restrictive filter (i.e.
// filterToCheck extensionList is just a subset of another filter
// extension list): remove this one

View File

@ -31,7 +31,16 @@
<input id='o' type="file" accept=".test">
<input id='p' type="file" accept="image/gif,.csv">
<input id='q' type="file" accept="image/gif,.gif">
<input id='r' type="file" accept=".prefix,.prefixPlusSomething">
<input id='s' type="file" accept=".xls,.xlsx">
<input id='t' type="file" accept=".mp3,.wav,.flac">
<input id='u' type="file" accept=".xls, .xlsx">
<input id='v' type="file" accept=".xlsx, .xls">
<input id='w' type="file" accept=".xlsx; .xls">
<input id='x' type="file" accept=".xls, .xlsx">
<input id='y' type="file" accept=".xlsx, .xls">
<input id='z' type='file' accept="i/am,a,pathological,;,,,,test/case">
<input id='A' type="file" accept=".xlsx, .xls*">
<input id='mix-ref' type="file" accept="image/jpeg">
<input id='mix' type="file" accept="image/jpeg,.jpg">
<input id='hidden' hidden type='file'>
@ -91,7 +100,16 @@ var testData = [["a", 1, MockFilePicker.filterImages, 1],
["o", 1, "*.test", 1],
["p", 3, "*.gif; *.csv", 1],
["q", 1, "*.gif", 1],
["r", 3, "*.prefix; *.prefixPlusSomething", 1],
["s", 3, "*.xls; *.xlsx", 1],
["t", 4, "*.mp3; *.wav; *.flac", 1],
["u", 3, "*.xls; *.xlsx", 1],
["v", 3, "*.xlsx; *.xls", 1],
["w", 0, undefined, 0],
["x", 3, "*.xls; *.xlsx", 1],
["y", 3, "*.xlsx; *.xls", 1],
["z", 0, undefined, 0],
["A", 1, "*.xlsx", 1],
// Note: mix and mix-ref tests extension lists are checked differently: see SimpleTest.executeSoon below
["mix-ref", undefined, undefined, undefined],
["mix", 1, undefined, 1],

View File

@ -86,7 +86,7 @@ AudioSink::HasUnplayedFrames()
}
void
AudioSink::PrepareToShutdown()
AudioSink::Shutdown()
{
AssertCurrentThreadInMonitor();
mStopAudioThread = true;
@ -94,11 +94,8 @@ AudioSink::PrepareToShutdown()
mAudioStream->Cancel();
}
GetReentrantMonitor().NotifyAll();
}
void
AudioSink::Shutdown()
{
ReentrantMonitorAutoExit exit(GetReentrantMonitor());
mThread->Shutdown();
mThread = nullptr;
if (mAudioStream) {

View File

@ -37,12 +37,8 @@ public:
// played.
bool HasUnplayedFrames();
// Tell the AudioSink to stop processing and initiate shutdown. Must be
// called with the decoder monitor held.
void PrepareToShutdown();
// Shut down the AudioSink's resources. The decoder monitor must not be
// held during this call, as it may block processing thread event queues.
// Shut down the AudioSink's resources.
// Must be called with the decoder monitor held.
void Shutdown();
void SetVolume(double aVolume);

View File

@ -655,25 +655,6 @@ void MediaDecoder::QueueMetadata(int64_t aPublishTime,
mDecoderStateMachine->QueueMetadata(aPublishTime, aInfo, aTags);
}
bool
MediaDecoder::IsExpectingMoreData()
{
ReentrantMonitorAutoEnter mon(GetReentrantMonitor());
// If there's no resource, we're probably just getting set up.
if (!mResource) {
return true;
}
// If we've downloaded anything, we're not waiting for anything.
if (mResource->IsDataCachedToEndOfResource(mDecoderPosition)) {
return false;
}
// Otherwise, we should be getting data unless the stream is suspended.
return !mResource->IsSuspended();
}
void MediaDecoder::MetadataLoaded(nsAutoPtr<MediaInfo> aInfo,
nsAutoPtr<MetadataTags> aTags,
MediaDecoderEventVisibility aEventVisibility)

View File

@ -622,13 +622,6 @@ public:
// the track list. Call on the main thread only.
virtual void RemoveMediaTracks() override;
// Returns true if the this decoder is expecting any more data to arrive
// sometime in the not-too-distant future, either from the network or from
// an appendBuffer call on a MediaSource element.
//
// Acquires the monitor. Call from any thread.
virtual bool IsExpectingMoreData();
// Called when the video has completed playing.
// Call on the main thread only.
void PlaybackEnded();

View File

@ -1282,9 +1282,6 @@ void MediaDecoderStateMachine::Shutdown()
// threads can start exiting cleanly during the Shutdown call.
ScheduleStateMachine();
SetState(DECODER_STATE_SHUTDOWN);
if (mAudioSink) {
mAudioSink->PrepareToShutdown();
}
mQueuedSeek.RejectIfExists(__func__);
mPendingSeek.RejectIfExists(__func__);
@ -1473,11 +1470,7 @@ void MediaDecoderStateMachine::StopAudioThread()
if (mAudioSink) {
DECODER_LOG("Shutdown audio thread");
mAudioSink->PrepareToShutdown();
{
ReentrantMonitorAutoExit exitMon(mDecoder->GetReentrantMonitor());
mAudioSink->Shutdown();
}
mAudioSink->Shutdown();
mAudioSink = nullptr;
}
mAudioSinkPromise.DisconnectIfExists();
@ -2374,7 +2367,7 @@ nsresult MediaDecoderStateMachine::RunStateMachine()
elapsed < TimeDuration::FromSeconds(mBufferingWait * mPlaybackRate) &&
(mQuickBuffering ? HasLowDecodedData(mQuickBufferingLowDataThresholdUsecs)
: HasLowUndecodedData(mBufferingWait * USECS_PER_S)) &&
mDecoder->IsExpectingMoreData())
mResource->IsExpectingMoreData())
{
DECODER_LOG("Buffering: wait %ds, timeout in %.3lfs %s",
mBufferingWait, mBufferingWait - elapsed.ToSeconds(),
@ -2734,7 +2727,7 @@ void MediaDecoderStateMachine::UpdateRenderedVideoFrames()
// If we don't, switch to buffering mode.
if (mState == DECODER_STATE_DECODING &&
mPlayState == MediaDecoder::PLAY_STATE_PLAYING &&
mDecoder->IsExpectingMoreData()) {
mResource->IsExpectingMoreData()) {
bool shouldBuffer;
if (mReader->UseBufferingHeuristics()) {
shouldBuffer = HasLowDecodedData(remainingTime + EXHAUSTED_DATA_MARGIN_USECS) &&

View File

@ -402,6 +402,15 @@ public:
// Returns true if all the data from aOffset to the end of the stream
// is in cache. If the end of the stream is not known, we return false.
virtual bool IsDataCachedToEndOfResource(int64_t aOffset) = 0;
// Returns true if we are expecting any more data to arrive
// sometime in the not-too-distant future, either from the network or from
// an appendBuffer call on a MediaSource element.
virtual bool IsExpectingMoreData()
{
// MediaDecoder::mDecoderPosition is roughly the same as Tell() which
// returns a position updated by latest Read() or ReadAt().
return !IsDataCachedToEndOfResource(Tell()) && !IsSuspended();
}
// Returns true if this stream is suspended by the cache because the
// cache is full. If true then the decoder should try to start consuming
// data, otherwise we may not be able to make progress.

View File

@ -49,7 +49,7 @@ static BOOL CALLBACK EnumDisplayMonitorsCallback(HMONITOR hMonitor, HDC hdc,
&numVideoOutputs,
&opmVideoOutputArray);
if (S_OK != hr) {
if (0x8007001f != hr && 0x80070032 != hr) {
if (0x8007001f != hr && 0x80070032 != hr && 0xc02625e5 != hr) {
char msg[100];
sprintf(msg, "FAIL OPMGetVideoOutputsFromHMONITOR call failed: HRESULT=0x%08x", hr);
failureMsgs->push_back(msg);

View File

@ -215,12 +215,6 @@ MediaSourceDecoder::Ended(bool aEnded)
mon.NotifyAll();
}
bool
MediaSourceDecoder::IsExpectingMoreData()
{
return !mEnded;
}
void
MediaSourceDecoder::SetInitialDuration(int64_t aDuration)
{

View File

@ -65,7 +65,6 @@ public:
void OnTrackBufferConfigured(TrackBuffer* aTrackBuffer, const MediaInfo& aInfo);
void Ended(bool aEnded);
bool IsExpectingMoreData() override;
// Return the duration of the video in seconds.
virtual double GetDuration() override;

View File

@ -77,6 +77,12 @@ public:
mEnded = aEnded;
}
virtual bool IsExpectingMoreData() override
{
MonitorAutoLock mon(mMonitor);
return !mEnded;
}
private:
virtual size_t SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const override
{

View File

@ -54,8 +54,12 @@ const kAllSettingsWritePermission = "settings" + kSettingsWriteSuffix;
// will be allowed depends on the exact permissions the app has.
const kSomeSettingsReadPermission = "settings-api" + kSettingsReadSuffix;
const kSomeSettingsWritePermission = "settings-api" + kSettingsWriteSuffix;
// Time, in seconds, to consider the API is starting to jam
const kSoftLockupDelta = 30;
let kSoftLockupDelta = 30;
try {
kSoftLockupDelta = Services.prefs.getIntPref("dom.mozSettings.softLockupDelta");
} catch (ex) { }
XPCOMUtils.defineLazyServiceGetter(this, "mrm",
"@mozilla.org/memory-reporter-manager;1",

View File

@ -472,34 +472,18 @@ DOMStorageManager::GetLocalStorageForPrincipal(nsIPrincipal* aPrincipal,
return CreateStorage(nullptr, aPrincipal, aDocumentURI, aPrivate, aRetval);
}
namespace {
class ClearCacheEnumeratorData
void
DOMStorageManager::ClearCaches(uint32_t aUnloadFlags,
const nsACString& aKeyPrefix)
{
public:
explicit ClearCacheEnumeratorData(uint32_t aFlags)
: mUnloadFlags(aFlags)
{}
for (auto iter = mCaches.Iter(); !iter.Done(); iter.Next()) {
DOMStorageCache* cache = iter.Get()->cache();
nsCString& key = const_cast<nsCString&>(cache->Scope());
uint32_t mUnloadFlags;
nsCString mKeyPrefix;
};
} // namespace
PLDHashOperator
DOMStorageManager::ClearCacheEnumerator(DOMStorageCacheHashKey* aEntry, void* aClosure)
{
DOMStorageCache* cache = aEntry->cache();
nsCString& key = const_cast<nsCString&>(cache->Scope());
ClearCacheEnumeratorData* data = static_cast<ClearCacheEnumeratorData*>(aClosure);
if (data->mKeyPrefix.IsEmpty() || StringBeginsWith(key, data->mKeyPrefix)) {
cache->UnloadItems(data->mUnloadFlags);
if (aKeyPrefix.IsEmpty() || StringBeginsWith(key, aKeyPrefix)) {
cache->UnloadItems(aUnloadFlags);
}
}
return PL_DHASH_NEXT;
}
nsresult
@ -507,37 +491,27 @@ DOMStorageManager::Observe(const char* aTopic, const nsACString& aScopePrefix)
{
// Clear everything, caches + database
if (!strcmp(aTopic, "cookie-cleared")) {
ClearCacheEnumeratorData data(DOMStorageCache::kUnloadComplete);
mCaches.EnumerateEntries(ClearCacheEnumerator, &data);
ClearCaches(DOMStorageCache::kUnloadComplete, EmptyCString());
return NS_OK;
}
// Clear from caches everything that has been stored
// while in session-only mode
if (!strcmp(aTopic, "session-only-cleared")) {
ClearCacheEnumeratorData data(DOMStorageCache::kUnloadSession);
data.mKeyPrefix = aScopePrefix;
mCaches.EnumerateEntries(ClearCacheEnumerator, &data);
ClearCaches(DOMStorageCache::kUnloadSession, aScopePrefix);
return NS_OK;
}
// Clear everything (including so and pb data) from caches and database
// for the gived domain and subdomains.
if (!strcmp(aTopic, "domain-data-cleared")) {
ClearCacheEnumeratorData data(DOMStorageCache::kUnloadComplete);
data.mKeyPrefix = aScopePrefix;
mCaches.EnumerateEntries(ClearCacheEnumerator, &data);
ClearCaches(DOMStorageCache::kUnloadComplete, aScopePrefix);
return NS_OK;
}
// Clear all private-browsing caches
if (!strcmp(aTopic, "private-browsing-data-cleared")) {
ClearCacheEnumeratorData data(DOMStorageCache::kUnloadPrivate);
mCaches.EnumerateEntries(ClearCacheEnumerator, &data);
ClearCaches(DOMStorageCache::kUnloadPrivate, EmptyCString());
return NS_OK;
}
@ -549,18 +523,13 @@ DOMStorageManager::Observe(const char* aTopic, const nsACString& aScopePrefix)
return NS_OK;
}
ClearCacheEnumeratorData data(DOMStorageCache::kUnloadComplete);
data.mKeyPrefix = aScopePrefix;
mCaches.EnumerateEntries(ClearCacheEnumerator, &data);
ClearCaches(DOMStorageCache::kUnloadComplete, aScopePrefix);
return NS_OK;
}
if (!strcmp(aTopic, "profile-change")) {
// For case caches are still referenced - clear them completely
ClearCacheEnumeratorData data(DOMStorageCache::kUnloadComplete);
mCaches.EnumerateEntries(ClearCacheEnumerator, &data);
ClearCaches(DOMStorageCache::kUnloadComplete, EmptyCString());
mCaches.Clear();
return NS_OK;
}
@ -588,8 +557,7 @@ DOMStorageManager::Observe(const char* aTopic, const nsACString& aScopePrefix)
}
// This immediately completely reloads all caches from the database.
ClearCacheEnumeratorData data(DOMStorageCache::kTestReload);
mCaches.EnumerateEntries(ClearCacheEnumerator, &data);
ClearCaches(DOMStorageCache::kTestReload, EmptyCString());
return NS_OK;
}

View File

@ -99,8 +99,7 @@ private:
bool mLowDiskSpace;
bool IsLowDiskSpace() const { return mLowDiskSpace; };
static PLDHashOperator ClearCacheEnumerator(DOMStorageCacheHashKey* aCache,
void* aClosure);
void ClearCaches(uint32_t aUnloadFlags, const nsACString& aKeyPrefix);
protected:
// Keeps usage cache objects for eTLD+1 scopes we have touched.

View File

@ -296,6 +296,7 @@ TiledLayerBufferComposite::UseTiles(const SurfaceDescriptorTiles& aTiles,
}
tile.mTextureHost = TextureHost::AsTextureHost(texturedDesc.textureParent());
tile.mTextureHost->SetCompositor(aCompositor);
if (texturedDesc.textureOnWhite().type() == MaybeTexture::TPTextureParent) {
tile.mTextureHostOnWhite =

View File

@ -8497,7 +8497,7 @@ CheckComparison(FunctionBuilder& f, ParseNode* comp, Type* type)
}
I32 stmt;
if (lhsType.isSigned()) {
if (lhsType.isSigned() && rhsType.isSigned()) {
switch (comp->getOp()) {
case JSOP_EQ: stmt = I32::EqI32; break;
case JSOP_NE: stmt = I32::NeI32; break;
@ -8507,7 +8507,7 @@ CheckComparison(FunctionBuilder& f, ParseNode* comp, Type* type)
case JSOP_GE: stmt = I32::SGeI32; break;
default: MOZ_CRASH("unexpected comparison op");
}
} else if (lhsType.isUnsigned()) {
} else if (lhsType.isUnsigned() && rhsType.isUnsigned()) {
switch (comp->getOp()) {
case JSOP_EQ: stmt = I32::EqI32; break;
case JSOP_NE: stmt = I32::NeI32; break;

View File

@ -2651,6 +2651,32 @@ SetGCCallback(JSContext* cx, unsigned argc, Value* vp)
return true;
}
static bool
SetARMHwCapFlags(JSContext* cx, unsigned argc, Value* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
if (args.length() != 1) {
JS_ReportError(cx, "Wrong number of arguments");
return false;
}
RootedString flagsListString(cx, JS::ToString(cx, args.get(0)));
if (!flagsListString)
return false;
#if defined(JS_CODEGEN_ARM)
JSAutoByteString flagsList(cx, flagsListString);
if (!flagsList)
return false;
jit::ParseARMHwCapFlags(flagsList.ptr());
#endif
args.rval().setUndefined();
return true;
}
static const JSFunctionSpecWithHelp TestingFunctions[] = {
JS_FN_HELP("gc", ::GC, 0, 0,
"gc([obj] | 'compartment' [, 'shrinking'])",
@ -3081,6 +3107,11 @@ gc::ZealModeHelpText),
" 'minorGC' - run a nursery collection\n"
" 'majorGC' - run a major collection, nesting up to a given 'depth'\n"),
JS_FN_HELP("setARMHwCapFlags", SetARMHwCapFlags, 1, 0,
"setARMHwCapFlags(\"flag1,flag2 flag3\")",
" On non-ARM, no-op. On ARM, set the hardware capabilities. The list of \n"
" flags is available by calling this function with \"help\" as the flag's name"),
JS_FS_HELP_END
};

View File

@ -2,8 +2,9 @@
if (!this.Atomics)
quit();
function m(stdlib, ffi, heap)
{
load(libdir + "asm.js");
var code = `
"use asm";
var HEAP32 = new stdlib.SharedInt32Array(heap);
@ -16,35 +17,33 @@ function m(stdlib, ffi, heap)
// kernel is derived from the large test case in that bug.
function add_sharedEv(i1) {
i1 = i1 | 0;
var i2 = 0;
var xx = 0;
i2 = i1 + 4 | 0;
i1 = load(HEAP32, i2 >> 2) | 0;
_emscripten_asm_const_int(7, i2 | 0, i1 | 0) | 0;
add(HEAP32, i2 >> 2, 1) | 0;
_emscripten_asm_const_int(8, i2 | 0, load(HEAP32, i2 >> 2) | 0, i1 + 1 | 0) | 0;
return xx|0;
i1 = i1 | 0;
var i2 = 0;
var xx = 0;
i2 = i1 + 4 | 0;
i1 = load(HEAP32, i2 >> 2) | 0;
_emscripten_asm_const_int(7, i2 | 0, i1 | 0) | 0;
add(HEAP32, i2 >> 2, 1) | 0;
_emscripten_asm_const_int(8, i2 | 0, load(HEAP32, i2 >> 2) | 0, i1 + 1 | 0) | 0;
return xx|0;
}
return {add_sharedEv:add_sharedEv};
}
if (isAsmJSCompilationAvailable())
assertEq(isAsmJSModule(m), true);
`;
var x;
var sab = new SharedArrayBuffer(65536);
var ffi =
{ _emscripten_asm_const_int:
function (...rest) {
//print("OUT: " + rest.join(" "));
if (rest[0] == 8)
x = rest[2];
}
function (...rest) {
//print("OUT: " + rest.join(" "));
if (rest[0] == 8)
x = rest[2];
}
};
var {add_sharedEv} = m(this, ffi, sab);
var m = asmCompile('stdlib', 'ffi', 'heap', code);
var {add_sharedEv} = asmLink(m, this, ffi, sab);
add_sharedEv(13812);
assertEq(x, 1);

File diff suppressed because it is too large Load Diff

View File

@ -262,6 +262,9 @@ assertAsmTypeFail(USE_ASM + "function f() { var i=42,j=1.1; return +(i?i:j) } re
assertEq(asmLink(asmCompile(USE_ASM + "function f() { var i=42,j=1.1; return +(i?+(i|0):j) } return f"))(), 42);
assertEq(asmLink(asmCompile(USE_ASM + "function f() { var i=42,j=1; return (i?i:j)|0 } return f"))(), 42);
assertEq(asmLink(asmCompile(USE_ASM + "function f() { return (0 > (-(~~1) >>> 0)) | 0; } return f"))(), 0);
assertEq(asmLink(asmCompile(USE_ASM + "function f() { return 0 < 4294967294 | 0; } return f"))(), 1);
var f = asmLink(asmCompile(USE_ASM + "function f(i,j) { i=i|0;j=j|0; return ((i|0)>(j|0)?(i+10)|0:(j+100)|0)|0 } return f"));
assertEq(f(2, 4), 104);
assertEq(f(-2, -4), 8);

View File

@ -45,8 +45,10 @@ BytecodeAnalysis::init(TempAllocator& alloc, GSNCache& gsn)
if (!infos_.growByUninitialized(script_->length()))
return false;
// We need a scope chain if any of the bindings are aliased.
usesScopeChain_ = script_->hasAnyAliasedBindings();
// We need a scope chain if the function is heavyweight.
usesScopeChain_ = (script_->functionDelazifying() &&
script_->functionDelazifying()->isHeavyweight());
MOZ_ASSERT_IF(script_->hasAnyAliasedBindings(), usesScopeChain_);
jsbytecode* end = script_->codeEnd();

View File

@ -1008,13 +1008,10 @@ CodeGenerator::visitRegExp(LRegExp* lir)
callVM(CloneRegExpObjectInfo, lir);
}
// The maximum number of pairs we can handle when executing RegExps inline.
static const size_t RegExpMaxPairCount = 6;
// Amount of space to reserve on the stack when executing RegExps inline.
static const size_t RegExpReservedStack = sizeof(irregexp::InputOutputData)
+ sizeof(MatchPairs)
+ RegExpMaxPairCount * sizeof(MatchPair);
+ RegExpObject::MaxPairCount * sizeof(MatchPair);
static size_t
RegExpPairsVectorStartOffset(size_t inputOutputDataStartOffset)
@ -1093,7 +1090,7 @@ PrepareAndExecuteRegExp(JSContext* cx, MacroAssembler& masm, Register regexp, Re
if (mode == RegExpShared::Normal) {
// Don't handle RegExps with excessive parens.
masm.load32(Address(temp1, RegExpShared::offsetOfParenCount()), temp2);
masm.branch32(Assembler::AboveOrEqual, temp2, Imm32(RegExpMaxPairCount), failure);
masm.branch32(Assembler::AboveOrEqual, temp2, Imm32(RegExpObject::MaxPairCount), failure);
// Fill in the paren count in the MatchPairs on the stack.
masm.add32(Imm32(1), temp2);
@ -1342,7 +1339,7 @@ JitCompartment::generateRegExpExecStub(JSContext* cx)
// The template object should have enough space for the maximum number of
// pairs this stub can handle.
MOZ_ASSERT(ObjectElements::VALUES_PER_HEADER + RegExpMaxPairCount ==
MOZ_ASSERT(ObjectElements::VALUES_PER_HEADER + RegExpObject::MaxPairCount ==
gc::GetGCKindSlots(templateObject->asTenured().getAllocKind()));
MacroAssembler masm(cx);

View File

@ -50,7 +50,7 @@ ParseARMCpuFeatures(const char* features, bool override = false)
uint32_t flags = 0;
for (;;) {
char ch = *features;
char ch = *features;
if (!ch) {
// End of string.
break;

View File

@ -825,7 +825,8 @@ RegExpCompartment::createMatchResultTemplateObject(JSContext* cx)
MOZ_ASSERT(!matchResultTemplateObject_);
/* Create template array object */
RootedArrayObject templateObject(cx, NewDenseUnallocatedArray(cx, 0, nullptr, TenuredObject));
RootedArrayObject templateObject(cx, NewDenseUnallocatedArray(cx, RegExpObject::MaxPairCount,
nullptr, TenuredObject));
if (!templateObject)
return matchResultTemplateObject_; // = nullptr

View File

@ -360,6 +360,10 @@ class RegExpObject : public NativeObject
static const Class class_;
// The maximum number of pairs a MatchResult can have, without having to
// allocate a bigger MatchResult.
static const size_t MaxPairCount = 14;
/*
* Note: The regexp statics flags are OR'd into the provided flags,
* so this function is really meant for object creation during code

View File

@ -32,6 +32,9 @@ namespace net {
// Initial elements buffer size.
#define kInitialBufSize 64
// Max size of elements in bytes.
#define kMaxElementsSize 64*1024
#define kCacheEntryVersion 1
#define NOW_SECONDS() (uint32_t(PR_Now() / PR_USEC_PER_SEC))
@ -236,6 +239,17 @@ CacheFileMetadata::ReadMetadata(CacheFileMetadataListener *aListener)
return NS_OK;
}
uint32_t
CacheFileMetadata::CalcMetadataSize(uint32_t aElementsSize, uint32_t aHashCount)
{
return sizeof(uint32_t) + // hash of the metadata
aHashCount * sizeof(CacheHash::Hash16_t) + // array of chunk hashes
sizeof(CacheFileMetadataHeader) + // metadata header
mKey.Length() + 1 + // key with trailing null
aElementsSize + // elements
sizeof(uint32_t); // offset
}
nsresult
CacheFileMetadata::WriteMetadata(uint32_t aOffset,
CacheFileMetadataListener *aListener)
@ -250,10 +264,11 @@ CacheFileMetadata::WriteMetadata(uint32_t aOffset,
mIsDirty = false;
mWriteBuf = static_cast<char *>(moz_xmalloc(sizeof(uint32_t) +
mHashCount * sizeof(CacheHash::Hash16_t) +
sizeof(CacheFileMetadataHeader) + mKey.Length() + 1 +
mElementsSize + sizeof(uint32_t)));
mWriteBuf = static_cast<char *>(malloc(CalcMetadataSize(mElementsSize,
mHashCount)));
if (!mWriteBuf) {
return NS_ERROR_OUT_OF_MEMORY;
}
char *p = mWriteBuf + sizeof(uint32_t);
memcpy(p, mHashArray, mHashCount * sizeof(CacheHash::Hash16_t));
@ -406,6 +421,8 @@ CacheFileMetadata::SetElement(const char *aKey, const char *aValue)
MarkDirty();
nsresult rv;
const uint32_t keySize = strlen(aKey) + 1;
char *pos = const_cast<char *>(GetElement(aKey));
@ -431,7 +448,10 @@ CacheFileMetadata::SetElement(const char *aKey, const char *aValue)
// Update the value in place
newSize -= oldValueSize;
EnsureBuffer(newSize);
rv = EnsureBuffer(newSize);
if (NS_FAILED(rv)) {
return rv;
}
// Move the remainder to the right place
pos = mBuf + offset;
@ -439,7 +459,10 @@ CacheFileMetadata::SetElement(const char *aKey, const char *aValue)
} else {
// allocate new meta data element
newSize += keySize;
EnsureBuffer(newSize);
rv = EnsureBuffer(newSize);
if (NS_FAILED(rv)) {
return rv;
}
// Add after last element
pos = mBuf + mElementsSize;
@ -665,7 +688,7 @@ CacheFileMetadata::OnDataRead(CacheFileHandle *aHandle, char *aBuf,
if (realOffset >= size) {
LOG(("CacheFileMetadata::OnDataRead() - Invalid realOffset, creating "
"empty metadata. [this=%p, realOffset=%d, size=%lld]", this,
"empty metadata. [this=%p, realOffset=%u, size=%lld]", this,
realOffset, size));
InitEmptyMetadata();
@ -675,6 +698,21 @@ CacheFileMetadata::OnDataRead(CacheFileHandle *aHandle, char *aBuf,
return NS_OK;
}
uint32_t maxHashCount = size / kChunkSize;
uint32_t maxMetadataSize = CalcMetadataSize(kMaxElementsSize, maxHashCount);
if (size - realOffset > maxMetadataSize) {
LOG(("CacheFileMetadata::OnDataRead() - Invalid realOffset, metadata would "
"be too big, creating empty metadata. [this=%p, realOffset=%u, "
"maxMetadataSize=%u, size=%lld]", this, realOffset, maxMetadataSize,
size));
InitEmptyMetadata();
mListener.swap(listener);
listener->OnMetadataRead(NS_OK);
return NS_OK;
}
uint32_t usedOffset = size - mBufSize;
if (realOffset < usedOffset) {
@ -932,9 +970,13 @@ CacheFileMetadata::CheckElements(const char *aBuf, uint32_t aSize)
return NS_OK;
}
void
nsresult
CacheFileMetadata::EnsureBuffer(uint32_t aSize)
{
if (aSize > kMaxElementsSize) {
return NS_ERROR_FAILURE;
}
if (mBufSize < aSize) {
if (mAllocExactSize) {
// If this is not the only allocation, use power of two for following
@ -955,11 +997,17 @@ CacheFileMetadata::EnsureBuffer(uint32_t aSize)
aSize = kInitialBufSize;
}
char *newBuf = static_cast<char *>(realloc(mBuf, aSize));
if (!newBuf) {
return NS_ERROR_OUT_OF_MEMORY;
}
mBufSize = aSize;
mBuf = static_cast<char *>(moz_xrealloc(mBuf, mBufSize));
mBuf = newBuf;
DoMemoryReport(MemoryUsage());
}
return NS_OK;
}
nsresult

View File

@ -121,6 +121,7 @@ public:
nsresult GetKey(nsACString &_retval);
nsresult ReadMetadata(CacheFileMetadataListener *aListener);
uint32_t CalcMetadataSize(uint32_t aElementsSize, uint32_t aHashCount);
nsresult WriteMetadata(uint32_t aOffset,
CacheFileMetadataListener *aListener);
nsresult SyncReadMetadata(nsIFile *aFile);
@ -171,7 +172,7 @@ private:
void InitEmptyMetadata();
nsresult ParseMetadata(uint32_t aMetaOffset, uint32_t aBufOffset, bool aHaveKey);
nsresult CheckElements(const char *aBuf, uint32_t aSize);
void EnsureBuffer(uint32_t aSize);
nsresult EnsureBuffer(uint32_t aSize);
nsresult ParseKey(const nsACString &aKey);
nsRefPtr<CacheFileHandle> mHandle;

View File

@ -103,6 +103,18 @@ CacheFileOutputStream::Write(const char * aBuf, uint32_t aCount,
return NS_ERROR_FILE_TOO_BIG;
}
// We use 64-bit offset when accessing the file, unfortunatelly we use 32-bit
// metadata offset, so we cannot handle data bigger than 4GB.
if (mPos + aCount > PR_UINT32_MAX) {
LOG(("CacheFileOutputStream::Write() - Entry's size exceeds 4GB while it "
"isn't too big according to CacheObserver::EntryIsTooBig(). Failing "
"and dooming the entry. [this=%p]", this));
mFile->DoomLocked(nullptr);
CloseWithStatusLocked(NS_ERROR_FILE_TOO_BIG);
return NS_ERROR_FILE_TOO_BIG;
}
*_retval = aCount;
while (aCount) {

View File

@ -65,11 +65,11 @@ bool CacheObserver::sSmartCacheSizeEnabled = kDefaultSmartCacheSizeEnabled;
static uint32_t const kDefaultPreloadChunkCount = 4;
uint32_t CacheObserver::sPreloadChunkCount = kDefaultPreloadChunkCount;
static uint32_t const kDefaultMaxMemoryEntrySize = 4 * 1024; // 4 MB
uint32_t CacheObserver::sMaxMemoryEntrySize = kDefaultMaxMemoryEntrySize;
static int32_t const kDefaultMaxMemoryEntrySize = 4 * 1024; // 4 MB
int32_t CacheObserver::sMaxMemoryEntrySize = kDefaultMaxMemoryEntrySize;
static uint32_t const kDefaultMaxDiskEntrySize = 50 * 1024; // 50 MB
uint32_t CacheObserver::sMaxDiskEntrySize = kDefaultMaxDiskEntrySize;
static int32_t const kDefaultMaxDiskEntrySize = 50 * 1024; // 50 MB
int32_t CacheObserver::sMaxDiskEntrySize = kDefaultMaxDiskEntrySize;
static uint32_t const kDefaultMaxDiskChunksMemoryUsage = 10 * 1024; // 10MB
uint32_t CacheObserver::sMaxDiskChunksMemoryUsage = kDefaultMaxDiskChunksMemoryUsage;
@ -170,9 +170,9 @@ CacheObserver::AttachToPreferences()
mozilla::Preferences::AddUintVarCache(
&sPreloadChunkCount, "browser.cache.disk.preload_chunk_count", kDefaultPreloadChunkCount);
mozilla::Preferences::AddUintVarCache(
mozilla::Preferences::AddIntVarCache(
&sMaxDiskEntrySize, "browser.cache.disk.max_entry_size", kDefaultMaxDiskEntrySize);
mozilla::Preferences::AddUintVarCache(
mozilla::Preferences::AddIntVarCache(
&sMaxMemoryEntrySize, "browser.cache.memory.max_entry_size", kDefaultMaxMemoryEntrySize);
mozilla::Preferences::AddUintVarCache(
@ -472,9 +472,12 @@ CacheStorageEvictHelper::ClearStorage(bool const aPrivate,
bool const CacheObserver::EntryIsTooBig(int64_t aSize, bool aUsingDisk)
{
// If custom limit is set, check it.
int64_t preferredLimit = aUsingDisk
? static_cast<int64_t>(sMaxDiskEntrySize) << 10
: static_cast<int64_t>(sMaxMemoryEntrySize) << 10;
int64_t preferredLimit = aUsingDisk ? sMaxDiskEntrySize : sMaxMemoryEntrySize;
// do not convert to bytes when the limit is -1, which means no limit
if (preferredLimit > 0) {
preferredLimit <<= 10;
}
if (preferredLimit != -1 && aSize > preferredLimit)
return true;

View File

@ -90,8 +90,8 @@ private:
static uint32_t sDiskFreeSpaceHardLimit;
static bool sSmartCacheSizeEnabled;
static uint32_t sPreloadChunkCount;
static uint32_t sMaxMemoryEntrySize;
static uint32_t sMaxDiskEntrySize;
static int32_t sMaxMemoryEntrySize;
static int32_t sMaxDiskEntrySize;
static uint32_t sMaxDiskChunksMemoryUsage;
static uint32_t sMaxDiskPriorityChunksMemoryUsage;
static uint32_t sCompressionLevel;

View File

@ -19,7 +19,6 @@ static const char* const kIntolerantFallbackList[] =
"access.boekhuis.nl", // bug 1151580
"account.61.com.tw",
"acs.sia.eu", // RC4
"actiononline.stpete.org",
"adman.you.gr",
"adminweb.uthscsa.edu",
"airportwifi.com", // bug 1116891
@ -47,10 +46,10 @@ static const char* const kIntolerantFallbackList[] =
"ap.meitetsuunyu.co.jp",
"apply.hkbn.net", // bug 1138451
"apps.amerch.com",
"apps.fpcu.org",
"apps.sasken.com",
"apps.state.or.us", // bug 1130472
"appsrv.restat.com",
"arcgames.com", // bug 1182932
"ascii.jp",
"asko.fi", // bug 1158584
"b2b.feib.com.tw",
@ -70,11 +69,11 @@ static const char* const kIntolerantFallbackList[] =
"buttons.verticalresponse.com",
"c2g.jupiter.fl.us",
"canadaca.geotrust.com", // bug 1137677
"car2go.com", // bug 1185080
"cbsfnotes1.blood.org.tw",
"central.acadiau.ca", // bug 1152377
"cherry.de", // bug 1141521
"civilization.com", // bug 1156004
"click2gov.sanangelotexas.us",
"clientes.chilectra.cl",
"club.guosen.com.cn",
"coagov.aurora-il.org",
@ -90,7 +89,6 @@ static const char* const kIntolerantFallbackList[] =
"cwu.edu",
"dbank.hxb.com.cn",
"dealer.autobytel.com",
"dealer.autoc-one.jp",
"dheb.delavska-hranilnica.si",
"digibet.com",
"digitalsecurity.intel.com", // bug 1148744
@ -107,18 +105,14 @@ static const char* const kIntolerantFallbackList[] =
"ebpp.airtel.lk",
"ebspay.boc.cn", // bug 1155567
"ec-line.cn",
"ecams.geico.com", // bug 1138613
"echo.com",
"echotrak.com",
"ecom.morethangourmet.com",
"ecourses.uthscsa.edu",
"egov.leaguecity.com",
"egov.town-menasha.com", // bug 1157536
"emaildvla.direct.gov.uk", // bug 1116891
"embroiderydesignsplus.com",
"epicreg.com",
"eremit.sbising.com",
"escrowrefills.com",
"eservices.palomar.edu",
"essentialsupplies.com",
"event.kasite.net",
@ -135,10 +129,8 @@ static const char* const kIntolerantFallbackList[] =
"fubar.com",
"gateway.halton.gov.uk",
"gbe-bund.de",
"geico.com", // bug 1138613
"gestionesytramites.madrid.org",
"giftcertificates.com",
"hbk.bb.com.br", // bug 1135966
"hercle.com",
"hpshop.gr",
"ibusiness.shacombank.com.hk", // bug 1141989
@ -153,26 +145,20 @@ static const char* const kIntolerantFallbackList[] =
"jbclick.jaxbchfl.net", // bug 1158465
"jifenpay.com",
"jst.doded.mil", // bug 1152627
"juror.fairfaxcounty.gov",
"keirin.jp",
"kjp.keinet.ne.jp",
"kjp.oo.kawai-juku.ac.jp",
"learn.ou.edu",
"learn.swosu.edu",
"lewisham.gov.uk",
"lm-order.de",
"login.chicagopolice.org",
"login.ermis.gov.gr",
"m.e-hon.ne.jp",
"macif.fr", // bug 1167893
"m.safari.cwu.edu", // bug 1143035
"mail.izhnet.ru",
"map.infonavit.org.mx",
"marketday.com", // bug 1092998
"matkahuolto.fi", // bug 1174957
"mchrono.com",
"mecsumai.com",
"member.edenredticket.com",
"mercernet.fr", // bug 1147649
"merchant.edenredticket.com",
"meta-ehealth.com",
"mobile.aa.com", // bug 1141604
@ -193,7 +179,6 @@ static const char* const kIntolerantFallbackList[] =
"myaccount3.westnet.com.au", // bug 1157139
"mybank.nbcb.com.cn",
"myhancock.hancockcollege.edu",
"myntc.ntc.edu",
"myuws.uws.edu.au",
"mywebreservations.com",
"na.aiononline.com", // bug 1139782
@ -208,13 +193,11 @@ static const char* const kIntolerantFallbackList[] =
"online.newindia.co.in",
"online.sainsburysbank.co.uk",
"openwebosproject.org", // bug 1151990
"opi.emersonclimate.com",
"opus.pinellascounty.org",
"owa.byui.edu",
"ozone.ou.edu",
"parents.ou.edu",
"partnerweb.vmware.com", // bug 1142187
"paslists.com", // for port 9211, bug 1155712
"payment.condor.com", // bug 1152347
"payment.safepass.cn",
"payments.virginmedia.com", // bug 1129887
@ -227,6 +210,7 @@ static const char* const kIntolerantFallbackList[] =
"publicjobs.ie",
"publicrecords.com",
"racenet.codemasters.com", // bug 1163716
"rapidscansecure.com", // bug 1177212
"recoup.com",
"registration.o2.co.uk",
"regonline.com", // bug 1139783
@ -236,40 +220,27 @@ static const char* const kIntolerantFallbackList[] =
"reputation.com",
"research-report.uws.edu.au",
"reservations.usairways.com", // bug 1165400
"rezstream.net",
"rietumu.lv",
"rotr.com",
"roxyaffiliates.com",
"sales.newchinalife.com",
"sbank.hxb.com.cn",
"sboseweb.mcpsweb.org",
"school.keystoneschoolonline.com",
"secure-checkout.t-mobile.com", // bug 1133648
"secure.bg-mania.jp",
"secure.crbonline.gov.uk", // bug 1166644
"secure.fortisbc.com",
"secure.ncsoft.com", // bug 1139782
"secure.smartcart.com",
"secure2.i-doxs.net", // bug 1140876
"secure3.i-doxs.net", // bug 1140876
"secure4.i-doxs.net", // bug 1140876
"secure6.i-doxs.net", // bug 1140876
"secure7.i-doxs.net", // bug 1140876
"secure8.i-doxs.net", // bug 1140876
"secureonline.dwp.gov.uk",
"sems.hrd.ccsd.net",
"service.autoc-one.jp",
"services.apvma.gov.au",
"services.geotrust.com", // bug 1137677
"servizionline.infogroup.it",
"shop.autoc-one.jp",
"shop.kagome.co.jp",
"shop.nanairo.coop", // bug 1128318
"shop.wildstar-online.com", // bug 1139782
"sisweb.ucd.ie",
"slovanet.sk",
"smartcart.com",
"smarticon.geotrust.com", // bug 1137677
"socialclub.rockstargames.com", // bug 1138673
"soeasy.sodexo.be", // bug 1117157
"ss2.sfcollege.edu",
@ -280,16 +251,15 @@ static const char* const kIntolerantFallbackList[] =
"stenhouse.com",
"store.moxa.com",
"svrch13.sugarlandtx.gov",
"swdownloads.blackberry.com", // bug 1182997
"syzygy.co.uk",
"tarjetacencosud.cl",
"tele2.hr",
"tienda.boe.es",
"tiendas.mediamarkt.es",
"trueblue.jetblue.com",
"uralsg.megafon.ru", // bug 1153168
"usacycling.org", // bug 1163791
"userdoor.com",
"uslugi.beeline.am",
"utradehub.or.kr",
"vod.skyperfectv.co.jp",
"watch.sportsnet.ca", // bug 1144769
@ -340,6 +310,7 @@ static const char* const kIntolerantFallbackList[] =
"www.ancelutil.com.uy",
"www.animate-onlineshop.jp", // bug 1126652
"www.apeasternpower.com",
"www.arcgames.com", // bug 1182932
"www.asko.fi", // bug 1158584
"www.auroragov.org",
"www.bancocredichile.cl",
@ -362,10 +333,10 @@ static const char* const kIntolerantFallbackList[] =
"www.bredbandsbolaget.se", // bug 1158755
"www.businessdirect.bt.com",
"www.cafedumonde.jp",
"www.car2go.com", // bug 1185080
"www.careers.asio.gov.au",
"www.cherry.de", // bug 1141521
"www.chinapay.com", // bug 1137983
"www.cihi.ca",
"www.cipd.co.uk",
"www.civilization.com", // bug 1156004
"www.club-animate.jp",
@ -389,14 +360,12 @@ static const char* const kIntolerantFallbackList[] =
"www.ec-line.cn",
"www.echo.com",
"www.echotrak.com",
"www.embroiderydesignsplus.com",
"www.epicreg.com",
"www.ermis.gov.gr",
"www.esadealumni.net",
"www.esavingsaccount.co.uk",
"www.escrowrefills.com",
"www.essentialsupplies.com",
"www.euronext.com", // bug 1136091
"www.everyd.com",
"www.ezpay.com.tw",
"www.fhsaa.org",
@ -405,17 +374,13 @@ static const char* const kIntolerantFallbackList[] =
"www.fontainebleau.com",
"www.foundersc.com",
"www.fubar.com",
"www.fundsupermart.co.in",
"www.gamers-onlineshop.jp", // bug 1126654
"www.gbe-bund.de",
"www.giftcertificates.com",
"www.golfersland.net",
"www.gtja.com",
"www.hankyu-club.com",
"www.haynes.co.uk",
"www.hercle.com",
"www.hn.10086.cn",
"www.hotel-story.ne.jp",
"www.hpshop.gr",
"www.hsbank.cc",
"www.hx168.com.cn",
@ -426,9 +391,6 @@ static const char* const kIntolerantFallbackList[] =
"www.jifenpay.com",
"www.kasite.net",
"www.khan.co.kr",
"www.komatsu-kenki.co.jp",
"www.komatsu.co.jp",
"www.komatsu.com",
"www.kredodirect.com.ua", // bug 1095507
"www.law888.com.tw",
"www.lewisham.gov.uk",
@ -436,19 +398,12 @@ static const char* const kIntolerantFallbackList[] =
"www.libraryvideo.com",
"www.lm-order.de",
"www.londonstockexchange.com",
"www.macif.fr", // bug 1167893
"www.marketday.com", // bug 1092998
"www.matkahuolto.fi", // bug 1174957
"www.matkahuolto.info",
"www.matrics.or.jp",
"www.mchrono.com",
"www.mecsumai.com",
"www.mercatoneuno.com",
"www.mercernet.fr", // bug 1147649
"www.meta-ehealth.com",
"www.misterdonut.jp",
"www.mizuno.jp",
"www.monclick.it",
"www.mp2.aeroport.fr",
"www.mpay.co.th",
"www.mtsindia.in", // RC4
@ -462,34 +417,30 @@ static const char* const kIntolerantFallbackList[] =
"www.nishi.or.jp",
"www.ocbcwhhk.com", // bug 1141746
"www.openwebosproject.org", // bug 1151990
"www.paslists.com", // for port 9211, bug 1155712
"www.pen-kanagawa.ed.jp",
"www.polla.cl",
"www.publicjobs.ie",
"www.publicrecords.com",
"www.pwcrecruiting.com",
"www.rapidscansecure.com", // bug 1177212
"www.razorgator.com",
"www.recoup.com",
"www.regonline.com", // bug 1139783
"www.renaultcredit.com.ar",
"www.reputation.com",
"www.rezstream.net",
"www.rietumu.lv",
"www.rimac.com.pe",
"www.riversendtrading.com",
"www.rotr.com",
"www.roxyaffiliates.com",
"www.s-book.net",
"www.safepass.cn",
"www.session.ne.jp",
"www.shacombank.com.hk", // bug 1141989
"www.shacomsecurities.com.hk", // bug 1141989
"www.shop.bt.com",
"www.slovanet.sk",
"www.smartcart.com",
"www.smartoffice.jp",
"www.sokamocka.com",
"www.sports-nakama.com",
"www.starbucks.com", // bug 1167190
"www.stenhouse.com",
"www.sunderland.gov.uk",
@ -515,15 +466,11 @@ static const char* const kIntolerantFallbackList[] =
"www1.aeroplan.com", // bug 1137543
"www1.isracard.co.il", // bug 1165582
"www2.aeroplan.com", // bug 1137543
"www2.bancobrasil.com.br", // bug 1135966
"www2.wou.edu",
"www28.bb.com.br", // bug 1135966
"www3.aeroplan.com", // bug 1137543
"www3.ibac.co.jp",
"www3.taiheiyo-ferry.co.jp",
"www4.aeroplan.com", // bug 1137543
"www41.bb.com.br", // bug 1135966
"www73.bb.com.br", // bug 1135966
"wwws.kadokawa.co.jp",
"xyk.cebbank.com", // bug 1145524
"zenfolio.com",

View File

@ -1737,7 +1737,6 @@ private:
static const char* const kFallbackWildcardList[] =
{
".kuronekoyamato.co.jp", // bug 1128366
".userstorage.mega.co.nz", // bug 1133496
".wildcard.test",
};

View File

@ -2994,8 +2994,16 @@ nsWindow::PrepareForFullscreenTransition(nsISupports** aData)
{
FullscreenTransitionInitData initData;
nsCOMPtr<nsIScreen> screen = GetWidgetScreen();
screen->GetRectDisplayPix(&initData.mBounds.x, &initData.mBounds.y,
&initData.mBounds.width, &initData.mBounds.height);
int32_t x, y, width, height;
screen->GetRectDisplayPix(&x, &y, &width, &height);
MOZ_ASSERT(BoundsUseDisplayPixels(),
"Should only be called on top-level window");
CSSToLayoutDeviceScale scale = GetDefaultScale();
initData.mBounds.x = NSToIntRound(x * scale.scale);
initData.mBounds.y = NSToIntRound(y * scale.scale);
initData.mBounds.width = NSToIntRound(width * scale.scale);
initData.mBounds.height = NSToIntRound(height * scale.scale);
// Create a semaphore for synchronizing the window handle which will
// be created by the transition thread and used by the main thread for
// posting the transition messages.