Merge inbound to central, a=merge

MozReview-Commit-ID: 6SriUFkS6u7
This commit is contained in:
Wes Kocher 2017-08-01 13:17:21 -07:00
commit 0688b1b95d
63 changed files with 412 additions and 282 deletions

View File

@ -0,0 +1 @@
<script>location.hash='';</script>

View File

@ -89,6 +89,7 @@ skip-if = toolkit == 'android'
support-files = file_bug668513.html
[test_bug669671.html]
[test_bug675587.html]
support-files = file_bug675587.html
[test_bug680257.html]
[test_bug691547.html]
[test_bug694612.html]

View File

@ -5,7 +5,8 @@
function testDone() {
clearTimeout(timerID);
var l = document.body.firstChild.contentWindow.location.href;
opener.is(l, "data:text/html,bar", "Should have loaded a new document");
opener.ok(l.endsWith("file_fragment_handling_during_load_frame2.html"),
"Should have loaded a new document");
opener.nextTest();
window.close();
}
@ -13,12 +14,12 @@
var ifr = document.getElementsByTagName("iframe")[0];
ifr.onload = testDone;
ifr.contentWindow.location.hash = "b";
ifr.contentWindow.location.href = "data:text/html,bar";
ifr.contentWindow.location.href = "file_fragment_handling_during_load_frame2.html";
history.back();
timerID = setTimeout(testDone, 2000);
}
</script>
</head>
<body onload="setTimeout(test, 0)"><iframe src="data:text/html,foo#a"></iframe>
<body onload="setTimeout(test, 0)"><iframe src="file_fragment_handling_during_load_frame1.html#a"></iframe>
</body>
</html>

View File

@ -0,0 +1,6 @@
<!DOCTYPE HTML>
<html>
<body>
foo
</body>
</html>

View File

@ -0,0 +1,6 @@
<!DOCTYPE HTML>
<html>
<body>
bar
</body>
</html>

View File

@ -21,7 +21,7 @@
</script>
</head>
<body>
<iframe id="testframe" src="data:text/html,<iframe onload='parent.nestedIframeLoaded();'></iframe>" onload="frameLoaded()"></iframe>
<iframe id="testframe" src="file_nested_frames_innerframe.html" onload="frameLoaded()"></iframe>
<script>
</script>
</body>

View File

@ -0,0 +1 @@
<iframe onload='parent.nestedIframeLoaded();'></iframe>

View File

@ -39,7 +39,7 @@
opener.is(history.scrollRestoration, "manual", "Should have the same scrollRestoration as before reload.");
document.getElementById("bottom").scrollIntoView();
window.onunload = null; // Should get bfcache behavior.
opener.setTimeout("testWindow.history.back();", 250);
opener.setTimeout("SpecialPowers.wrap(testWindow).history.back();", 250);
window.location.href = 'data:text/html,';
break;
}
@ -56,7 +56,7 @@
opener.isnot(Math.round(window.scrollY), 0, "Should have scrolled to #hash.");
opener.is(history.scrollRestoration, "manual", "Should have the same scrollRestoration mode as before fragment navigation.");
window.onunload = function() {} // Disable bfcache.
opener.setTimeout("is(testWindow.history.scrollRestoration, 'auto'); testWindow.history.back();", 250);
opener.setTimeout("is(SpecialPowers.wrap(testWindow).history.scrollRestoration, 'auto'); SpecialPowers.wrap(testWindow).history.back();", 250);
window.location.href = 'data:text/html,';
break;
}
@ -98,7 +98,7 @@
break;
}
case 7: {
oldHistoryObject = event.target.contentWindow.history;
oldHistoryObject = SpecialPowers.wrap(event.target).contentWindow.history;
event.target.src = "about:blank";
break;
}

View File

@ -13,7 +13,10 @@ support-files =
file_bug534178.html
file_document_write_1.html
file_fragment_handling_during_load.html
file_fragment_handling_during_load_frame1.html
file_fragment_handling_during_load_frame2.html
file_nested_frames.html
file_nested_frames_innerframe.html
file_scrollRestoration.html
file_shiftReload_and_pushState.html
file_static_and_dynamic_1.html

View File

@ -11,7 +11,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=675587
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=675587">Mozilla Bug 675587</a>
<p id="display">
<iframe src="data:text/html,<script>location.hash='';</script>#hash"></iframe>
<iframe src="file_bug675587.html#hash"></iframe>
</p>
<div id="content" style="display: none">
@ -22,8 +22,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=675587
/** Test for Bug 675587 **/
SimpleTest.waitForExplicitFinish();
addLoadEvent(function() {
is(window.frames[0].location.href,
"data:text/html,<script>location.hash='';</" + "script>#",
ok(window.frames[0].location.href.endsWith("file_bug675587.html#"),
"Should have the right href");
SimpleTest.finish();
});

View File

@ -198,7 +198,7 @@ private:
template<typename T,
JSObject* UnwrapArray(JSObject*),
T* GetData(JSObject*, bool* isShared, const JS::AutoRequireNoGC&),
T* GetData(JSObject*, bool* isShared, const JS::AutoCheckCannotGC&),
void GetLengthAndDataAndSharedness(JSObject*, uint32_t*, bool*, T**),
JSObject* CreateNew(JSContext*, uint32_t)>
struct TypedArray

View File

@ -6,6 +6,7 @@ support-files =
DOMWindowCreated_content.html
MozDomFullscreen_chrome.xul
child_focus_frame.html
file_clipboard_events_chrome.html
file_DOM_element_instanceof.xul
file_MozDomFullscreen.html
file_bug799299.xul
@ -28,6 +29,7 @@ support-files =
window_callback_wrapping.xul
window_docshell_swap.xul
window_focus.xul
window_focus_inner.xul
window_focus_docnav.xul
!/dom/tests/mochitest/general/file_clonewrapper.html
!/dom/tests/mochitest/general/file_moving_nodeList.html

View File

@ -0,0 +1 @@
<body onload='window.opener.doChecks(this)'><input id='i' value='Sample Text'></body>

View File

@ -13,8 +13,7 @@ SimpleTest.waitForExplicitFinish();
function runTest()
{
SpecialPowers.pushPrefEnv({"set": [['dom.event.clipboardevents.enabled', false]]}, function() {
window.open("data:text/html,<body onload='window.opener.doChecks(this)'><input id='i' value='Sample Text'></body>",
"_blank", "chrome,width=200,height=200");
window.open("file_clipboard_events_chrome.html", "_blank", "chrome,width=200,height=200");
});
}

View File

@ -1379,15 +1379,8 @@ function switchWindowTest(otherWindow, framesetWindow)
var noRootWindow = null;
function doWindowNoRootTest()
{
var data = "data:application/vnd.mozilla.xul+xml," + unescape(
"<window onfocus='dostuff()' xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'" +
" style='-moz-user-focus: normal;'>" +
"<script>function dostuff() { setTimeout(function() { " +
"document.documentElement.focus(); document.removeChild(document.documentElement);" +
"window.opener.focus(); }, 100); }</script></window>");
addEventListener("focus", doFrameSwitchingTests, true);
noRootWindow = window.open(data, "_blank", "chrome,width=100,height=100");
noRootWindow = window.open("window_focus_inner.xul", "_blank", "chrome,width=100,height=100");
}
// these tests check when focus is moved between a tree of frames to ensure

View File

@ -0,0 +1,12 @@
<?xml version="1.0"?>
<window onfocus='dostuff()' xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul' style='-moz-user-focus: normal;'>
<script>
function dostuff() {
setTimeout(function() {
document.documentElement.focus();
document.removeChild(document.documentElement);
window.opener.focus();
}, 100);
}
</script>
</window>

View File

@ -124,8 +124,32 @@ BadImage(const char* aMessage, RefPtr<T>& aImage)
return aImage.forget();
}
static void
SetSourceSizeHint(RasterImage* aImage, uint32_t aSize)
{
// Pass anything usable on so that the RasterImage can preallocate
// its source buffer.
if (aSize == 0) {
return;
}
// Bound by something reasonable
uint32_t sizeHint = std::min<uint32_t>(aSize, 20000000);
nsresult rv = aImage->SetSourceSizeHint(sizeHint);
if (NS_FAILED(rv)) {
// Flush memory, try to get some back, and try again.
rv = nsMemory::HeapMinimize(true);
nsresult rv2 = aImage->SetSourceSizeHint(sizeHint);
// If we've still failed at this point, things are going downhill.
if (NS_FAILED(rv) || NS_FAILED(rv2)) {
NS_WARNING("About to hit OOM in imagelib!");
}
}
}
/* static */ already_AddRefed<Image>
ImageFactory::CreateAnonymousImage(const nsCString& aMimeType)
ImageFactory::CreateAnonymousImage(const nsCString& aMimeType,
uint32_t aSizeHint /* = 0 */)
{
nsresult rv;
@ -140,6 +164,7 @@ ImageFactory::CreateAnonymousImage(const nsCString& aMimeType)
return BadImage("RasterImage::Init failed", newImage);
}
SetSourceSizeHint(newImage, aSizeHint);
return newImage.forget();
}
@ -225,25 +250,7 @@ ImageFactory::CreateRasterImage(nsIRequest* aRequest,
newImage->SetInnerWindowID(aInnerWindowId);
uint32_t len = GetContentSize(aRequest);
// Pass anything usable on so that the RasterImage can preallocate
// its source buffer.
if (len > 0) {
// Bound by something reasonable
uint32_t sizeHint = std::min<uint32_t>(len, 20000000);
rv = newImage->SetSourceSizeHint(sizeHint);
if (NS_FAILED(rv)) {
// Flush memory, try to get some back, and try again.
rv = nsMemory::HeapMinimize(true);
nsresult rv2 = newImage->SetSourceSizeHint(sizeHint);
// If we've still failed at this point, things are going downhill.
if (NS_FAILED(rv) || NS_FAILED(rv2)) {
NS_WARNING("About to hit OOM in imagelib!");
}
}
}
SetSourceSizeHint(newImage, GetContentSize(aRequest));
return newImage.forget();
}

View File

@ -51,9 +51,10 @@ public:
* the usual image loading mechanism.
*
* @param aMimeType The mimetype of the image.
* @param aSizeHint The length of the source data for the image.
*/
static already_AddRefed<Image>
CreateAnonymousImage(const nsCString& aMimeType);
CreateAnonymousImage(const nsCString& aMimeType, uint32_t aSizeHint = 0);
/**
* Creates a new multipart/x-mixed-replace image wrapper, and initializes it

View File

@ -224,30 +224,27 @@ SourceBuffer::Compact()
return NS_OK;
}
Maybe<Chunk> newChunk = CreateChunk(length, /* aRoundUp = */ false);
if (MOZ_UNLIKELY(!newChunk || newChunk->AllocationFailed())) {
NS_WARNING("Failed to allocate chunk for SourceBuffer compacting - OOM?");
Chunk& mergeChunk = mChunks[0];
if (MOZ_UNLIKELY(!mergeChunk.SetCapacity(length))) {
NS_WARNING("Failed to reallocate chunk for SourceBuffer compacting - OOM?");
return NS_OK;
}
// Copy our old chunks into the new chunk.
for (uint32_t i = 0 ; i < mChunks.Length() ; ++i) {
size_t offset = newChunk->Length();
MOZ_ASSERT(offset < newChunk->Capacity());
MOZ_ASSERT(offset + mChunks[i].Length() <= newChunk->Capacity());
// Copy our old chunks into the newly reallocated first chunk.
for (uint32_t i = 1 ; i < mChunks.Length() ; ++i) {
size_t offset = mergeChunk.Length();
MOZ_ASSERT(offset < mergeChunk.Capacity());
MOZ_ASSERT(offset + mChunks[i].Length() <= mergeChunk.Capacity());
memcpy(newChunk->Data() + offset, mChunks[i].Data(), mChunks[i].Length());
newChunk->AddLength(mChunks[i].Length());
memcpy(mergeChunk.Data() + offset, mChunks[i].Data(), mChunks[i].Length());
mergeChunk.AddLength(mChunks[i].Length());
}
MOZ_ASSERT(newChunk->Length() == newChunk->Capacity(),
MOZ_ASSERT(mergeChunk.Length() == mergeChunk.Capacity(),
"Compacted chunk has slack space");
// Replace the old chunks with the new, compact chunk.
mChunks.Clear();
if (MOZ_UNLIKELY(NS_FAILED(AppendChunk(Move(newChunk))))) {
return HandleError(NS_ERROR_OUT_OF_MEMORY);
}
// Remove the redundant chunks.
mChunks.RemoveElementsAt(1, mChunks.Length() - 1);
mChunks.Compact();
return NS_OK;
@ -337,7 +334,7 @@ SourceBuffer::ExpectLength(size_t aExpectedLength)
return NS_OK;
}
if (MOZ_UNLIKELY(NS_FAILED(AppendChunk(CreateChunk(aExpectedLength))))) {
if (MOZ_UNLIKELY(NS_FAILED(AppendChunk(CreateChunk(aExpectedLength, /* aRoundUp */ false))))) {
return HandleError(NS_ERROR_OUT_OF_MEMORY);
}

View File

@ -379,7 +379,7 @@ private:
// Chunk type and chunk-related methods.
//////////////////////////////////////////////////////////////////////////////
class Chunk
class Chunk final
{
public:
explicit Chunk(size_t aCapacity)
@ -387,13 +387,18 @@ private:
, mLength(0)
{
MOZ_ASSERT(aCapacity > 0, "Creating zero-capacity chunk");
mData.reset(new (fallible) char[mCapacity]);
mData = static_cast<char*>(malloc(mCapacity));
}
~Chunk()
{
free(mData);
}
Chunk(Chunk&& aOther)
: mCapacity(aOther.mCapacity)
, mLength(aOther.mLength)
, mData(Move(aOther.mData))
, mData(aOther.mData)
{
aOther.mCapacity = aOther.mLength = 0;
aOther.mData = nullptr;
@ -401,9 +406,10 @@ private:
Chunk& operator=(Chunk&& aOther)
{
free(mData);
mCapacity = aOther.mCapacity;
mLength = aOther.mLength;
mData = Move(aOther.mData);
mData = aOther.mData;
aOther.mCapacity = aOther.mLength = 0;
aOther.mData = nullptr;
return *this;
@ -416,7 +422,7 @@ private:
char* Data() const
{
MOZ_ASSERT(mData, "Allocation failed but nobody checked for it");
return mData.get();
return mData;
}
void AddLength(size_t aAdditionalLength)
@ -425,13 +431,26 @@ private:
mLength += aAdditionalLength;
}
bool SetCapacity(size_t aCapacity)
{
MOZ_ASSERT(mData, "Allocation failed but nobody checked for it");
char* data = static_cast<char*>(realloc(mData, aCapacity));
if (!data) {
return false;
}
mData = data;
mCapacity = aCapacity;
return true;
}
private:
Chunk(const Chunk&) = delete;
Chunk& operator=(const Chunk&) = delete;
size_t mCapacity;
size_t mLength;
UniquePtr<char[]> mData;
char* mData;
};
nsresult AppendChunk(Maybe<Chunk>&& aChunk);
@ -475,7 +494,7 @@ private:
mutable Mutex mMutex;
/// The data in this SourceBuffer, stored as a series of Chunks.
FallibleTArray<Chunk> mChunks;
AutoTArray<Chunk, 1> mChunks;
/// Consumers which are waiting to be notified when new data is available.
nsTArray<RefPtr<IResumable>> mWaitingConsumers;

View File

@ -163,10 +163,15 @@ nsICODecoder::ReadDirEntry(const char* aData)
e.mBytesInRes = LittleEndian::readUint32(aData + 8);
e.mImageOffset = offset;
e.mSize = IntSize(e.mWidth, e.mHeight);
if (e.mWidth == 0 || e.mHeight == 0) {
mUnsizedDirEntries.AppendElement(e);
} else {
mDirEntries.AppendElement(e);
// Only accept entries with sufficient resource data to actually contain
// some image data.
if (e.mBytesInRes > BITMAPINFOSIZE) {
if (e.mWidth == 0 || e.mHeight == 0) {
mUnsizedDirEntries.AppendElement(e);
} else {
mDirEntries.AppendElement(e);
}
}
}

View File

@ -68,15 +68,6 @@ imgTools::DecodeImage(nsIInputStream* aInStr,
NS_ENSURE_ARG_POINTER(aInStr);
// Create a new image container to hold the decoded data.
nsAutoCString mimeType(aMimeType);
RefPtr<image::Image> image = ImageFactory::CreateAnonymousImage(mimeType);
RefPtr<ProgressTracker> tracker = image->GetProgressTracker();
if (image->HasError()) {
return NS_ERROR_FAILURE;
}
// Prepare the input stream.
nsCOMPtr<nsIInputStream> inStream = aInStr;
if (!NS_InputStreamIsBuffered(aInStr)) {
@ -93,6 +84,16 @@ imgTools::DecodeImage(nsIInputStream* aInStr,
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_TRUE(length <= UINT32_MAX, NS_ERROR_FILE_TOO_BIG);
// Create a new image container to hold the decoded data.
nsAutoCString mimeType(aMimeType);
RefPtr<image::Image> image =
ImageFactory::CreateAnonymousImage(mimeType, uint32_t(length));
RefPtr<ProgressTracker> tracker = image->GetProgressTracker();
if (image->HasError()) {
return NS_ERROR_FAILURE;
}
// Send the source data to the Image.
rv = image->OnImageDataAvailable(nullptr, nullptr, inStream, 0,
uint32_t(length));

View File

@ -373,22 +373,25 @@ TEST_F(ImageSourceBuffer, MinChunkCapacity)
CheckIteratorIsComplete(iterator, 2, SourceBuffer::MIN_CHUNK_CAPACITY + 1);
}
TEST_F(ImageSourceBuffer, ExpectLengthDoesNotShrinkBelowMinCapacity)
TEST_F(ImageSourceBuffer, ExpectLengthAllocatesRequestedCapacity)
{
SourceBufferIterator iterator = mSourceBuffer->Iterator();
// Write SourceBuffer::MIN_CHUNK_CAPACITY bytes of test data to the buffer,
// but call ExpectLength() first to make SourceBuffer expect only a single
// byte. We expect this to still result in only one chunk, because
// regardless of ExpectLength() we won't allocate a chunk smaller than
// MIN_CHUNK_CAPACITY bytes.
// byte. We expect this to still result in two chunks, because we trust the
// initial guess of ExpectLength() but after that it will only allocate chunks
// of at least MIN_CHUNK_CAPACITY bytes.
EXPECT_TRUE(NS_SUCCEEDED(mSourceBuffer->ExpectLength(1)));
CheckedAppendToBufferInChunks(10, SourceBuffer::MIN_CHUNK_CAPACITY);
CheckedCompleteBuffer(iterator, SourceBuffer::MIN_CHUNK_CAPACITY);
// Verify that the iterator sees a single chunk.
CheckedAdvanceIterator(iterator, SourceBuffer::MIN_CHUNK_CAPACITY);
CheckIteratorIsComplete(iterator, 1, SourceBuffer::MIN_CHUNK_CAPACITY);
// Verify that the iterator sees a first chunk with 1 byte, and a second chunk
// with the remaining data.
CheckedAdvanceIterator(iterator, 1, 1, 1);
CheckedAdvanceIterator(iterator, SourceBuffer::MIN_CHUNK_CAPACITY - 1, 2,
SourceBuffer::MIN_CHUNK_CAPACITY);
CheckIteratorIsComplete(iterator, 2, SourceBuffer::MIN_CHUNK_CAPACITY);
}
TEST_F(ImageSourceBuffer, ExpectLengthGrowsAboveMinCapacity)

View File

@ -531,6 +531,28 @@ class JS_PUBLIC_API(AutoAssertNoGC) : public AutoRequireNoGC
~AutoAssertNoGC();
};
/**
* Assert if an allocation of a GC thing occurs while this class is live. This
* class does not disable the static rooting hazard analysis.
*/
class JS_PUBLIC_API(AutoAssertNoAlloc)
{
#ifdef JS_DEBUG
js::gc::GCRuntime* gc;
public:
AutoAssertNoAlloc() : gc(nullptr) {}
explicit AutoAssertNoAlloc(JSContext* cx);
void disallowAlloc(JSRuntime* rt);
~AutoAssertNoAlloc();
#else
public:
AutoAssertNoAlloc() {}
explicit AutoAssertNoAlloc(JSContext* cx) {}
void disallowAlloc(JSRuntime* rt) {}
#endif
};
/**
* Disable the static rooting hazard analysis in the live region and assert if
* any allocation that could potentially trigger a GC occurs while this guard
@ -545,11 +567,11 @@ class JS_PUBLIC_API(AutoAssertNoGC) : public AutoRequireNoGC
* that the hazard analysis is correct for that code, rather than relying
* on this class.
*/
class JS_PUBLIC_API(AutoSuppressGCAnalysis) : public AutoAssertNoGC
class JS_PUBLIC_API(AutoSuppressGCAnalysis) : public AutoAssertNoAlloc
{
public:
AutoSuppressGCAnalysis() : AutoAssertNoGC() {}
explicit AutoSuppressGCAnalysis(JSContext* cx) : AutoAssertNoGC(cx) {}
AutoSuppressGCAnalysis() : AutoAssertNoAlloc() {}
explicit AutoSuppressGCAnalysis(JSContext* cx) : AutoAssertNoAlloc(cx) {}
} JS_HAZ_GC_SUPPRESSED;
/**

View File

@ -83,7 +83,7 @@ struct BreadthFirst {
//
// We do nothing with noGC, other than require it to exist, with a lifetime
// that encloses our own.
BreadthFirst(JSContext* cx, Handler& handler, const JS::AutoRequireNoGC& noGC)
BreadthFirst(JSContext* cx, Handler& handler, const JS::AutoCheckCannotGC& noGC)
: wantNames(true), cx(cx), visited(), handler(handler), pending(),
traversalBegun(false), stopRequested(false), abandonRequested(false)
{ }

View File

@ -1013,7 +1013,7 @@ JS_GetDataViewByteOffset(JSObject* obj)
}
JS_FRIEND_API(void*)
JS_GetDataViewData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&)
JS_GetDataViewData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&)
{
obj = CheckedUnwrap(obj);
if (!obj)

View File

@ -3502,7 +3502,8 @@ ReadableByteStreamControllerPullSteps(JSContext* cx, HandleNativeObject controll
size_t bytesWritten;
{
JS::AutoSuppressGCAnalysis noGC(cx);
JS::AutoSuppressGCAnalysis suppressGC(cx);
JS::AutoCheckCannotGC noGC;
bool dummy;
void* buffer = JS_GetArrayBufferViewData(view, &dummy, noGC);
auto cb = cx->runtime()->readableStreamWriteIntoReadRequestCallback;
@ -4244,7 +4245,8 @@ ReadableByteStreamControllerFillPullIntoDescriptorFromQueue(JSContext* cx,
size_t bytesWritten;
{
JS::AutoSuppressGCAnalysis noGC(cx);
JS::AutoSuppressGCAnalysis suppressGC(cx);
JS::AutoCheckCannotGC noGC;
bool dummy;
uint8_t* buffer = JS_GetArrayBufferData(targetBuffer, &dummy, noGC);
buffer += bytesFilled;
@ -5400,7 +5402,8 @@ ReadableStream::updateDataAvailableFromSource(JSContext* cx, Handle<ReadableStre
size_t bytesWritten;
{
JS::AutoSuppressGCAnalysis noGC(cx);
JS::AutoSuppressGCAnalysis suppressGC(cx);
JS::AutoCheckCannotGC noGC;
bool dummy;
void* buffer = JS_GetArrayBufferViewData(transferredView, &dummy, noGC);
auto cb = cx->runtime()->readableStreamWriteIntoReadRequestCallback;

View File

@ -140,7 +140,6 @@ PhaseKindGraphRoots = [
PhaseKind("SWEEP_SCOPE", "Sweep Scope", 59),
PhaseKind("SWEEP_REGEXP_SHARED", "Sweep RegExpShared", 61),
PhaseKind("SWEEP_SHAPE", "Sweep Shape", 36),
PhaseKind("SWEEP_JITCODE", "Sweep JIT code", 37),
PhaseKind("FINALIZE_END", "Finalize End Callback", 38),
PhaseKind("DESTROY", "Deallocate", 39),
JoinParallelTasksPhaseKind

View File

@ -73,7 +73,7 @@ BEGIN_TEST(testTypedArrays)
template<JSObject* Create(JSContext*, uint32_t),
typename Element,
Element* GetData(JSObject*, bool* isShared, const JS::AutoRequireNoGC&)>
Element* GetData(JSObject*, bool* isShared, const JS::AutoCheckCannotGC&)>
bool
TestPlainTypedArray(JSContext* cx)
{
@ -111,7 +111,7 @@ template<JSObject* CreateWithBuffer(JSContext*, JS::HandleObject, uint32_t, int3
JSObject* CreateFromArray(JSContext*, JS::HandleObject),
typename Element,
bool Shared,
Element* GetData(JSObject*, bool*, const JS::AutoRequireNoGC&)>
Element* GetData(JSObject*, bool*, const JS::AutoCheckCannotGC&)>
bool
TestArrayFromBuffer(JSContext* cx)
{

View File

@ -5820,7 +5820,7 @@ JS_StringHasLatin1Chars(JSString* str)
}
JS_PUBLIC_API(const JS::Latin1Char*)
JS_GetLatin1StringCharsAndLength(JSContext* cx, const JS::AutoRequireNoGC& nogc, JSString* str,
JS_GetLatin1StringCharsAndLength(JSContext* cx, const JS::AutoCheckCannotGC& nogc, JSString* str,
size_t* plength)
{
MOZ_ASSERT(plength);
@ -5835,7 +5835,7 @@ JS_GetLatin1StringCharsAndLength(JSContext* cx, const JS::AutoRequireNoGC& nogc,
}
JS_PUBLIC_API(const char16_t*)
JS_GetTwoByteStringCharsAndLength(JSContext* cx, const JS::AutoRequireNoGC& nogc, JSString* str,
JS_GetTwoByteStringCharsAndLength(JSContext* cx, const JS::AutoCheckCannotGC& nogc, JSString* str,
size_t* plength)
{
MOZ_ASSERT(plength);
@ -5893,7 +5893,7 @@ JS_CopyStringChars(JSContext* cx, mozilla::Range<char16_t> dest, JSString* str)
}
JS_PUBLIC_API(const Latin1Char*)
JS_GetLatin1InternedStringChars(const JS::AutoRequireNoGC& nogc, JSString* str)
JS_GetLatin1InternedStringChars(const JS::AutoCheckCannotGC& nogc, JSString* str)
{
MOZ_ASSERT(str->isAtom());
JSFlatString* flat = str->ensureFlat(nullptr);
@ -5903,7 +5903,7 @@ JS_GetLatin1InternedStringChars(const JS::AutoRequireNoGC& nogc, JSString* str)
}
JS_PUBLIC_API(const char16_t*)
JS_GetTwoByteInternedStringChars(const JS::AutoRequireNoGC& nogc, JSString* str)
JS_GetTwoByteInternedStringChars(const JS::AutoCheckCannotGC& nogc, JSString* str)
{
MOZ_ASSERT(str->isAtom());
JSFlatString* flat = str->ensureFlat(nullptr);
@ -5925,13 +5925,13 @@ JS_FlattenString(JSContext* cx, JSString* str)
}
extern JS_PUBLIC_API(const Latin1Char*)
JS_GetLatin1FlatStringChars(const JS::AutoRequireNoGC& nogc, JSFlatString* str)
JS_GetLatin1FlatStringChars(const JS::AutoCheckCannotGC& nogc, JSFlatString* str)
{
return str->latin1Chars(nogc);
}
extern JS_PUBLIC_API(const char16_t*)
JS_GetTwoByteFlatStringChars(const JS::AutoRequireNoGC& nogc, JSFlatString* str)
JS_GetTwoByteFlatStringChars(const JS::AutoCheckCannotGC& nogc, JSFlatString* str)
{
return str->twoByteChars(nogc);
}

View File

@ -5020,11 +5020,11 @@ extern JS_PUBLIC_API(bool)
JS_StringHasLatin1Chars(JSString* str);
extern JS_PUBLIC_API(const JS::Latin1Char*)
JS_GetLatin1StringCharsAndLength(JSContext* cx, const JS::AutoRequireNoGC& nogc, JSString* str,
JS_GetLatin1StringCharsAndLength(JSContext* cx, const JS::AutoCheckCannotGC& nogc, JSString* str,
size_t* length);
extern JS_PUBLIC_API(const char16_t*)
JS_GetTwoByteStringCharsAndLength(JSContext* cx, const JS::AutoRequireNoGC& nogc, JSString* str,
JS_GetTwoByteStringCharsAndLength(JSContext* cx, const JS::AutoCheckCannotGC& nogc, JSString* str,
size_t* length);
extern JS_PUBLIC_API(bool)
@ -5043,10 +5043,10 @@ extern JS_PUBLIC_API(JSFlatString*)
JS_FlattenString(JSContext* cx, JSString* str);
extern JS_PUBLIC_API(const JS::Latin1Char*)
JS_GetLatin1FlatStringChars(const JS::AutoRequireNoGC& nogc, JSFlatString* str);
JS_GetLatin1FlatStringChars(const JS::AutoCheckCannotGC& nogc, JSFlatString* str);
extern JS_PUBLIC_API(const char16_t*)
JS_GetTwoByteFlatStringChars(const JS::AutoRequireNoGC& nogc, JSFlatString* str);
JS_GetTwoByteFlatStringChars(const JS::AutoCheckCannotGC& nogc, JSFlatString* str);
static MOZ_ALWAYS_INLINE JSFlatString*
JSID_TO_FLAT_STRING(jsid id)

View File

@ -818,7 +818,7 @@ StringHasLatin1Chars(JSString* s)
}
MOZ_ALWAYS_INLINE const JS::Latin1Char*
GetLatin1LinearStringChars(const JS::AutoRequireNoGC& nogc, JSLinearString* linear)
GetLatin1LinearStringChars(const JS::AutoCheckCannotGC& nogc, JSLinearString* linear)
{
MOZ_ASSERT(LinearStringHasLatin1Chars(linear));
@ -830,7 +830,7 @@ GetLatin1LinearStringChars(const JS::AutoRequireNoGC& nogc, JSLinearString* line
}
MOZ_ALWAYS_INLINE const char16_t*
GetTwoByteLinearStringChars(const JS::AutoRequireNoGC& nogc, JSLinearString* linear)
GetTwoByteLinearStringChars(const JS::AutoCheckCannotGC& nogc, JSLinearString* linear)
{
MOZ_ASSERT(!LinearStringHasLatin1Chars(linear));
@ -860,13 +860,13 @@ FlatStringToLinearString(JSFlatString* s)
}
MOZ_ALWAYS_INLINE const JS::Latin1Char*
GetLatin1AtomChars(const JS::AutoRequireNoGC& nogc, JSAtom* atom)
GetLatin1AtomChars(const JS::AutoCheckCannotGC& nogc, JSAtom* atom)
{
return GetLatin1LinearStringChars(nogc, AtomToLinearString(atom));
}
MOZ_ALWAYS_INLINE const char16_t*
GetTwoByteAtomChars(const JS::AutoRequireNoGC& nogc, JSAtom* atom)
GetTwoByteAtomChars(const JS::AutoCheckCannotGC& nogc, JSAtom* atom)
{
return GetTwoByteLinearStringChars(nogc, AtomToLinearString(atom));
}
@ -1954,7 +1954,7 @@ GetSharedArrayBufferLengthAndData(JSObject* obj, uint32_t* length, bool* isShare
} // namespace js
JS_FRIEND_API(uint8_t*)
JS_GetSharedArrayBufferData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&);
JS_GetSharedArrayBufferData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&);
/*
* Unwrap Typed arrays all at once. Return nullptr without throwing if the
@ -2052,7 +2052,7 @@ JS_ArrayBufferHasData(JSObject* obj);
* its use from code that also interacts with SharedArrayBuffer.
*/
extern JS_FRIEND_API(uint8_t*)
JS_GetArrayBufferData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&);
JS_GetArrayBufferData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&);
/**
* Check whether the obj is ArrayBufferObject and memory mapped. Note that this
@ -2129,30 +2129,30 @@ JS_GetArrayBufferViewByteOffset(JSObject* obj);
*/
extern JS_FRIEND_API(int8_t*)
JS_GetInt8ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&);
JS_GetInt8ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&);
extern JS_FRIEND_API(uint8_t*)
JS_GetUint8ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&);
JS_GetUint8ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&);
extern JS_FRIEND_API(uint8_t*)
JS_GetUint8ClampedArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&);
JS_GetUint8ClampedArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&);
extern JS_FRIEND_API(int16_t*)
JS_GetInt16ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&);
JS_GetInt16ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&);
extern JS_FRIEND_API(uint16_t*)
JS_GetUint16ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&);
JS_GetUint16ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&);
extern JS_FRIEND_API(int32_t*)
JS_GetInt32ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&);
JS_GetInt32ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&);
extern JS_FRIEND_API(uint32_t*)
JS_GetUint32ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&);
JS_GetUint32ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&);
extern JS_FRIEND_API(float*)
JS_GetFloat32ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&);
JS_GetFloat32ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&);
extern JS_FRIEND_API(double*)
JS_GetFloat64ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&);
JS_GetFloat64ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&);
/**
* Same as above, but for any kind of ArrayBufferView. Prefer the type-specific
* versions when possible.
*/
extern JS_FRIEND_API(void*)
JS_GetArrayBufferViewData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&);
JS_GetArrayBufferViewData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&);
/**
* Return the ArrayBuffer or SharedArrayBuffer underlying an ArrayBufferView.
@ -2229,7 +2229,7 @@ JS_GetDataViewByteLength(JSObject* obj);
* otherwise to false.
*/
JS_FRIEND_API(void*)
JS_GetDataViewData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&);
JS_GetDataViewData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&);
namespace js {

View File

@ -347,16 +347,10 @@ static const FinalizePhase ForegroundObjectFinalizePhase = {
/*
* Finalization order for GC things swept incrementally on the active thread.
*/
static const FinalizePhase IncrementalFinalizePhases[] = {
{
gcstats::PhaseKind::SWEEP_SCRIPT, {
AllocKind::SCRIPT
}
},
{
gcstats::PhaseKind::SWEEP_JITCODE, {
AllocKind::JITCODE
}
static const FinalizePhase ForegroundNonObjectFinalizePhase = {
gcstats::PhaseKind::SWEEP_SCRIPT, {
AllocKind::SCRIPT,
AllocKind::JITCODE
}
};
@ -5357,9 +5351,7 @@ GCRuntime::beginSweepingSweepGroup()
for (GCSweepGroupIter zone(rt); !zone.done(); zone.next()) {
zone->arenas.queueForForegroundSweep(&fop, ForegroundObjectFinalizePhase);
for (unsigned i = 0; i < ArrayLength(IncrementalFinalizePhases); ++i)
zone->arenas.queueForForegroundSweep(&fop, IncrementalFinalizePhases[i]);
zone->arenas.queueForForegroundSweep(&fop, ForegroundNonObjectFinalizePhase);
for (unsigned i = 0; i < ArrayLength(BackgroundFinalizePhases); ++i)
zone->arenas.queueForBackgroundSweep(&fop, BackgroundFinalizePhases[i]);
@ -5866,9 +5858,11 @@ struct IncrementalIter
}
};
namespace sweepaction {
// Implementation of the SweepAction interface that calls a function.
template <typename... Args>
class SweepActionFunc : public SweepAction<Args...>
class SweepActionFunc final : public SweepAction<Args...>
{
using Func = IncrementalProgress (*)(Args...);
@ -5885,7 +5879,7 @@ class SweepActionFunc : public SweepAction<Args...>
// Implementation of the SweepAction interface that calls a list of actions in
// sequence.
template <typename... Args>
class SweepActionSequence : public SweepAction<Args...>
class SweepActionSequence final : public SweepAction<Args...>
{
using Action = SweepAction<Args...>;
using ActionVector = Vector<UniquePtr<Action>, 0, SystemAllocPolicy>;
@ -5919,7 +5913,7 @@ class SweepActionSequence : public SweepAction<Args...>
};
template <typename Iter, typename Init, typename... Args>
class SweepActionForEach : public SweepAction<Args...>
class SweepActionForEach final : public SweepAction<Args...>
{
using Elem = decltype(mozilla::DeclVal<Iter>().get());
using Action = SweepAction<Args..., Elem>;
@ -5987,13 +5981,13 @@ class RemoveLastTemplateParameter<Target<Args...>>
template <typename... Args>
static UniquePtr<SweepAction<Args...>>
SweepFunc(IncrementalProgress (*func)(Args...)) {
Func(IncrementalProgress (*func)(Args...)) {
return MakeUnique<SweepActionFunc<Args...>>(func);
}
template <typename... Args, typename... Rest>
static UniquePtr<SweepAction<Args...>>
SweepSequence(UniquePtr<SweepAction<Args...>> first, Rest... rest)
Sequence(UniquePtr<SweepAction<Args...>> first, Rest... rest)
{
UniquePtr<SweepAction<Args...>> actions[] = { Move(first), Move(rest)... };
auto seq = MakeUnique<SweepActionSequence<Args...>>();
@ -6005,7 +5999,7 @@ SweepSequence(UniquePtr<SweepAction<Args...>> first, Rest... rest)
template <typename... Args>
static UniquePtr<typename RemoveLastTemplateParameter<SweepAction<Args...>>::Type>
SweepForEachZone(JSRuntime* rt, UniquePtr<SweepAction<Args...>> action)
ForEachZoneInSweepGroup(JSRuntime* rt, UniquePtr<SweepAction<Args...>> action)
{
if (!action)
return nullptr;
@ -6017,7 +6011,7 @@ SweepForEachZone(JSRuntime* rt, UniquePtr<SweepAction<Args...>> action)
template <typename... Args>
static UniquePtr<typename RemoveLastTemplateParameter<SweepAction<Args...>>::Type>
SweepForEachAllocKind(AllocKinds kinds, UniquePtr<SweepAction<Args...>> action)
ForEachAllocKind(AllocKinds kinds, UniquePtr<SweepAction<Args...>> action)
{
if (!action)
return nullptr;
@ -6027,30 +6021,28 @@ SweepForEachAllocKind(AllocKinds kinds, UniquePtr<SweepAction<Args...>> action)
return js::MakeUnique<Action>(kinds, Move(action));
}
} // namespace sweepaction
bool
GCRuntime::initSweepActions()
{
sweepActions.ref() = SweepSequence(
SweepFunc(sweepAtomsTable),
SweepFunc(sweepWeakCaches),
SweepForEachZone(rt,
SweepForEachAllocKind(ForegroundObjectFinalizePhase.kinds,
SweepFunc(finalizeAllocKind))),
SweepForEachZone(rt,
SweepSequence(
SweepFunc(sweepTypeInformation),
SweepFunc(mergeSweptObjectArenas))),
SweepForEachZone(rt,
SweepForEachAllocKind(IncrementalFinalizePhases[0].kinds,
SweepFunc(finalizeAllocKind))),
SweepForEachZone(rt,
SweepForEachAllocKind(IncrementalFinalizePhases[1].kinds,
SweepFunc(finalizeAllocKind))),
SweepForEachZone(rt,
SweepFunc(sweepShapeTree)));
using namespace sweepaction;
static_assert(ArrayLength(IncrementalFinalizePhases) == 2,
"We must have a phase for each element in IncrementalFinalizePhases");
sweepActions.ref() = Sequence(
Func(sweepAtomsTable),
Func(sweepWeakCaches),
ForEachZoneInSweepGroup(rt,
ForEachAllocKind(ForegroundObjectFinalizePhase.kinds,
Func(finalizeAllocKind))),
ForEachZoneInSweepGroup(rt,
Sequence(
Func(sweepTypeInformation),
Func(mergeSweptObjectArenas))),
ForEachZoneInSweepGroup(rt,
ForEachAllocKind(ForegroundNonObjectFinalizePhase.kinds,
Func(finalizeAllocKind))),
ForEachZoneInSweepGroup(rt,
Func(sweepShapeTree)));
return sweepActions != nullptr;
}
@ -7876,19 +7868,35 @@ js::gc::AssertGCThingHasType(js::gc::Cell* cell, JS::TraceKind kind)
JS::AutoAssertNoGC::AutoAssertNoGC(JSContext* maybecx)
: cx_(maybecx ? maybecx : TlsContext.get())
{
if (cx_)
cx_->inUnsafeRegion++;
cx_->inUnsafeRegion++;
}
JS::AutoAssertNoGC::~AutoAssertNoGC()
{
if (cx_) {
MOZ_ASSERT(cx_->inUnsafeRegion > 0);
cx_->inUnsafeRegion--;
}
MOZ_ASSERT(cx_->inUnsafeRegion > 0);
cx_->inUnsafeRegion--;
}
#ifdef DEBUG
JS::AutoAssertNoAlloc::AutoAssertNoAlloc(JSContext* cx)
: gc(nullptr)
{
disallowAlloc(cx->runtime());
}
void JS::AutoAssertNoAlloc::disallowAlloc(JSRuntime* rt)
{
MOZ_ASSERT(!gc);
gc = &rt->gc;
TlsContext.get()->disallowAlloc();
}
JS::AutoAssertNoAlloc::~AutoAssertNoAlloc()
{
if (gc)
TlsContext.get()->allowAlloc();
}
AutoAssertNoNurseryAlloc::AutoAssertNoNurseryAlloc()
{
TlsContext.get()->disallowNurseryAlloc();

View File

@ -1615,7 +1615,7 @@ JS_GetArrayBufferByteLength(JSObject* obj)
}
JS_FRIEND_API(uint8_t*)
JS_GetArrayBufferData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&)
JS_GetArrayBufferData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&)
{
obj = CheckedUnwrap(obj);
if (!obj)
@ -1832,7 +1832,7 @@ JS_IsMappedArrayBufferObject(JSObject* obj)
}
JS_FRIEND_API(void*)
JS_GetArrayBufferViewData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&)
JS_GetArrayBufferViewData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&)
{
obj = CheckedUnwrap(obj);
if (!obj)

View File

@ -513,7 +513,7 @@ JS_IsSharedArrayBufferObject(JSObject* obj)
}
JS_FRIEND_API(uint8_t*)
JS_GetSharedArrayBufferData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&)
JS_GetSharedArrayBufferData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&)
{
obj = CheckedUnwrap(obj);
if (!obj)

View File

@ -652,17 +652,17 @@ class JSLinearString : public JSString
public:
template<typename CharT>
MOZ_ALWAYS_INLINE
const CharT* nonInlineChars(const JS::AutoRequireNoGC& nogc) const;
const CharT* nonInlineChars(const JS::AutoCheckCannotGC& nogc) const;
MOZ_ALWAYS_INLINE
const JS::Latin1Char* nonInlineLatin1Chars(const JS::AutoRequireNoGC& nogc) const {
const JS::Latin1Char* nonInlineLatin1Chars(const JS::AutoCheckCannotGC& nogc) const {
MOZ_ASSERT(!isInline());
MOZ_ASSERT(hasLatin1Chars());
return d.s.u2.nonInlineCharsLatin1;
}
MOZ_ALWAYS_INLINE
const char16_t* nonInlineTwoByteChars(const JS::AutoRequireNoGC& nogc) const {
const char16_t* nonInlineTwoByteChars(const JS::AutoCheckCannotGC& nogc) const {
MOZ_ASSERT(!isInline());
MOZ_ASSERT(hasTwoByteChars());
return d.s.u2.nonInlineCharsTwoByte;
@ -670,24 +670,24 @@ class JSLinearString : public JSString
template<typename CharT>
MOZ_ALWAYS_INLINE
const CharT* chars(const JS::AutoRequireNoGC& nogc) const;
const CharT* chars(const JS::AutoCheckCannotGC& nogc) const;
MOZ_ALWAYS_INLINE
const JS::Latin1Char* latin1Chars(const JS::AutoRequireNoGC& nogc) const {
const JS::Latin1Char* latin1Chars(const JS::AutoCheckCannotGC& nogc) const {
return rawLatin1Chars();
}
MOZ_ALWAYS_INLINE
const char16_t* twoByteChars(const JS::AutoRequireNoGC& nogc) const {
const char16_t* twoByteChars(const JS::AutoCheckCannotGC& nogc) const {
return rawTwoByteChars();
}
mozilla::Range<const JS::Latin1Char> latin1Range(const JS::AutoRequireNoGC& nogc) const {
mozilla::Range<const JS::Latin1Char> latin1Range(const JS::AutoCheckCannotGC& nogc) const {
MOZ_ASSERT(JSString::isLinear());
return mozilla::Range<const JS::Latin1Char>(latin1Chars(nogc), length());
}
mozilla::Range<const char16_t> twoByteRange(const JS::AutoRequireNoGC& nogc) const {
mozilla::Range<const char16_t> twoByteRange(const JS::AutoCheckCannotGC& nogc) const {
MOZ_ASSERT(JSString::isLinear());
return mozilla::Range<const char16_t>(twoByteChars(nogc), length());
}
@ -864,14 +864,14 @@ class JSInlineString : public JSFlatString
{
public:
MOZ_ALWAYS_INLINE
const JS::Latin1Char* latin1Chars(const JS::AutoRequireNoGC& nogc) const {
const JS::Latin1Char* latin1Chars(const JS::AutoCheckCannotGC& nogc) const {
MOZ_ASSERT(JSString::isInline());
MOZ_ASSERT(hasLatin1Chars());
return d.inlineStorageLatin1;
}
MOZ_ALWAYS_INLINE
const char16_t* twoByteChars(const JS::AutoRequireNoGC& nogc) const {
const char16_t* twoByteChars(const JS::AutoCheckCannotGC& nogc) const {
MOZ_ASSERT(JSString::isInline());
MOZ_ASSERT(hasTwoByteChars());
return d.inlineStorageTwoByte;
@ -1424,28 +1424,28 @@ JSString::base() const
template<>
MOZ_ALWAYS_INLINE const char16_t*
JSLinearString::nonInlineChars(const JS::AutoRequireNoGC& nogc) const
JSLinearString::nonInlineChars(const JS::AutoCheckCannotGC& nogc) const
{
return nonInlineTwoByteChars(nogc);
}
template<>
MOZ_ALWAYS_INLINE const JS::Latin1Char*
JSLinearString::nonInlineChars(const JS::AutoRequireNoGC& nogc) const
JSLinearString::nonInlineChars(const JS::AutoCheckCannotGC& nogc) const
{
return nonInlineLatin1Chars(nogc);
}
template<>
MOZ_ALWAYS_INLINE const char16_t*
JSLinearString::chars(const JS::AutoRequireNoGC& nogc) const
JSLinearString::chars(const JS::AutoCheckCannotGC& nogc) const
{
return rawTwoByteChars();
}
template<>
MOZ_ALWAYS_INLINE const JS::Latin1Char*
JSLinearString::chars(const JS::AutoRequireNoGC& nogc) const
JSLinearString::chars(const JS::AutoCheckCannotGC& nogc) const
{
return rawLatin1Chars();
}

View File

@ -2349,7 +2349,7 @@ JS_GetArrayBufferViewType(JSObject* obj)
}
JS_FRIEND_API(int8_t*)
JS_GetInt8ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&)
JS_GetInt8ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&)
{
obj = CheckedUnwrap(obj);
if (!obj)
@ -2361,7 +2361,7 @@ JS_GetInt8ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNo
}
JS_FRIEND_API(uint8_t*)
JS_GetUint8ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&)
JS_GetUint8ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&)
{
obj = CheckedUnwrap(obj);
if (!obj)
@ -2373,7 +2373,7 @@ JS_GetUint8ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireN
}
JS_FRIEND_API(uint8_t*)
JS_GetUint8ClampedArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&)
JS_GetUint8ClampedArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&)
{
obj = CheckedUnwrap(obj);
if (!obj)
@ -2385,7 +2385,7 @@ JS_GetUint8ClampedArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoR
}
JS_FRIEND_API(int16_t*)
JS_GetInt16ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&)
JS_GetInt16ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&)
{
obj = CheckedUnwrap(obj);
if (!obj)
@ -2397,7 +2397,7 @@ JS_GetInt16ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireN
}
JS_FRIEND_API(uint16_t*)
JS_GetUint16ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&)
JS_GetUint16ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&)
{
obj = CheckedUnwrap(obj);
if (!obj)
@ -2409,7 +2409,7 @@ JS_GetUint16ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequire
}
JS_FRIEND_API(int32_t*)
JS_GetInt32ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&)
JS_GetInt32ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&)
{
obj = CheckedUnwrap(obj);
if (!obj)
@ -2421,7 +2421,7 @@ JS_GetInt32ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireN
}
JS_FRIEND_API(uint32_t*)
JS_GetUint32ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&)
JS_GetUint32ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&)
{
obj = CheckedUnwrap(obj);
if (!obj)
@ -2433,7 +2433,7 @@ JS_GetUint32ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequire
}
JS_FRIEND_API(float*)
JS_GetFloat32ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&)
JS_GetFloat32ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&)
{
obj = CheckedUnwrap(obj);
if (!obj)
@ -2445,7 +2445,7 @@ JS_GetFloat32ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequir
}
JS_FRIEND_API(double*)
JS_GetFloat64ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoRequireNoGC&)
JS_GetFloat64ArrayData(JSObject* obj, bool* isSharedMemory, const JS::AutoCheckCannotGC&)
{
obj = CheckedUnwrap(obj);
if (!obj)

View File

@ -4,7 +4,7 @@
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
</head>
<body>
<iframe src="data:text/html,<body spellcheck=false></body>"></iframe>
<iframe srcdoc="<body spellcheck=false></body>"></iframe>
<script>
onload = function() {
var i = document.querySelector("iframe");

View File

@ -4,7 +4,7 @@
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
</head>
<body>
<iframe src="data:text/html,<body contenteditable spellcheck=false></body>"></iframe>
<iframe srcdoc="<body contenteditable spellcheck=false></body>"></iframe>
<script>
onload = function() {
var i = document.querySelector("iframe");

View File

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<body>
<iframe src="data:text/html,<body spellcheck=false>xx</body>"></iframe>
<iframe srcdoc="<body spellcheck=false>xx</body>"></iframe>
<script>
onload = function() {
var i = document.querySelector("iframe");

View File

@ -3,7 +3,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body onload="start()">
<iframe src="data:text/html,<body contenteditable spellcheck=false>foo bar"></iframe>
<iframe srcdoc="<body contenteditable spellcheck=false>foo bar"></iframe>
<script>
function start() {
var iframe = document.querySelector("iframe");

View File

@ -4,7 +4,7 @@
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
</head>
<body onload="start()">
<iframe src="data:text/html,<body contenteditable spellcheck=false>foo bar"></iframe>
<iframe srcdoc="<body contenteditable spellcheck=false>foo bar"></iframe>
<script>
function start() {
var iframe = document.querySelector("iframe");

View File

@ -4,7 +4,7 @@
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
</head>
<body onload="start()">
<iframe src="data:text/html,<body contenteditable spellcheck=false>Here's some text.<br /><br /><div></div></body>"></iframe>
<iframe srcdoc="<body contenteditable spellcheck=false>Here's some text.<br /><br /><div></div></body>"></iframe>
<script>
function start() {
var iframe = document.querySelector("iframe");

View File

@ -4,7 +4,7 @@
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
</head>
<body onload="start()">
<iframe src="data:text/html,<body contenteditable spellcheck=false><br /><div></div></body>"></iframe>
<iframe srcdoc="<body contenteditable spellcheck=false><br /><div></div></body>"></iframe>
<script>
function start() {
var iframe = document.querySelector("iframe");

View File

@ -0,0 +1,6 @@
<!DOCTYPE HTML>
<html>
<body>
<a href="#anchor">Click to scroll to anchor</a><div style="height:5000px"></div><a name="anchor">FAIL</a>
</body>
</html>

View File

@ -0,0 +1,3 @@
<!DOCTYPE HTML>
<html style='padding:25px'>
<div id='f1d' style='position:absolute; left:14px; top:15px; width:16px; height:17px; background:pink'></div>

View File

@ -0,0 +1 @@
<div id='d'>

View File

@ -85,6 +85,8 @@ support-files =
[test_bug761572.html]
[test_bug770106.html]
[test_bug842853.html]
support-files =
file_bug842853-frame.html
skip-if = toolkit == 'android' # Bug 1355821
[test_bug842853-2.html]
skip-if = toolkit == 'android' # Bug 1355821
@ -143,6 +145,9 @@ skip-if = true # Bug 688128
[test_frame_reconstruction_for_pseudo_elements.html]
[test_frame_reconstruction_scroll_restore.html]
[test_getBoxQuads_convertPointRectQuad.html]
support-files =
file_getBoxQuads_convertPointRectQuad_frame1.html
file_getBoxQuads_convertPointRectQuad_frame2.html
[test_getClientRects_emptytext.html]
[test_mozPaintCount.html]
skip-if = toolkit == 'android' # Requires plugin support
@ -327,7 +332,9 @@ support-files = resize_flush_iframe.html
[test_scroll_event_ordering.html]
[test_scroll_selection_into_view.html]
skip-if = toolkit == 'android' # Bug 1355844
support-files = scroll_selection_into_view_window.html
support-files =
scroll_selection_into_view_window.html
scroll_selection_into_view_window_frame.html
[test_scroll_snapping.html]
skip-if = toolkit == 'android' || os == 'win' # Bug 1355851, win Bug 1379810
[test_scroll_snapping_scrollbars.html]
@ -335,6 +342,8 @@ skip-if = toolkit == 'android' || (os == 'win' && !e10s) # Bug 1355851, bug 1381
[test_transformed_scrolling_repaints.html]
[test_transformed_scrolling_repaints_2.html]
[test_transformed_scrolling_repaints_3.html]
support-files = transformed_scrolling_repaints_3_window.html
support-files =
transformed_scrolling_repaints_3_window.html
transformed_scrolling_repaints_3_window_frame.html
# *** Please maintain alphabetical ordering when adding new tests ***

View File

@ -28,14 +28,7 @@
</div>
<div id="c4" style="overflow-y:scroll; width:200px; height:200px; position:absolute; top:200px; left:600px;">
<iframe id="target4" style="border:none; width:100%; height:1100px; display:block;"
src="data:text/html,
<body style='margin:0; overflow:hidden;'>
<div style='height:400px;'></div>
<div><span id='target4'
style='display:inline-block; vertical-align:top; height:300px;'></span>
</div>
<div style='height:400px;'></div>">
</iframe>
src="scroll_selection_into_view_window_frame.html"></iframe>
</div>
<div id="c5" style="overflow-y:scroll; width:200px; height:200px; position:absolute; top:400px; left:0;">
<div style="-moz-transform:translateY(400px); transform:translateY(400px)">

View File

@ -0,0 +1,6 @@
<body style='margin:0; overflow:hidden;'>
<div style='height:400px;'></div>
<div><span id='target4'
style='display:inline-block; vertical-align:top; height:300px;'></span>
</div>
<div style='height:400px;'></div>

View File

@ -40,7 +40,7 @@ function runTest() {
<script>
var e = document.createElement('iframe');
var url = 'data:text/html,<a href="%23anchor">Click to scroll to anchor</a><div style="height:5000px"></div><a name="anchor">FAIL</a>'
var url = 'file_bug842853-frame.html';
e.setAttribute('src',url);
e.setAttribute('onload','runTest()');
document.body.appendChild(e);

View File

@ -40,7 +40,7 @@ function runTest() {
<script>
var e = document.createElement('iframe');
var url = 'data:text/html,<a href="%23anchor">Click to scroll to anchor</a><div style="height:5000px"></div><a name="anchor">FAIL</a>'
var url = 'file_bug842853-frame.html';
e.setAttribute('src',url);
e.setAttribute('onload','runTest()');
document.body.appendChild(e);

View File

@ -234,7 +234,7 @@ em {
<div id="dUnrelated" style="width:50px; height:50px;"></div>
<iframe id="f1" style="width:50px; height:50px; border:0; background:lime;"
src="data:text/html,<!DOCTYPE HTML><html style='padding:25px'><div id='f1d' style='position:absolute; left:14px; top:15px; width:16px; height:17px; background:pink'></div>">
src="file_getBoxQuads_convertPointRectQuad_frame1.html">
</iframe>
<!--
It matters that the first part of this span is on the same line as the above <iframe>!
@ -686,7 +686,7 @@ function runTest() {
// Test that converting between nodes in different toplevel browsing contexts
// throws an exception.
try {
openedWindow = window.open("data:text/html,<div id='d'>","");
openedWindow = window.open("file_getBoxQuads_convertPointRectQuad_frame2.html","");
} catch (ex) {
// in some cases we can't open the window.
openedWindow = null;

View File

@ -7,65 +7,8 @@
<!-- Need a timeout here to allow paint unsuppression before we start the test -->
<body onload="setTimeout(startTest,0)" style="background:white;">
<iframe id="t" style="-moz-transform: scale(0.48979); -moz-transform-origin:top left; width:500px; height:600px;"
src="data:text/html,
<body style='background:yellow;'>
<p>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that
there are some real dicks out there, and some of them happen to be
scientists.
<p id='e'>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that
there are some real dicks out there, and some of them happen to be
scientists.
<p>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that
there are some real dicks out there, and some of them happen to be
scientists.
<p>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that
there are some real dicks out there, and some of them happen to be
scientists.
<p>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that
there are some real dicks out there, and some of them happen to be
scientists.
<p>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that
there are some real dicks out there, and some of them happen to be
scientists.
<p>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that
there are some real dicks out there, and some of them happen to be
scientists.
<p>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that
there are some real dicks out there, and some of them happen to be
scientists.
<p>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that
there are some real dicks out there, and some of them happen to be
scientists.
<p>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that
there are some real dicks out there, and some of them happen to be
scientists.
<p>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that
there are some real dicks out there, and some of them happen to be
scientists.
<p>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that
there are some real dicks out there, and some of them happen to be
scientists.
<p>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that
there are some real dicks out there, and some of them happen to be
scientists.
<p>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that
there are some real dicks out there, and some of them happen to be
scientists.
</body>"></iframe>
src="transformed_scrolling_repaints_3_window_frame.html">
</iframe>
<pre id="test">
<script type="application/javascript">
var SimpleTest = window.opener.SimpleTest;

View File

@ -0,0 +1,58 @@
<body style='background:yellow;'>
<p>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that
there are some real dicks out there, and some of them happen to be
scientists.
<p id='e'>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that
there are some real dicks out there, and some of them happen to be
scientists.
<p>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that
there are some real dicks out there, and some of them happen to be
scientists.
<p>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that
there are some real dicks out there, and some of them happen to be
scientists.
<p>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that
there are some real dicks out there, and some of them happen to be
scientists.
<p>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that
there are some real dicks out there, and some of them happen to be
scientists.
<p>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that
there are some real dicks out there, and some of them happen to be
scientists.
<p>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that
there are some real dicks out there, and some of them happen to be
scientists.
<p>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that
there are some real dicks out there, and some of them happen to be
scientists.
<p>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that
there are some real dicks out there, and some of them happen to be
scientists.
<p>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that
there are some real dicks out there, and some of them happen to be
scientists.
<p>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that
there are some real dicks out there, and some of them happen to be
scientists.
<p>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that
there are some real dicks out there, and some of them happen to be
scientists.
<p>My graduate adviser was the most patient, understanding, and helpful
person I've ever had the joy of dealing with. That doesn't change that
there are some real dicks out there, and some of them happen to be
scientists.
</body>

View File

@ -30,6 +30,7 @@ mk_add_options AUTOCLOBBER=
# Disable Keyfile Loading (and checks) since l10n doesn't need these keys
# This overrides the settings in the common android mozconfig
ac_add_options --without-mozilla-api-keyfile
ac_add_options --without-google-api-keyfile
ac_add_options --without-adjust-sdk-keyfile
ac_add_options --without-leanplum-sdk-keyfile
# Similarly explicitly disable install tracking for l10n, we'll inherit from en-US

View File

@ -30,6 +30,7 @@ mk_add_options AUTOCLOBBER=
# Disable Keyfile Loading (and checks) since l10n doesn't need these keys
# This overrides the settings in the common android mozconfig
ac_add_options --without-mozilla-api-keyfile
ac_add_options --without-google-api-keyfile
ac_add_options --without-adjust-sdk-keyfile
ac_add_options --without-leanplum-sdk-keyfile
# Similarly explicitly disable install tracking for l10n, we'll inherit from en-US

View File

@ -41,6 +41,7 @@ fi
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
ac_add_options --with-google-api-keyfile=/builds/gapi.data
ac_add_options --with-mozilla-api-keyfile=/builds/mozilla-fennec-geoloc-api.key
# MOZ_INSTALL_TRACKING does not guarantee MOZ_UPDATE_CHANNEL will be set so we

View File

@ -151,6 +151,11 @@ StackWalkInitCriticalAddress()
// restore the previous malloc logger
malloc_logger = old_malloc_logger;
// XXX: the critical address machinery appears to have been unnecessary since
// Mac OS 10.7 (the minimum version we currently support is 10.9). See bug
// 1384814 for details.
MOZ_DIAGNOSTIC_ASSERT(!gCriticalAddress.mAddr);
MOZ_ASSERT(r == ETIMEDOUT);
r = pthread_mutex_unlock(&mutex);
MOZ_ASSERT(r == 0);

View File

@ -1431,23 +1431,23 @@ nsStandardURL::CheckIfHostIsAscii()
mCheckedIfHostA = true;
// If the hostname doesn't begin with `xn--` we are sure it is ASCII.
if (!StringBeginsWith(Host(), NS_LITERAL_CSTRING("xn--"))) {
return NS_OK;
}
if (!gIDN) {
return NS_ERROR_NOT_INITIALIZED;
}
nsAutoCString displayHost;
bool isAscii;
rv = gIDN->ConvertToDisplayIDN(Host(), &isAscii, mDisplayHost);
rv = gIDN->ConvertToDisplayIDN(Host(), &isAscii, displayHost);
if (NS_FAILED(rv)) {
mDisplayHost.Truncate();
mCheckedIfHostA = false;
return rv;
}
if (!isAscii) {
mDisplayHost = displayHost;
}
return NS_OK;
}

View File

@ -525,6 +525,10 @@ add_test(function test_idna_host() {
equal(url.displaySpec, "http://user:password@ält.example.org:8080/path?query");
equal(url.asciiSpec, "http://user:password@xn--lt-uia.example.org:8080/path?query");
url = stringToURL("http://user:password@www.ält.com:8080/path?query#etc");
url.ref = "";
equal(url.spec, "http://user:password@www.ält.com:8080/path?query");
// We also check that the default behaviour changes once we filp the pref
gPrefs.setBoolPref("network.standard-url.punycode-host", true);
@ -549,5 +553,9 @@ add_test(function test_idna_host() {
equal(url.displaySpec, "http://user:password@ält.example.org:8080/path?query");
equal(url.asciiSpec, "http://user:password@xn--lt-uia.example.org:8080/path?query");
url = stringToURL("http://user:password@www.ält.com:8080/path?query#etc");
url.ref = "";
equal(url.spec, "http://user:password@www.xn--lt-uia.com:8080/path?query");
run_next_test();
});

View File

@ -30,6 +30,7 @@ config = {
('/home/cltbld/.ssh', '/home/mock_mozilla/.ssh'),
('/home/cltbld/.hgrc', '/builds/.hgrc'),
('/home/cltbld/.boto', '/builds/.boto'),
('/builds/gapi.data', '/builds/gapi.data'),
('/builds/relengapi.tok', '/builds/relengapi.tok'),
('/tools/tooltool.py', '/builds/tooltool.py'),
('/builds/mozilla-api.key', '/builds/mozilla-api.key'),
@ -38,6 +39,9 @@ config = {
('/usr/local/lib/hgext', '/usr/local/lib/hgext'),
],
'secret_files': [
{'filename': '/builds/gapi.data',
'secret_name': 'project/releng/gecko/build/level-%(scm-level)s/gapi.data',
'min_scm_level': 1},
{'filename': '/builds/mozilla-fennec-geoloc-api.key',
'secret_name': 'project/releng/gecko/build/level-%(scm-level)s/mozilla-fennec-geoloc-api.key',
'min_scm_level': 2, 'default': 'try-build-has-no-secrets'},

View File

@ -102,6 +102,7 @@ PageIconProtocolHandler.prototype = {
} else {
try {
channel.contentType = mimeType;
channel.contentLength = len;
serveIcon(pipe, data, len);
} catch (ex) {
streamDefaultFavicon(uri, loadInfo, pipe.outputStream, channel);