This commit is contained in:
Ryan VanderMeulen 2013-08-22 20:47:37 -04:00
Родитель 7e3cad539b cb751a0c38
Коммит 61ddf114c1
133 изменённых файлов: 1239 добавлений и 939 удалений

Просмотреть файл

@ -1767,16 +1767,20 @@ ContentPermissionPrompt.prototype = {
var browserBundle = Services.strings.createBundle("chrome://browser/locale/browser.properties");
var requestingWindow = aRequest.window.top;
var chromeWin = this._getChromeWindow(requestingWindow).wrappedJSObject;
var browser = chromeWin.gBrowser.getBrowserForDocument(requestingWindow.document);
var browser;
try {
// "element" is only defined in e10s mode, otherwise it throws.
browser = aRequest.element;
} catch (e) {}
if (!browser) {
var requestingWindow = aRequest.window.top;
// find the requesting browser or iframe
browser = requestingWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell)
.chromeEventHandler;
}
var chromeWin = browser.ownerDocument.defaultView;
var requestPrincipal = aRequest.principal;
// Transform the prompt actions into PopupNotification actions.

Просмотреть файл

@ -22,129 +22,141 @@ function test() {
tabList = new DebuggerServer.BrowserTabList("fake DebuggerServerConnection");
tabList._testing = true;
tabList.onListChanged = onListChangedHandler;
checkSingleTab();
// Open a new tab. We should be notified.
is(onListChangedCount, 0, "onListChanged handler call count");
tabA = addTab(testPage, onTabA);
checkSingleTab(function () {
is(onListChangedCount, 0, "onListChanged handler call count");
tabA = addTab(testPage, onTabA);
});
}
function checkSingleTab() {
var tabActors = [t for (t of tabList)];
is(tabActors.length, 1, "initial tab list: contains initial tab");
firstActor = tabActors[0];
is(firstActor.url, "about:blank", "initial tab list: initial tab URL is 'about:blank'");
is(firstActor.title, "New Tab", "initial tab list: initial tab title is 'New Tab'");
function checkSingleTab(callback) {
tabList.getList().then(function (tabActors) {
is(tabActors.length, 1, "initial tab list: contains initial tab");
firstActor = tabActors[0];
is(firstActor.url, "about:blank", "initial tab list: initial tab URL is 'about:blank'");
is(firstActor.title, "New Tab", "initial tab list: initial tab title is 'New Tab'");
callback();
});
}
function onTabA() {
is(onListChangedCount, 1, "onListChanged handler call count");
var tabActors = new Set([t for (t of tabList)]);
is(tabActors.size, 2, "tabA opened: two tabs in list");
ok(tabActors.has(firstActor), "tabA opened: initial tab present");
tabList.getList().then(function (tabActors) {
tabActors = new Set(tabActors);
is(tabActors.size, 2, "tabA opened: two tabs in list");
ok(tabActors.has(firstActor), "tabA opened: initial tab present");
info("actors: " + [a.url for (a of tabActors)]);
actorA = [a for (a of tabActors) if (a !== firstActor)][0];
ok(actorA.url.match(/^data:text\/html;/), "tabA opened: new tab URL");
is(actorA.title, "JS Debugger BrowserTabList test page", "tabA opened: new tab title");
info("actors: " + [a.url for (a of tabActors)]);
actorA = [a for (a of tabActors) if (a !== firstActor)][0];
ok(actorA.url.match(/^data:text\/html;/), "tabA opened: new tab URL");
is(actorA.title, "JS Debugger BrowserTabList test page", "tabA opened: new tab title");
tabB = addTab(testPage, onTabB);
tabB = addTab(testPage, onTabB);
});
}
function onTabB() {
is(onListChangedCount, 2, "onListChanged handler call count");
var tabActors = new Set([t for (t of tabList)]);
is(tabActors.size, 3, "tabB opened: three tabs in list");
tabList.getList().then(function (tabActors) {
tabActors = new Set(tabActors);
is(tabActors.size, 3, "tabB opened: three tabs in list");
// Test normal close.
gBrowser.tabContainer.addEventListener("TabClose", function onClose(aEvent) {
gBrowser.tabContainer.removeEventListener("TabClose", onClose, false);
ok(!aEvent.detail, "This was a normal tab close");
// Let the actor's TabClose handler finish first.
executeSoon(testTabClose);
}, false);
gBrowser.removeTab(tabA);
// Test normal close.
gBrowser.tabContainer.addEventListener("TabClose", function onClose(aEvent) {
gBrowser.tabContainer.removeEventListener("TabClose", onClose, false);
ok(!aEvent.detail, "This was a normal tab close");
// Let the actor's TabClose handler finish first.
executeSoon(testTabClose);
}, false);
gBrowser.removeTab(tabA);
});
}
function testTabClose() {
is(onListChangedCount, 3, "onListChanged handler call count");
var tabActors = new Set([t for (t of tabList)]);
is(tabActors.size, 2, "tabA closed: two tabs in list");
ok(tabActors.has(firstActor), "tabA closed: initial tab present");
tabList.getList().then(function (tabActors) {
tabActors = new Set(tabActors);
is(tabActors.size, 2, "tabA closed: two tabs in list");
ok(tabActors.has(firstActor), "tabA closed: initial tab present");
info("actors: " + [a.url for (a of tabActors)]);
actorA = [a for (a of tabActors) if (a !== firstActor)][0];
ok(actorA.url.match(/^data:text\/html;/), "tabA closed: new tab URL");
is(actorA.title, "JS Debugger BrowserTabList test page", "tabA closed: new tab title");
info("actors: " + [a.url for (a of tabActors)]);
actorA = [a for (a of tabActors) if (a !== firstActor)][0];
ok(actorA.url.match(/^data:text\/html;/), "tabA closed: new tab URL");
is(actorA.title, "JS Debugger BrowserTabList test page", "tabA closed: new tab title");
// Test tab close by moving tab to a window.
tabC = addTab(testPage, onTabC);
// Test tab close by moving tab to a window.
tabC = addTab(testPage, onTabC);
});
}
function onTabC() {
is(onListChangedCount, 4, "onListChanged handler call count");
var tabActors = new Set([t for (t of tabList)]);
is(tabActors.size, 3, "tabC opened: three tabs in list");
tabList.getList().then(function (tabActors) {
tabActors = new Set(tabActors);
is(tabActors.size, 3, "tabC opened: three tabs in list");
gBrowser.tabContainer.addEventListener("TabClose", function onClose2(aEvent) {
gBrowser.tabContainer.removeEventListener("TabClose", onClose2, false);
ok(aEvent.detail, "This was a tab closed by moving");
// Let the actor's TabClose handler finish first.
executeSoon(testWindowClose);
}, false);
newWin = gBrowser.replaceTabWithWindow(tabC);
gBrowser.tabContainer.addEventListener("TabClose", function onClose2(aEvent) {
gBrowser.tabContainer.removeEventListener("TabClose", onClose2, false);
ok(aEvent.detail, "This was a tab closed by moving");
// Let the actor's TabClose handler finish first.
executeSoon(testWindowClose);
}, false);
newWin = gBrowser.replaceTabWithWindow(tabC);
});
}
function testWindowClose() {
is(onListChangedCount, 5, "onListChanged handler call count");
var tabActors = new Set([t for (t of tabList)]);
is(tabActors.size, 3, "tabC closed: three tabs in list");
ok(tabActors.has(firstActor), "tabC closed: initial tab present");
tabList.getList().then(function (tabActors) {
tabActors = new Set(tabActors);
is(tabActors.size, 3, "tabC closed: three tabs in list");
ok(tabActors.has(firstActor), "tabC closed: initial tab present");
info("actors: " + [a.url for (a of tabActors)]);
actorA = [a for (a of tabActors) if (a !== firstActor)][0];
ok(actorA.url.match(/^data:text\/html;/), "tabC closed: new tab URL");
is(actorA.title, "JS Debugger BrowserTabList test page", "tabC closed: new tab title");
info("actors: " + [a.url for (a of tabActors)]);
actorA = [a for (a of tabActors) if (a !== firstActor)][0];
ok(actorA.url.match(/^data:text\/html;/), "tabC closed: new tab URL");
is(actorA.title, "JS Debugger BrowserTabList test page", "tabC closed: new tab title");
// Cleanup.
newWin.addEventListener("unload", function onUnload(aEvent) {
newWin.removeEventListener("unload", onUnload, false);
ok(!aEvent.detail, "This was a normal window close");
// Let the actor's TabClose handler finish first.
executeSoon(checkWindowClose);
}, false);
newWin.close();
// Cleanup.
newWin.addEventListener("unload", function onUnload(aEvent) {
newWin.removeEventListener("unload", onUnload, false);
ok(!aEvent.detail, "This was a normal window close");
// Let the actor's TabClose handler finish first.
executeSoon(checkWindowClose);
}, false);
newWin.close();
});
}
function checkWindowClose() {
is(onListChangedCount, 6, "onListChanged handler call count");
// Check that closing a XUL window leaves the other actors intact.
var tabActors = new Set([t for (t of tabList)]);
is(tabActors.size, 2, "newWin closed: two tabs in list");
ok(tabActors.has(firstActor), "newWin closed: initial tab present");
tabList.getList().then(function (tabActors) {
tabActors = new Set(tabActors);
is(tabActors.size, 2, "newWin closed: two tabs in list");
ok(tabActors.has(firstActor), "newWin closed: initial tab present");
info("actors: " + [a.url for (a of tabActors)]);
actorA = [a for (a of tabActors) if (a !== firstActor)][0];
ok(actorA.url.match(/^data:text\/html;/), "newWin closed: new tab URL");
is(actorA.title, "JS Debugger BrowserTabList test page", "newWin closed: new tab title");
info("actors: " + [a.url for (a of tabActors)]);
actorA = [a for (a of tabActors) if (a !== firstActor)][0];
ok(actorA.url.match(/^data:text\/html;/), "newWin closed: new tab URL");
is(actorA.title, "JS Debugger BrowserTabList test page", "newWin closed: new tab title");
// Test normal close.
gBrowser.tabContainer.addEventListener("TabClose", function onClose(aEvent) {
gBrowser.tabContainer.removeEventListener("TabClose", onClose, false);
ok(!aEvent.detail, "This was a normal tab close");
// Let the actor's TabClose handler finish first.
executeSoon(finishTest);
}, false);
gBrowser.removeTab(tabB);
// Test normal close.
gBrowser.tabContainer.addEventListener("TabClose", function onClose(aEvent) {
gBrowser.tabContainer.removeEventListener("TabClose", onClose, false);
ok(!aEvent.detail, "This was a normal tab close");
// Let the actor's TabClose handler finish first.
executeSoon(finishTest);
}, false);
gBrowser.removeTab(tabB);
});
}
function finishTest() {
checkSingleTab();
finish();
checkSingleTab(finish);
}

Просмотреть файл

@ -5806,6 +5806,18 @@ MOZ_ARG_DISABLE_BOOL(permissions,
MOZ_PERMISSIONS=1
)
dnl ========================================================
dnl Child permissions, currently only used for b2g
dnl ========================================================
if test -n "$MOZ_B2G"; then
if test -n "$MOZ_PERMISSIONS"; then
MOZ_CHILD_PERMISSIONS=1
else
AC_MSG_ERROR([You need to enable MOZ_PERMISSIONS for MOZ_CHILD_PERMISSIONS])
fi
fi
AC_SUBST(MOZ_CHILD_PERMISSIONS)
dnl ========================================================
dnl NegotiateAuth
dnl ========================================================

Просмотреть файл

@ -82,6 +82,13 @@
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/Telemetry.h"
#ifdef XP_WIN
// Thanks so much, Microsoft! :(
#ifdef CreateEvent
#undef CreateEvent
#endif
#endif // XP_WIN
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
using namespace mozilla;

Просмотреть файл

@ -669,15 +669,14 @@ MOCHITEST_FILES_C= \
$(NULL)
# OOP tests don't work on Windows (bug 763081) or native-fennec
# (see Bug 774939)
ifneq ($(OS_ARCH),WINNT)
ifndef MOZ_ANDROID_OMTC
# (see Bug 774939). App permission checks are also disabled on
# anything but B2G (Bug 900707).
ifdef MOZ_CHILD_PERMISSIONS
MOCHITEST_FILES_B += \
test_messagemanager_assertpermission.html \
test_child_process_shutdown_message.html \
$(NULL)
endif
endif
MOCHITEST_CHROME_FILES = \
test_bug357450.js \

Просмотреть файл

@ -971,16 +971,16 @@ bool WebGLContext::IsExtensionSupported(WebGLExtensionID ext) const
switch (ext) {
case OES_element_index_uint:
return gl->IsExtensionSupported(GLContext::XXX_element_index_uint);
return gl->IsSupported(GLFeature::element_index_uint);
case OES_standard_derivatives:
return gl->IsExtensionSupported(GLContext::XXX_standard_derivatives);
return gl->IsSupported(GLFeature::standard_derivatives);
case WEBGL_lose_context:
// We always support this extension.
return true;
case OES_texture_float:
return gl->IsExtensionSupported(GLContext::XXX_texture_float);
return gl->IsSupported(GLFeature::texture_float);
case OES_texture_float_linear:
return gl->IsExtensionSupported(GLContext::XXX_texture_float_linear);
return gl->IsSupported(GLFeature::texture_float_linear);
case OES_vertex_array_object:
return WebGLExtensionVertexArray::IsSupported(this);
case EXT_texture_filter_anisotropic:
@ -1001,8 +1001,8 @@ bool WebGLContext::IsExtensionSupported(WebGLExtensionID ext) const
case WEBGL_compressed_texture_pvrtc:
return gl->IsExtensionSupported(GLContext::IMG_texture_compression_pvrtc);
case WEBGL_depth_texture:
return gl->IsExtensionSupported(GLContext::XXX_packed_depth_stencil) &&
gl->IsExtensionSupported(GLContext::XXX_depth_texture);
return gl->IsSupported(GLFeature::packed_depth_stencil) &&
gl->IsSupported(GLFeature::depth_texture);
case ANGLE_instanced_arrays:
return WebGLExtensionInstancedArrays::IsSupported(this);
default:

Просмотреть файл

@ -44,9 +44,9 @@ SimulateOcclusionQueryTarget(const gl::GLContext* gl, GLenum target)
target == LOCAL_GL_ANY_SAMPLES_PASSED_CONSERVATIVE,
"unknown occlusion query target");
if (gl->IsExtensionSupported(gl::GLContext::XXX_occlusion_query_boolean)) {
if (gl->IsSupported(gl::GLFeature::occlusion_query_boolean)) {
return target;
} else if (gl->IsExtensionSupported(gl::GLContext::XXX_occlusion_query2)) {
} else if (gl->IsSupported(gl::GLFeature::occlusion_query2)) {
return LOCAL_GL_ANY_SAMPLES_PASSED;
}

Просмотреть файл

@ -868,7 +868,7 @@ WebGLContext::InitAndValidateGL()
mGLMaxVertexUniformVectors = MINVALUE_GL_MAX_VERTEX_UNIFORM_VECTORS;
mGLMaxVaryingVectors = MINVALUE_GL_MAX_VARYING_VECTORS;
} else {
if (gl->IsExtensionSupported(gl::GLContext::XXX_ES2_compatibility)) {
if (gl->IsSupported(gl::GLFeature::ES2_compatibility)) {
gl->fGetIntegerv(LOCAL_GL_MAX_FRAGMENT_UNIFORM_VECTORS, &mGLMaxFragmentUniformVectors);
gl->fGetIntegerv(LOCAL_GL_MAX_VERTEX_UNIFORM_VECTORS, &mGLMaxVertexUniformVectors);
gl->fGetIntegerv(LOCAL_GL_MAX_VARYING_VECTORS, &mGLMaxVaryingVectors);
@ -971,8 +971,8 @@ WebGLContext::InitAndValidateGL()
!IsExtensionSupported(ANGLE_instanced_arrays) ||
!gl->IsExtensionSupported(gl::GLContext::EXT_gpu_shader4) ||
!gl->IsExtensionSupported(gl::GLContext::EXT_blend_minmax) ||
(!gl->IsExtensionSupported(gl::GLContext::XXX_occlusion_query) &&
!gl->IsExtensionSupported(gl::GLContext::XXX_occlusion_query_boolean))
(!gl->IsSupported(gl::GLFeature::occlusion_query) &&
!gl->IsSupported(gl::GLFeature::occlusion_query_boolean))
))
{
// Todo: Bug 898404: Only allow WebGL2 on GL>=3.0 on desktop GL.

Просмотреть файл

@ -55,7 +55,7 @@ bool WebGLExtensionDrawBuffers::IsSupported(const WebGLContext* context)
{
gl::GLContext * gl = context->GL();
if (!gl->IsExtensionSupported(GLContext::XXX_draw_buffers)) {
if (!gl->IsSupported(GLFeature::draw_buffers)) {
return false;
}

Просмотреть файл

@ -46,8 +46,8 @@ WebGLExtensionInstancedArrays::IsSupported(const WebGLContext* context)
{
gl::GLContext* gl = context->GL();
return gl->IsExtensionSupported(gl::GLContext::XXX_draw_instanced) &&
gl->IsExtensionSupported(gl::GLContext::XXX_instanced_arrays);
return gl->IsSupported(gl::GLFeature::draw_instanced) &&
gl->IsSupported(gl::GLFeature::instanced_arrays);
}
IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionInstancedArrays)

Просмотреть файл

@ -46,7 +46,7 @@ bool WebGLExtensionVertexArray::IsSupported(const WebGLContext* context)
{
gl::GLContext* gl = context->GL();
return gl->IsExtensionSupported(gl::GLContext::XXX_vertex_array_object);
return gl->IsSupported(gl::GLFeature::vertex_array_object);
}
IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionVertexArray)

Просмотреть файл

@ -76,6 +76,7 @@
#include "ImageContainer.h"
#include "nsIPowerManagerService.h"
#include "nsRange.h"
#include <algorithm>
#ifdef PR_LOGGING

Просмотреть файл

@ -336,7 +336,7 @@ this.DOMFMRadioParent = {
let self = this;
FMRadio.addEventListener("enabled", function on_enabled() {
debug("FM Radio is enabled!");
dump("Perf:FMRadio:Enable " + (Date.now()- timeStart) + " ms.\n");
self._enabling = false;
FMRadio.removeEventListener("enabled", on_enabled);
@ -358,6 +358,8 @@ this.DOMFMRadioParent = {
ppmm.broadcastAsyncMessage("DOMFMRadio:frequencyChange", { });
});
let timeStart = Date.now();
FMRadio.enable({
lowerLimit: FM_BANDS[self._currentBand].lower,
upperLimit: FM_BANDS[self._currentBand].upper,

Просмотреть файл

@ -18,6 +18,8 @@ using namespace mozilla::services;
namespace mozilla {
#ifdef MOZ_CHILD_PERMISSIONS
bool
AssertAppProcess(PBrowserParent* aActor,
AssertAppProcessType aType,
@ -123,4 +125,47 @@ AssertAppProcess(PHalParent* aActor,
return AssertAppProcess(aActor->Manager(), aType, aCapability);
}
#else
bool
AssertAppProcess(mozilla::dom::PBrowserParent* aActor,
AssertAppProcessType aType,
const char* aCapability)
{
return true;
}
bool
AssertAppStatus(mozilla::dom::PBrowserParent* aActor,
unsigned short aStatus)
{
return true;
}
bool
AssertAppProcess(mozilla::dom::PContentParent* aActor,
AssertAppProcessType aType,
const char* aCapability)
{
return true;
}
bool
AssertAppStatus(mozilla::dom::PContentParent* aActor,
unsigned short aStatus)
{
return true;
}
bool
AssertAppProcess(mozilla::hal_sandbox::PHalParent* aActor,
AssertAppProcessType aType,
const char* aCapability)
{
return true;
}
#endif
} // namespace mozilla

Просмотреть файл

@ -14,6 +14,7 @@
#include "nsIDOMFile.h"
#include "nsIInputStream.h"
#include "nsIIPCSerializableInputStream.h"
#include "nsIMultiplexInputStream.h"
#include "nsIRemoteBlob.h"
#include "nsISeekableStream.h"
@ -21,6 +22,7 @@
#include "mozilla/unused.h"
#include "mozilla/ipc/InputStreamUtils.h"
#include "nsDOMFile.h"
#include "nsProxyRelease.h"
#include "nsThreadUtils.h"
#include "ContentChild.h"
@ -35,6 +37,24 @@ using namespace mozilla::ipc;
namespace {
/**
* Ensure that a nsCOMPtr/nsRefPtr is released on the main thread.
*/
template <template <class> class SmartPtr, class T>
void
ProxyReleaseToMainThread(SmartPtr<T>& aDoomed)
{
MOZ_ASSERT(!NS_IsMainThread());
nsCOMPtr<nsIThread> mainThread = do_GetMainThread();
NS_ENSURE_TRUE_VOID(mainThread);
if (NS_FAILED(NS_ProxyRelease(mainThread, aDoomed, true))) {
NS_WARNING("Failed to proxy release to main thread!");
}
}
class NS_NO_VTABLE IPrivateRemoteInputStream : public nsISupports
{
public:
@ -48,15 +68,89 @@ public:
NS_DEFINE_STATIC_IID_ACCESSOR(IPrivateRemoteInputStream,
PRIVATE_REMOTE_INPUT_STREAM_IID)
// This class exists to keep a blob alive at least as long as its internal
// stream.
class BlobInputStreamTether : public nsIMultiplexInputStream,
public nsISeekableStream,
public nsIIPCSerializableInputStream
{
nsCOMPtr<nsIInputStream> mStream;
nsCOMPtr<nsIDOMBlob> mSourceBlob;
nsIMultiplexInputStream* mWeakMultiplexStream;
nsISeekableStream* mWeakSeekableStream;
nsIIPCSerializableInputStream* mWeakSerializableStream;
public:
NS_DECL_THREADSAFE_ISUPPORTS
NS_FORWARD_NSIINPUTSTREAM(mStream->)
NS_FORWARD_SAFE_NSIMULTIPLEXINPUTSTREAM(mWeakMultiplexStream)
NS_FORWARD_SAFE_NSISEEKABLESTREAM(mWeakSeekableStream)
NS_FORWARD_SAFE_NSIIPCSERIALIZABLEINPUTSTREAM(mWeakSerializableStream)
BlobInputStreamTether(nsIInputStream* aStream, nsIDOMBlob* aSourceBlob)
: mStream(aStream), mSourceBlob(aSourceBlob), mWeakMultiplexStream(nullptr),
mWeakSeekableStream(nullptr), mWeakSerializableStream(nullptr)
{
MOZ_ASSERT(aStream);
MOZ_ASSERT(aSourceBlob);
nsCOMPtr<nsIMultiplexInputStream> multiplexStream =
do_QueryInterface(aStream);
if (multiplexStream) {
MOZ_ASSERT(SameCOMIdentity(aStream, multiplexStream));
mWeakMultiplexStream = multiplexStream;
}
nsCOMPtr<nsISeekableStream> seekableStream = do_QueryInterface(aStream);
if (seekableStream) {
MOZ_ASSERT(SameCOMIdentity(aStream, seekableStream));
mWeakSeekableStream = seekableStream;
}
nsCOMPtr<nsIIPCSerializableInputStream> serializableStream =
do_QueryInterface(aStream);
if (serializableStream) {
MOZ_ASSERT(SameCOMIdentity(aStream, serializableStream));
mWeakSerializableStream = serializableStream;
}
}
protected:
virtual ~BlobInputStreamTether()
{
MOZ_ASSERT(mStream);
MOZ_ASSERT(mSourceBlob);
if (!NS_IsMainThread()) {
mStream = nullptr;
ProxyReleaseToMainThread(mSourceBlob);
}
}
};
NS_IMPL_ADDREF(BlobInputStreamTether)
NS_IMPL_RELEASE(BlobInputStreamTether)
NS_INTERFACE_MAP_BEGIN(BlobInputStreamTether)
NS_INTERFACE_MAP_ENTRY(nsIInputStream)
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIMultiplexInputStream,
mWeakMultiplexStream)
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsISeekableStream, mWeakSeekableStream)
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIIPCSerializableInputStream,
mWeakSerializableStream)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIInputStream)
NS_INTERFACE_MAP_END
class RemoteInputStream : public nsIInputStream,
public nsISeekableStream,
public nsIIPCSerializableInputStream,
public IPrivateRemoteInputStream
{
mozilla::Monitor mMonitor;
nsCOMPtr<nsIDOMBlob> mSourceBlob;
nsCOMPtr<nsIInputStream> mStream;
nsCOMPtr<nsISeekableStream> mSeekableStream;
nsCOMPtr<nsIDOMBlob> mSourceBlob;
nsISeekableStream* mWeakSeekableStream;
ActorFlavorEnum mOrigin;
public:
@ -64,7 +158,7 @@ public:
RemoteInputStream(nsIDOMBlob* aSourceBlob, ActorFlavorEnum aOrigin)
: mMonitor("RemoteInputStream.mMonitor"), mSourceBlob(aSourceBlob),
mOrigin(aOrigin)
mWeakSeekableStream(nullptr), mOrigin(aOrigin)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aSourceBlob);
@ -102,14 +196,16 @@ public:
nsCOMPtr<nsIInputStream> stream = aStream;
nsCOMPtr<nsISeekableStream> seekableStream = do_QueryInterface(aStream);
MOZ_ASSERT_IF(seekableStream, SameCOMIdentity(aStream, seekableStream));
{
mozilla::MonitorAutoLock lock(mMonitor);
MOZ_ASSERT(!mStream);
MOZ_ASSERT(!mSeekableStream);
MOZ_ASSERT(!mWeakSeekableStream);
mStream.swap(stream);
mSeekableStream.swap(seekableStream);
mWeakSeekableStream = seekableStream;
mMonitor.Notify();
}
@ -187,12 +283,12 @@ public:
nsresult rv = BlockAndWaitForStream();
NS_ENSURE_SUCCESS(rv, rv);
if (!mSeekableStream) {
if (!mWeakSeekableStream) {
NS_WARNING("Underlying blob stream is not seekable!");
return NS_ERROR_NO_INTERFACE;
}
rv = mSeekableStream->Seek(aWhence, aOffset);
rv = mWeakSeekableStream->Seek(aWhence, aOffset);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@ -212,12 +308,12 @@ public:
nsresult rv = BlockAndWaitForStream();
NS_ENSURE_SUCCESS(rv, rv);
if (!mSeekableStream) {
if (!mWeakSeekableStream) {
NS_WARNING("Underlying blob stream is not seekable!");
return NS_ERROR_NO_INTERFACE;
}
rv = mSeekableStream->Tell(aResult);
rv = mWeakSeekableStream->Tell(aResult);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@ -229,12 +325,12 @@ public:
nsresult rv = BlockAndWaitForStream();
NS_ENSURE_SUCCESS(rv, rv);
if (!mSeekableStream) {
if (!mWeakSeekableStream) {
NS_WARNING("Underlying blob stream is not seekable!");
return NS_ERROR_NO_INTERFACE;
}
rv = mSeekableStream->SetEOF();
rv = mWeakSeekableStream->SetEOF();
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;
@ -253,7 +349,13 @@ public:
private:
virtual ~RemoteInputStream()
{ }
{
if (!NS_IsMainThread()) {
mStream = nullptr;
mWeakSeekableStream = nullptr;
ProxyReleaseToMainThread(mSourceBlob);
}
}
void
ReallyBlockAndWaitForStream()
@ -273,9 +375,9 @@ private:
MOZ_ASSERT(mStream);
#ifdef DEBUG
if (waited && mSeekableStream) {
if (waited && mWeakSeekableStream) {
int64_t position;
MOZ_ASSERT(NS_SUCCEEDED(mSeekableStream->Tell(&position)),
MOZ_ASSERT(NS_SUCCEEDED(mWeakSeekableStream->Tell(&position)),
"Failed to determine initial stream position!");
MOZ_ASSERT(!position, "Stream not starting at 0!");
}
@ -308,7 +410,7 @@ private:
ReallyBlockAndWaitForStream();
}
return !!mSeekableStream;
return !!mWeakSeekableStream;
}
};
@ -655,6 +757,24 @@ public:
private:
ActorType* mActor;
virtual ~RemoteBlob()
{
if (mActor) {
mActor->NoteDyingRemoteBlob();
}
}
nsresult
GetInternalStreamViaHelper(nsIInputStream** aStream)
{
if (!mActor) {
return NS_ERROR_UNEXPECTED;
}
nsRefPtr<StreamHelper> helper = new StreamHelper(mActor, this);
return helper->GetStream(aStream);
}
class StreamHelper : public nsRunnable
{
typedef Blob<ActorFlavor> ActorType;
@ -893,13 +1013,6 @@ public:
mImmutable = true;
}
virtual ~RemoteBlob()
{
if (mActor) {
mActor->NoteDyingRemoteBlob();
}
}
void
SetActor(ActorType* aActor)
{
@ -938,7 +1051,7 @@ public:
}
NS_IMETHOD
GetLastModifiedDate(JSContext* cx, JS::Value* aLastModifiedDate)
GetLastModifiedDate(JSContext* cx, JS::Value* aLastModifiedDate) MOZ_OVERRIDE
{
if (IsDateUnknown()) {
aLastModifiedDate->setNull();
@ -980,34 +1093,27 @@ NS_IMETHODIMP
RemoteBlob<Parent>::GetInternalStream(nsIInputStream** aStream)
{
if (mInputStreamParams.type() != InputStreamParams::T__None) {
nsCOMPtr<nsIInputStream> stream = DeserializeInputStream(mInputStreamParams);
if (!stream) {
nsCOMPtr<nsIInputStream> realStream =
DeserializeInputStream(mInputStreamParams);
if (!realStream) {
NS_WARNING("Failed to deserialize stream!");
return NS_ERROR_UNEXPECTED;
}
nsCOMPtr<nsIInputStream> stream =
new BlobInputStreamTether(realStream, this);
stream.forget(aStream);
return NS_OK;
}
if (!mActor) {
return NS_ERROR_UNEXPECTED;
}
nsRefPtr<StreamHelper> helper = new StreamHelper(mActor, this);
return helper->GetStream(aStream);
return GetInternalStreamViaHelper(aStream);
}
template <>
NS_IMETHODIMP
RemoteBlob<Child>::GetInternalStream(nsIInputStream** aStream)
{
if (!mActor) {
return NS_ERROR_UNEXPECTED;
}
nsRefPtr<StreamHelper> helper = new StreamHelper(mActor, this);
return helper->GetStream(aStream);
return GetInternalStreamViaHelper(aStream);
}
template <ActorFlavorEnum ActorFlavor>
@ -1226,6 +1332,7 @@ Blob<ActorFlavor>::NoteDyingRemoteBlob()
// Must do this before calling Send__delete__ or we'll crash there trying to
// access a dangling pointer.
mBlob = nullptr;
mRemoteBlob = nullptr;
mozilla::unused << ProtocolType::Send__delete__(this);
@ -1236,13 +1343,12 @@ void
Blob<ActorFlavor>::ActorDestroy(ActorDestroyReason aWhy)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(mBlob);
if (mRemoteBlob) {
mRemoteBlob->SetActor(nullptr);
}
if (mOwnsBlob) {
if (mBlob && mOwnsBlob) {
mBlob->Release();
}
}

Просмотреть файл

@ -2536,7 +2536,7 @@ bool
ContentParent::RecvAddGeolocationListener(const IPC::Principal& aPrincipal,
const bool& aHighAccuracy)
{
#ifdef MOZ_PERMISSIONS
#ifdef MOZ_CHILD_PERMISSIONS
if (Preferences::GetBool("geo.testing.ignore_ipc_principal", false) == false) {
nsIPrincipal* principal = aPrincipal;
if (principal == nullptr) {

Просмотреть файл

@ -50,4 +50,8 @@ ifdef MOZ_PERMISSIONS
DEFINES += -DMOZ_PERMISSIONS
endif
ifdef MOZ_CHILD_PERMISSIONS
DEFINES += -DMOZ_CHILD_PERMISSIONS
endif
CXXFLAGS += $(TK_CFLAGS)

Просмотреть файл

@ -299,7 +299,6 @@ TabChild::TabChild(ContentChild* aManager, const TabContext& aContext, uint32_t
, mOrientation(eScreenOrientation_PortraitPrimary)
, mUpdateHitRegion(false)
{
printf("creating %d!\n", NS_IsMainThread());
}
// Get the DOMWindowUtils for the window corresponding to the given document.
@ -1283,7 +1282,6 @@ TabChild::IsRootContentDocument()
bool
TabChild::RecvLoadURL(const nsCString& uri)
{
printf("loading %s, %d\n", uri.get(), NS_IsMainThread());
SetProcessNameToAppName();
nsresult rv = mWebNav->LoadURI(NS_ConvertUTF8toUTF16(uri).get(),
@ -1460,8 +1458,6 @@ TabChild::RecvShow(const nsIntSize& size)
return true;
}
printf("[TabChild] SHOW (w,h)= (%d, %d)\n", size.width, size.height);
nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(mWebNav);
if (!baseWindow) {
NS_ERROR("mWebNav doesn't QI to nsIBaseWindow");

Просмотреть файл

@ -1346,6 +1346,17 @@ Geolocation::ClearWatch(int32_t aWatchId)
}
}
// make sure we also search through the pending requests lists for
// watches to clear...
for (uint32_t i = 0, length = mPendingRequests.Length(); i < length; ++i) {
if ((mPendingRequests[i].type == PendingRequest::WatchPosition) &&
(mPendingRequests[i].request->WatchId() == aWatchId)) {
mPendingRequests[i].request->Shutdown();
mPendingRequests.RemoveElementAt(i);
break;
}
}
return NS_OK;
}

Просмотреть файл

@ -65,6 +65,7 @@
#include "nsEditor.h"
#include "mozilla/Services.h"
#include "nsIObserverService.h"
#include "nsITextControlElement.h"
using namespace mozilla::dom;
@ -1268,6 +1269,21 @@ mozInlineSpellChecker::SkipSpellCheckForNode(nsIEditor* aEditor,
return NS_OK;
}
// Make sure that we can always turn on spell checking for inputs/textareas.
// Note that because of the previous check, at this point we know that the
// node is editable.
if (content->IsInAnonymousSubtree()) {
nsCOMPtr<nsIContent> node = content->GetParent();
while (node && node->IsInNativeAnonymousSubtree()) {
node = node->GetParent();
}
nsCOMPtr<nsITextControlElement> textControl = do_QueryInterface(node);
if (textControl) {
*checkSpelling = true;
return NS_OK;
}
}
// Get HTML element ancestor (might be aNode itself, although probably that
// has to be a text node in real life here)
nsCOMPtr<nsIDOMHTMLElement> htmlElement = do_QueryInterface(content);

Просмотреть файл

@ -36,7 +36,7 @@ namespace gfx {
* Do not use this class directly. Subclass it, pass that subclass as the
* Sub parameter, and only use that subclass.
*/
template <class T, class Sub, class Point, class SizeT, class Margin>
template <class T, class Sub, class Point, class SizeT, class MarginT>
struct BaseRect {
T x, y, width, height;
@ -189,7 +189,7 @@ struct BaseRect {
width += 2 * aDx;
height += 2 * aDy;
}
void Inflate(const Margin& aMargin)
void Inflate(const MarginT& aMargin)
{
x -= aMargin.left;
y -= aMargin.top;
@ -206,7 +206,7 @@ struct BaseRect {
width = std::max(T(0), width - 2 * aDx);
height = std::max(T(0), height - 2 * aDy);
}
void Deflate(const Margin& aMargin)
void Deflate(const MarginT& aMargin)
{
x += aMargin.left;
y += aMargin.top;
@ -251,12 +251,12 @@ struct BaseRect {
}
// Find difference as a Margin
Margin operator-(const Sub& aRect) const
MarginT operator-(const Sub& aRect) const
{
return Margin(aRect.y - y,
XMost() - aRect.XMost(),
YMost() - aRect.YMost(),
aRect.x - x);
return MarginT(aRect.y - y,
XMost() - aRect.XMost(),
YMost() - aRect.YMost(),
aRect.x - x);
}
// Helpers for accessing the vertices

Просмотреть файл

@ -16,26 +16,38 @@
namespace mozilla {
namespace gfx {
template<class units>
struct IntMarginTyped:
public BaseMargin<int32_t, IntMarginTyped<units> >,
public units {
typedef BaseMargin<int32_t, IntMarginTyped<units> > Super;
IntMarginTyped() : Super() {}
IntMarginTyped(int32_t aTop, int32_t aRight, int32_t aBottom, int32_t aLeft) :
Super(aTop, aRight, aBottom, aLeft) {}
};
typedef IntMarginTyped<UnknownUnits> IntMargin;
template<class units>
struct MarginTyped:
public BaseMargin<Float, MarginTyped<units> >,
public units {
typedef BaseMargin<Float, MarginTyped<units> > Super;
MarginTyped() : Super(0, 0, 0, 0) {}
MarginTyped(const MarginTyped<units>& aMargin) :
Super(float(aMargin.top), float(aMargin.right),
float(aMargin.bottom), float(aMargin.left)) {}
MarginTyped() : Super() {}
MarginTyped(Float aTop, Float aRight, Float aBottom, Float aLeft) :
Super(aTop, aRight, aBottom, aLeft) {}
explicit MarginTyped(const IntMarginTyped<units>& aMargin) :
Super(float(aMargin.top), float(aMargin.right),
float(aMargin.bottom), float(aMargin.left)) {}
};
typedef MarginTyped<UnknownUnits> Margin;
template<class units>
struct IntRectTyped :
public BaseRect<int32_t, IntRectTyped<units>, IntPointTyped<units>, IntSizeTyped<units>, Margin>,
public BaseRect<int32_t, IntRectTyped<units>, IntPointTyped<units>, IntSizeTyped<units>, IntMarginTyped<units> >,
public units {
typedef BaseRect<int32_t, IntRectTyped<units>, IntPointTyped<units>, IntSizeTyped<units>, Margin> Super;
typedef BaseRect<int32_t, IntRectTyped<units>, IntPointTyped<units>, IntSizeTyped<units>, IntMarginTyped<units> > Super;
IntRectTyped() : Super() {}
IntRectTyped(IntPointTyped<units> aPos, IntSizeTyped<units> aSize) :
@ -63,9 +75,9 @@ typedef IntRectTyped<UnknownUnits> IntRect;
template<class units>
struct RectTyped :
public BaseRect<Float, RectTyped<units>, PointTyped<units>, SizeTyped<units>, Margin>,
public BaseRect<Float, RectTyped<units>, PointTyped<units>, SizeTyped<units>, MarginTyped<units> >,
public units {
typedef BaseRect<Float, RectTyped<units>, PointTyped<units>, SizeTyped<units>, Margin> Super;
typedef BaseRect<Float, RectTyped<units>, PointTyped<units>, SizeTyped<units>, MarginTyped<units> > Super;
RectTyped() : Super() {}
RectTyped(PointTyped<units> aPos, SizeTyped<units> aSize) :

Просмотреть файл

@ -471,7 +471,7 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
}
// Check for aux symbols based on extensions
if (IsExtensionSupported(XXX_framebuffer_blit))
if (IsSupported(GLFeature::framebuffer_blit))
{
SymLoadStruct auxSymbols[] = {
{
@ -488,12 +488,12 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
if (!LoadSymbols(&auxSymbols[0], trygl, prefix)) {
NS_ERROR("GL supports framebuffer_blit without supplying glBlitFramebuffer");
MarkExtensionGroupUnsupported(XXX_framebuffer_blit);
MarkUnsupported(GLFeature::framebuffer_blit);
mSymbols.fBlitFramebuffer = nullptr;
}
}
if (IsExtensionSupported(XXX_framebuffer_multisample))
if (IsSupported(GLFeature::framebuffer_multisample))
{
SymLoadStruct auxSymbols[] = {
{
@ -510,7 +510,7 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
if (!LoadSymbols(&auxSymbols[0], trygl, prefix)) {
NS_ERROR("GL supports framebuffer_multisample without supplying glRenderbufferStorageMultisample");
MarkExtensionGroupUnsupported(XXX_framebuffer_multisample);
MarkUnsupported(GLFeature::framebuffer_multisample);
mSymbols.fRenderbufferStorageMultisample = nullptr;
}
}
@ -570,7 +570,7 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
if (!LoadSymbols(&vaoSymbols[0], trygl, prefix)) {
NS_ERROR("GL supports Vertex Array Object without supplying its functions.");
MarkExtensionGroupUnsupported(XXX_vertex_array_object);
MarkUnsupported(GLFeature::vertex_array_object);
mSymbols.fIsVertexArray = nullptr;
mSymbols.fGenVertexArrays = nullptr;
mSymbols.fBindVertexArray = nullptr;
@ -593,7 +593,7 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
if (!LoadSymbols(&vaoSymbols[0], trygl, prefix)) {
NS_ERROR("GL supports Vertex Array Object without supplying its functions.");
MarkExtensionGroupUnsupported(XXX_vertex_array_object);
MarkUnsupported(GLFeature::vertex_array_object);
mSymbols.fIsVertexArray = nullptr;
mSymbols.fGenVertexArrays = nullptr;
mSymbols.fBindVertexArray = nullptr;
@ -601,7 +601,7 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
}
}
if (IsExtensionSupported(XXX_draw_instanced)) {
if (IsSupported(GLFeature::draw_instanced)) {
SymLoadStruct drawInstancedSymbols[] = {
{ (PRFuncPtr*) &mSymbols.fDrawArraysInstanced,
{ "DrawArraysInstanced",
@ -627,13 +627,13 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
if (!LoadSymbols(drawInstancedSymbols, trygl, prefix)) {
NS_ERROR("GL supports instanced draws without supplying its functions.");
MarkExtensionGroupUnsupported(XXX_draw_instanced);
MarkUnsupported(GLFeature::draw_instanced);
mSymbols.fDrawArraysInstanced = nullptr;
mSymbols.fDrawElementsInstanced = nullptr;
}
}
if (IsExtensionSupported(XXX_instanced_arrays)) {
if (IsSupported(GLFeature::instanced_arrays)) {
SymLoadStruct instancedArraySymbols[] = {
{ (PRFuncPtr*) &mSymbols.fVertexAttribDivisor,
{ "VertexAttribDivisor",
@ -649,12 +649,12 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
if (!LoadSymbols(instancedArraySymbols, trygl, prefix)) {
NS_ERROR("GL supports array instanced without supplying it function.");
mInitialized &= MarkExtensionGroupUnsupported(XXX_instanced_arrays);
mInitialized &= MarkUnsupported(GLFeature::instanced_arrays);
mSymbols.fVertexAttribDivisor = nullptr;
}
}
if (IsExtensionSupported(XXX_transform_feedback)) {
if (IsSupported(GLFeature::transform_feedback)) {
SymLoadStruct transformFeedbackSymbols[] = {
{ (PRFuncPtr*) &mSymbols.fBindBufferBase,
{ "BindBufferBase",
@ -711,8 +711,8 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
if (!LoadSymbols(transformFeedbackSymbols, trygl, prefix)) {
NS_ERROR("GL supports transform feedback without supplying its functions.");
MarkExtensionGroupUnsupported(XXX_transform_feedback);
MarkExtensionGroupUnsupported(XXX_bind_buffer_offset);
MarkUnsupported(GLFeature::transform_feedback);
MarkUnsupported(GLFeature::bind_buffer_offset);
mSymbols.fBindBufferBase = nullptr;
mSymbols.fBindBufferRange = nullptr;
mSymbols.fBeginTransformFeedback = nullptr;
@ -723,7 +723,7 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
}
}
if (IsExtensionSupported(XXX_bind_buffer_offset)) {
if (IsSupported(GLFeature::bind_buffer_offset)) {
SymLoadStruct bindBufferOffsetSymbols[] = {
{ (PRFuncPtr*) &mSymbols.fBindBufferOffset,
{ "BindBufferOffset",
@ -738,12 +738,12 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
if (!LoadSymbols(bindBufferOffsetSymbols, trygl, prefix)) {
NS_ERROR("GL supports BindBufferOffset without supplying its function.");
MarkExtensionGroupUnsupported(XXX_bind_buffer_offset);
MarkUnsupported(GLFeature::bind_buffer_offset);
mSymbols.fBindBufferOffset = nullptr;
}
}
if (IsExtensionSupported(XXX_query_objects)) {
if (IsSupported(GLFeature::query_objects)) {
SymLoadStruct queryObjectsSymbols[] = {
{ (PRFuncPtr*) &mSymbols.fBeginQuery, { "BeginQuery", "BeginQueryEXT", nullptr } },
{ (PRFuncPtr*) &mSymbols.fGenQueries, { "GenQueries", "GenQueriesEXT", nullptr } },
@ -758,11 +758,11 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
if (!LoadSymbols(queryObjectsSymbols, trygl, prefix)) {
NS_ERROR("GL supports query objects without supplying its functions.");
mInitialized &= MarkExtensionGroupUnsupported(XXX_query_objects);
mInitialized &= MarkExtensionGroupUnsupported(XXX_get_query_object_iv);
mInitialized &= MarkExtensionGroupUnsupported(XXX_occlusion_query);
MarkExtensionGroupUnsupported(XXX_occlusion_query_boolean);
MarkExtensionGroupUnsupported(XXX_occlusion_query2);
mInitialized &= MarkUnsupported(GLFeature::query_objects);
mInitialized &= MarkUnsupported(GLFeature::get_query_object_iv);
mInitialized &= MarkUnsupported(GLFeature::occlusion_query);
MarkUnsupported(GLFeature::occlusion_query_boolean);
MarkUnsupported(GLFeature::occlusion_query2);
mSymbols.fBeginQuery = nullptr;
mSymbols.fGenQueries = nullptr;
mSymbols.fDeleteQueries = nullptr;
@ -773,7 +773,7 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
}
}
if (IsExtensionSupported(XXX_get_query_object_iv)) {
if (IsSupported(GLFeature::get_query_object_iv)) {
SymLoadStruct queryObjectsSymbols[] = {
{ (PRFuncPtr*) &mSymbols.fGetQueryObjectiv, { "GetQueryObjectiv", "GetQueryObjectivEXT", nullptr } },
{ nullptr, { nullptr } },
@ -782,7 +782,7 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
if (!LoadSymbols(queryObjectsSymbols, trygl, prefix)) {
NS_ERROR("GL supports query objects iv getter without supplying its function.");
mInitialized &= MarkExtensionGroupUnsupported(XXX_get_query_object_iv);
mInitialized &= MarkUnsupported(GLFeature::get_query_object_iv);
mSymbols.fGetQueryObjectiv = nullptr;
}
}
@ -853,7 +853,7 @@ GLContext::InitWithPrefix(const char *prefix, bool trygl)
mMaxTextureImageSize = mMaxTextureSize;
mMaxSamples = 0;
if (IsExtensionSupported(XXX_framebuffer_multisample)) {
if (IsSupported(GLFeature::framebuffer_multisample)) {
fGetIntegerv(LOCAL_GL_MAX_SAMPLES, (GLint*)&mMaxSamples);
}

Просмотреть файл

@ -82,6 +82,41 @@ namespace mozilla {
namespace mozilla {
namespace gl {
/** GLFeature::Enum
* We don't use typed enum to keep the implicit integer conversion.
* This enum should be sorted by name.
*/
namespace GLFeature {
enum Enum {
bind_buffer_offset,
depth_texture,
draw_buffers,
draw_instanced,
element_index_uint,
ES2_compatibility,
ES3_compatibility,
framebuffer_blit,
framebuffer_multisample,
framebuffer_object,
get_query_object_iv,
instanced_arrays,
occlusion_query,
occlusion_query_boolean,
occlusion_query2,
packed_depth_stencil,
query_objects,
robustness,
standard_derivatives,
texture_float,
texture_float_linear,
texture_non_power_of_two,
transform_feedback,
vertex_array_object,
EnumMax
};
}
typedef uintptr_t SharedTextureHandle;
MOZ_BEGIN_ENUM_CLASS(ContextProfile, uint8_t)
@ -463,59 +498,27 @@ protected:
// -----------------------------------------------------------------------------
// XXX_* Extension group queries
// Feature queries
/*
* This mecahnism introduces a new way to check if an extension is supported,
* regardless if it is an ARB, EXT, OES, etc.
* This mecahnism introduces a new way to check if a OpenGL feature is
* supported, regardless of whether it is supported by an extension or natively
* by the context version/profile
*/
public:
bool IsSupported(GLFeature::Enum feature) const;
/**
* This enum should be sorted by name.
*/
enum GLExtensionGroup {
XXX_bind_buffer_offset,
XXX_depth_texture,
XXX_draw_buffers,
XXX_draw_instanced,
XXX_element_index_uint,
XXX_ES2_compatibility,
XXX_ES3_compatibility,
XXX_framebuffer_blit,
XXX_framebuffer_multisample,
XXX_framebuffer_object,
XXX_get_query_object_iv,
XXX_instanced_arrays,
XXX_occlusion_query,
XXX_occlusion_query_boolean,
XXX_occlusion_query2,
XXX_packed_depth_stencil,
XXX_query_objects,
XXX_robustness,
XXX_standard_derivatives,
XXX_texture_float,
XXX_texture_float_linear,
XXX_texture_non_power_of_two,
XXX_transform_feedback,
XXX_vertex_array_object,
ExtensionGroup_Max
};
bool IsExtensionSupported(GLExtensionGroup extensionGroup) const;
static const char* GetExtensionGroupName(GLExtensionGroup extensionGroup);
static const char* GetFeatureName(GLFeature::Enum feature);
private:
/**
* Mark all extensions of this group as unsupported.
* Mark all extensions of this feature as unsupported.
*
* Returns false if marking this extension group as unsupported contradicts
* the OpenGL version and profile. Returns true otherwise.
*/
bool MarkExtensionGroupUnsupported(GLExtensionGroup extensionGroup);
bool MarkUnsupported(GLFeature::Enum feature);
// -----------------------------------------------------------------------------
// Robustness handling
@ -2687,7 +2690,7 @@ public:
if (mScreen)
return mScreen->GetReadFB();
GLenum bindEnum = IsExtensionSupported(XXX_framebuffer_blit)
GLenum bindEnum = IsSupported(GLFeature::framebuffer_blit)
? LOCAL_GL_READ_FRAMEBUFFER_BINDING_EXT
: LOCAL_GL_FRAMEBUFFER_BINDING;

Просмотреть файл

@ -18,7 +18,7 @@ static const unsigned int kGLCoreVersionForES2Compat = 410;
// ARB_ES3_compatibility is natively supported in OpenGL 4.3.
static const unsigned int kGLCoreVersionForES3Compat = 430;
struct ExtensionGroupInfo
struct FeatureInfo
{
const char* mName;
unsigned int mOpenGLVersion;
@ -26,9 +26,9 @@ struct ExtensionGroupInfo
GLContext::GLExtensions mExtensions[kMAX_EXTENSION_GROUP_SIZE];
};
static const ExtensionGroupInfo sExtensionGroupInfoArr[] = {
static const FeatureInfo sFeatureInfoArr[] = {
{
"XXX_bind_buffer_offset",
"bind_buffer_offset",
0, // OpenGL version
0, // OpenGL ES version
{
@ -38,7 +38,7 @@ static const ExtensionGroupInfo sExtensionGroupInfoArr[] = {
}
},
{
"XXX_depth_texture",
"depth_texture",
200, // OpenGL version
300, // OpenGL ES version
{
@ -48,7 +48,7 @@ static const ExtensionGroupInfo sExtensionGroupInfoArr[] = {
}
},
{
"XXX_draw_buffers",
"draw_buffers",
200, // OpenGL version
300, // OpenGL ES version
{
@ -58,7 +58,7 @@ static const ExtensionGroupInfo sExtensionGroupInfoArr[] = {
}
},
{
"XXX_draw_instanced",
"draw_instanced",
310, // OpenGL version
300, // OpenGL ES version
{
@ -70,7 +70,7 @@ static const ExtensionGroupInfo sExtensionGroupInfoArr[] = {
}
},
{
"XXX_element_index_uint",
"element_index_uint",
200, // OpenGL version
300, // OpenGL ES version
{
@ -79,7 +79,7 @@ static const ExtensionGroupInfo sExtensionGroupInfoArr[] = {
}
},
{
"XXX_ES2_compatibility",
"ES2_compatibility",
kGLCoreVersionForES2Compat,
200, // OpenGL ES version
{
@ -88,7 +88,7 @@ static const ExtensionGroupInfo sExtensionGroupInfoArr[] = {
}
},
{
"XXX_ES3_compatibility",
"ES3_compatibility",
kGLCoreVersionForES3Compat,
300, // OpenGL ES version
{
@ -97,7 +97,7 @@ static const ExtensionGroupInfo sExtensionGroupInfoArr[] = {
}
},
{
"XXX_framebuffer_blit",
"framebuffer_blit",
300, // OpenGL version
300, // OpenGL ES version
{
@ -107,7 +107,7 @@ static const ExtensionGroupInfo sExtensionGroupInfoArr[] = {
}
},
{
"XXX_framebuffer_multisample",
"framebuffer_multisample",
300, // OpenGL version
300, // OpenGL ES version
{
@ -117,7 +117,7 @@ static const ExtensionGroupInfo sExtensionGroupInfoArr[] = {
}
},
{
"XXX_framebuffer_object",
"framebuffer_object",
300, // OpenGL version
200, // OpenGL ES version
{
@ -127,7 +127,7 @@ static const ExtensionGroupInfo sExtensionGroupInfoArr[] = {
}
},
{
"XXX_get_query_object_iv",
"get_query_object_iv",
200, // OpenGL version
0, // OpenGL ES version
{
@ -139,7 +139,7 @@ static const ExtensionGroupInfo sExtensionGroupInfoArr[] = {
*/
},
{
"XXX_instanced_arrays",
"instanced_arrays",
330, // OpenGL version
300, // OpenGL ES version
{
@ -150,7 +150,7 @@ static const ExtensionGroupInfo sExtensionGroupInfoArr[] = {
}
},
{
"XXX_occlusion_query",
"occlusion_query",
200, // OpenGL version
0, // OpenGL ES version
{
@ -159,7 +159,7 @@ static const ExtensionGroupInfo sExtensionGroupInfoArr[] = {
// XXX_occlusion_query depend on ARB_occlusion_query (added in OpenGL 2.0)
},
{
"XXX_occlusion_query_boolean",
"occlusion_query_boolean",
kGLCoreVersionForES3Compat,
300, // OpenGL ES version
{
@ -175,7 +175,7 @@ static const ExtensionGroupInfo sExtensionGroupInfoArr[] = {
*/
},
{
"XXX_occlusion_query2",
"occlusion_query2",
330, // = min(330, kGLCoreVersionForES3Compat),
300, // OpenGL ES version
{
@ -191,7 +191,7 @@ static const ExtensionGroupInfo sExtensionGroupInfoArr[] = {
*/
},
{
"XXX_packed_depth_stencil",
"packed_depth_stencil",
300, // OpenGL version
300, // OpenGL ES version
{
@ -201,7 +201,7 @@ static const ExtensionGroupInfo sExtensionGroupInfoArr[] = {
}
},
{
"XXX_query_objects",
"query_objects",
200, // OpenGL version
300, // OpenGL ES version
{
@ -215,7 +215,7 @@ static const ExtensionGroupInfo sExtensionGroupInfoArr[] = {
*/
},
{
"XXX_robustness",
"robustness",
0, // OpenGL version
0, // OpenGL ES version
{
@ -225,7 +225,7 @@ static const ExtensionGroupInfo sExtensionGroupInfoArr[] = {
}
},
{
"XXX_standard_derivatives",
"standard_derivatives",
200, // OpenGL version
300, // OpenGL ES version
{
@ -234,7 +234,7 @@ static const ExtensionGroupInfo sExtensionGroupInfoArr[] = {
}
},
{
"XXX_texture_float",
"texture_float",
310, // OpenGL version
300, // OpenGL ES version
{
@ -244,7 +244,7 @@ static const ExtensionGroupInfo sExtensionGroupInfoArr[] = {
}
},
{
"XXX_texture_float_linear",
"texture_float_linear",
310, // OpenGL version
300, // OpenGL ES version
{
@ -254,7 +254,7 @@ static const ExtensionGroupInfo sExtensionGroupInfoArr[] = {
}
},
{
"XXX_texture_non_power_of_two",
"texture_non_power_of_two",
200, // OpenGL version
300, // OpenGL ES version
{
@ -264,7 +264,7 @@ static const ExtensionGroupInfo sExtensionGroupInfoArr[] = {
}
},
{
"XXX_transform_feedback",
"transform_feedback",
300, // OpenGL version
300, // OpenGL ES version
{
@ -274,7 +274,7 @@ static const ExtensionGroupInfo sExtensionGroupInfoArr[] = {
}
},
{
"XXX_vertex_array_object",
"vertex_array_object",
300, // OpenGL version
300, // OpenGL ES version
{
@ -286,66 +286,70 @@ static const ExtensionGroupInfo sExtensionGroupInfoArr[] = {
}
};
static inline const ExtensionGroupInfo&
GetExtensionGroupInfo(GLContext::GLExtensionGroup extensionGroup)
static inline const FeatureInfo&
GetFeatureInfo(GLFeature::Enum feature)
{
static_assert(MOZ_ARRAY_LENGTH(sExtensionGroupInfoArr) == size_t(GLContext::ExtensionGroup_Max),
"Mismatched lengths for sExtensionGroupInfos and ExtensionGroup enums");
static_assert(MOZ_ARRAY_LENGTH(sFeatureInfoArr) == size_t(GLFeature::EnumMax),
"Mismatched lengths for sFeatureInfoInfos and GLFeature enums");
MOZ_ASSERT(extensionGroup < GLContext::ExtensionGroup_Max,
"GLContext::GetExtensionGroupInfo : unknown <extensionGroup>");
MOZ_ASSERT(feature < GLFeature::EnumMax,
"GLContext::GetFeatureInfoInfo : unknown <feature>");
return sExtensionGroupInfoArr[extensionGroup];
return sFeatureInfoArr[feature];
}
static inline uint32_t
ProfileVersionForExtensionGroup(GLContext::GLExtensionGroup extensionGroup, ContextProfile profile)
ProfileVersionForFeature(GLFeature::Enum feature, ContextProfile profile)
{
MOZ_ASSERT(profile != ContextProfile::Unknown,
"GLContext::ProfileVersionForExtensionGroup : unknown <profile>");
"GLContext::ProfileVersionForFeature : unknown <profile>");
const ExtensionGroupInfo& groupInfo = GetExtensionGroupInfo(extensionGroup);
const FeatureInfo& featureInfo = GetFeatureInfo(feature);
if (profile == ContextProfile::OpenGLES) {
return groupInfo.mOpenGLESVersion;
return featureInfo.mOpenGLESVersion;
}
return groupInfo.mOpenGLVersion;
return featureInfo.mOpenGLVersion;
}
static inline bool
IsExtensionGroupIsPartOfProfileVersion(GLContext::GLExtensionGroup extensionGroup,
ContextProfile profile, unsigned int version)
IsFeatureIsPartOfProfileVersion(GLFeature::Enum feature,
ContextProfile profile, unsigned int version)
{
unsigned int profileVersion = ProfileVersionForExtensionGroup(extensionGroup, profile);
unsigned int profileVersion = ProfileVersionForFeature(feature, profile);
/**
* if `profileVersion` is zero, it means that no version of the profile
* added support for the feature.
*/
return profileVersion && version >= profileVersion;
}
const char*
GLContext::GetExtensionGroupName(GLExtensionGroup extensionGroup)
GLContext::GetFeatureName(GLFeature::Enum feature)
{
return GetExtensionGroupInfo(extensionGroup).mName;
return GetFeatureInfo(feature).mName;
}
bool
GLContext::IsExtensionSupported(GLExtensionGroup extensionGroup) const
GLContext::IsSupported(GLFeature::Enum feature) const
{
if (IsExtensionGroupIsPartOfProfileVersion(extensionGroup, mProfile, mVersion)) {
if (IsFeatureIsPartOfProfileVersion(feature, mProfile, mVersion)) {
return true;
}
const ExtensionGroupInfo& groupInfo = GetExtensionGroupInfo(extensionGroup);
const FeatureInfo& featureInfo = GetFeatureInfo(feature);
for (size_t i = 0; true; i++)
{
MOZ_ASSERT(i < kMAX_EXTENSION_GROUP_SIZE, "kMAX_EXTENSION_GROUP_SIZE too small");
if (groupInfo.mExtensions[i] == GLContext::Extensions_End) {
if (featureInfo.mExtensions[i] == GLContext::Extensions_End) {
break;
}
if (IsExtensionSupported(groupInfo.mExtensions[i])) {
if (IsExtensionSupported(featureInfo.mExtensions[i])) {
return true;
}
}
@ -354,34 +358,34 @@ GLContext::IsExtensionSupported(GLExtensionGroup extensionGroup) const
}
bool
GLContext::MarkExtensionGroupUnsupported(GLExtensionGroup extensionGroup)
GLContext::MarkUnsupported(GLFeature::Enum feature)
{
MOZ_ASSERT(IsExtensionSupported(extensionGroup), "extension group is already unsupported!");
MOZ_ASSERT(IsSupported(feature), "extension group is already unsupported!");
if (IsExtensionGroupIsPartOfProfileVersion(extensionGroup, mProfile, mVersion)) {
if (IsFeatureIsPartOfProfileVersion(feature, mProfile, mVersion)) {
NS_WARNING(nsPrintfCString("%s marked as unsupported, but it's supposed to be supported by %s %s",
GetExtensionGroupName(extensionGroup),
GetFeatureName(feature),
ProfileString(),
VersionString()).get());
return false;
}
const ExtensionGroupInfo& groupInfo = GetExtensionGroupInfo(extensionGroup);
const FeatureInfo& featureInfo = GetFeatureInfo(feature);
for (size_t i = 0; true; i++)
{
MOZ_ASSERT(i < kMAX_EXTENSION_GROUP_SIZE, "kMAX_EXTENSION_GROUP_SIZE too small");
if (groupInfo.mExtensions[i] == GLContext::Extensions_End) {
if (featureInfo.mExtensions[i] == GLContext::Extensions_End) {
break;
}
MarkExtensionUnsupported(groupInfo.mExtensions[i]);
MarkExtensionUnsupported(featureInfo.mExtensions[i]);
}
MOZ_ASSERT(!IsExtensionSupported(extensionGroup), "GLContext::MarkExtensionGroupUnsupported has failed!");
MOZ_ASSERT(!IsSupported(feature), "GLContext::MarkExtensionGroupUnsupported has failed!");
NS_WARNING(nsPrintfCString("%s marked as unsupported", GetExtensionGroupName(extensionGroup)).get());
NS_WARNING(nsPrintfCString("%s marked as unsupported", GetFeatureName(feature)).get());
return true;
}

Просмотреть файл

@ -29,7 +29,7 @@ GLScreenBuffer::Create(GLContext* gl,
const SurfaceCaps& caps)
{
if (caps.antialias &&
!gl->IsExtensionSupported(GLContext::XXX_framebuffer_multisample))
!gl->IsSupported(GLFeature::framebuffer_multisample))
{
return nullptr;
}
@ -79,7 +79,7 @@ GLScreenBuffer::BindAsFramebuffer(GLContext* const gl, GLenum target) const
GLuint drawFB = DrawFB();
GLuint readFB = ReadFB();
if (!gl->IsExtensionSupported(GLContext::XXX_framebuffer_blit)) {
if (!gl->IsSupported(GLFeature::framebuffer_blit)) {
MOZ_ASSERT(drawFB == readFB);
gl->raw_fBindFramebuffer(target, readFB);
return;
@ -92,14 +92,14 @@ GLScreenBuffer::BindAsFramebuffer(GLContext* const gl, GLenum target) const
break;
case LOCAL_GL_DRAW_FRAMEBUFFER_EXT:
if (!gl->IsExtensionSupported(GLContext::XXX_framebuffer_blit))
if (!gl->IsSupported(GLFeature::framebuffer_blit))
NS_WARNING("DRAW_FRAMEBUFFER requested but unavailable.");
gl->raw_fBindFramebuffer(LOCAL_GL_DRAW_FRAMEBUFFER_EXT, drawFB);
break;
case LOCAL_GL_READ_FRAMEBUFFER_EXT:
if (!gl->IsExtensionSupported(GLContext::XXX_framebuffer_blit))
if (!gl->IsSupported(GLFeature::framebuffer_blit))
NS_WARNING("READ_FRAMEBUFFER requested but unavailable.");
gl->raw_fBindFramebuffer(LOCAL_GL_READ_FRAMEBUFFER_EXT, readFB);
@ -124,7 +124,7 @@ GLScreenBuffer::BindFB(GLuint fb)
if (mInternalDrawFB == mInternalReadFB) {
mGL->raw_fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, mInternalDrawFB);
} else {
MOZ_ASSERT(mGL->IsExtensionSupported(GLContext::XXX_framebuffer_blit));
MOZ_ASSERT(mGL->IsSupported(GLFeature::framebuffer_blit));
mGL->raw_fBindFramebuffer(LOCAL_GL_DRAW_FRAMEBUFFER_EXT, mInternalDrawFB);
mGL->raw_fBindFramebuffer(LOCAL_GL_READ_FRAMEBUFFER_EXT, mInternalReadFB);
}
@ -138,7 +138,7 @@ GLScreenBuffer::BindFB(GLuint fb)
void
GLScreenBuffer::BindDrawFB(GLuint fb)
{
if (!mGL->IsExtensionSupported(GLContext::XXX_framebuffer_blit)) {
if (!mGL->IsSupported(GLFeature::framebuffer_blit)) {
NS_WARNING("DRAW_FRAMEBUFFER requested, but unsupported.");
mGL->raw_fBindFramebuffer(LOCAL_GL_DRAW_FRAMEBUFFER_EXT, fb);
@ -158,7 +158,7 @@ GLScreenBuffer::BindDrawFB(GLuint fb)
void
GLScreenBuffer::BindReadFB(GLuint fb)
{
if (!mGL->IsExtensionSupported(GLContext::XXX_framebuffer_blit)) {
if (!mGL->IsSupported(GLFeature::framebuffer_blit)) {
NS_WARNING("READ_FRAMEBUFFER requested, but unsupported.");
mGL->raw_fBindFramebuffer(LOCAL_GL_READ_FRAMEBUFFER_EXT, fb);
@ -233,7 +233,7 @@ GLScreenBuffer::GetReadFB() const
// We use raw_ here because this is debug code and we need to see what
// the driver thinks.
GLuint actual = 0;
if (mGL->IsExtensionSupported(GLContext::XXX_framebuffer_blit))
if (mGL->IsSupported(GLFeature::framebuffer_blit))
mGL->raw_fGetIntegerv(LOCAL_GL_READ_FRAMEBUFFER_BINDING_EXT, (GLint*)&actual);
else
mGL->raw_fGetIntegerv(LOCAL_GL_FRAMEBUFFER_BINDING, (GLint*)&actual);

Просмотреть файл

@ -101,7 +101,7 @@ if gl_provider == 'EGL':
CPP_SOURCES += [
'GLContext.cpp',
'GLContextExtensionGroupQueries.cpp',
'GLContextFeatures.cpp',
'GLContextTypes.cpp',
'GLContextUtils.cpp',
'GLLibraryLoader.cpp',

Просмотреть файл

@ -5667,7 +5667,8 @@ frontend::EmitTree(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn)
}
}
}
if (fun->hasDefaults()) {
bool hasDefaults = bce->sc->asFunctionBox()->hasDefaults();
if (hasDefaults) {
ParseNode *rest = NULL;
bool restIsDefn = false;
if (fun->hasRest()) {
@ -5716,7 +5717,7 @@ frontend::EmitTree(ExclusiveContext *cx, BytecodeEmitter *bce, ParseNode *pn)
continue;
if (!BindNameToSlot(cx, bce, pn2))
return false;
if (pn2->pn_next == pnlast && fun->hasRest() && !fun->hasDefaults()) {
if (pn2->pn_next == pnlast && fun->hasRest() && !hasDefaults) {
// Fill rest parameter. We handled the case with defaults above.
JS_ASSERT(!bce->sc->asFunctionBox()->argumentsHasLocalBinding());
bce->switchToProlog();

Просмотреть файл

@ -471,7 +471,7 @@ FunctionBox::FunctionBox(ExclusiveContext *cx, ObjectBox* traceListHead, JSFunct
bindings(),
bufStart(0),
bufEnd(0),
ndefaults(0),
length(0),
generatorKindBits_(GeneratorKindAsBits(generatorKind)),
inWith(false), // initialized below
inGenexpLambda(false),
@ -883,6 +883,7 @@ Parser<FullParseHandler>::standaloneFunctionBody(HandleFunction fun, const AutoN
generatorKind);
if (!funbox)
return null();
funbox->length = fun->nargs - fun->hasRest();
handler.setFunctionBox(fn, funbox);
ParseContext<FullParseHandler> funpc(this, pc, fn, funbox, newDirectives,
@ -1540,10 +1541,12 @@ Parser<ParseHandler>::bindDestructuringArg(BindData<ParseHandler> *data,
template <typename ParseHandler>
bool
Parser<ParseHandler>::functionArguments(FunctionSyntaxKind kind, Node *listp, Node funcpn,
bool &hasRest)
bool *hasRest)
{
FunctionBox *funbox = pc->sc->asFunctionBox();
*hasRest = false;
bool parenFreeArrow = false;
if (kind == Arrow && tokenStream.peekToken() == TOK_NAME) {
parenFreeArrow = true;
@ -1559,8 +1562,6 @@ Parser<ParseHandler>::functionArguments(FunctionSyntaxKind kind, Node *listp, No
funbox->setStart(tokenStream);
}
hasRest = false;
Node argsbody = handler.newList(PNK_ARGSBODY);
if (!argsbody)
return false;
@ -1574,7 +1575,7 @@ Parser<ParseHandler>::functionArguments(FunctionSyntaxKind kind, Node *listp, No
#endif
do {
if (hasRest) {
if (*hasRest) {
report(ParseError, false, null(), JSMSG_PARAMETER_AFTER_REST);
return false;
}
@ -1648,7 +1649,7 @@ Parser<ParseHandler>::functionArguments(FunctionSyntaxKind kind, Node *listp, No
case TOK_TRIPLEDOT:
{
hasRest = true;
*hasRest = true;
tt = tokenStream.getToken();
if (tt != TOK_NAME) {
if (tt != TOK_ERROR)
@ -1676,7 +1677,7 @@ Parser<ParseHandler>::functionArguments(FunctionSyntaxKind kind, Node *listp, No
// Therefore it's impossible to get here with parenFreeArrow.
JS_ASSERT(!parenFreeArrow);
if (hasRest) {
if (*hasRest) {
report(ParseError, false, null(), JSMSG_REST_WITH_DEFAULT);
return false;
}
@ -1684,15 +1685,17 @@ Parser<ParseHandler>::functionArguments(FunctionSyntaxKind kind, Node *listp, No
report(ParseError, false, duplicatedArg, JSMSG_BAD_DUP_ARGS);
return false;
}
hasDefaults = true;
if (!hasDefaults) {
hasDefaults = true;
// The Function.length property is the number of formals
// before the first default argument.
funbox->length = pc->numArgs() - 1;
}
Node def_expr = assignExprWithoutYield(JSMSG_YIELD_IN_DEFAULT);
if (!def_expr)
return false;
handler.setLastFunctionArgumentDefault(funcpn, def_expr);
funbox->ndefaults++;
} else if (!hasRest && hasDefaults) {
report(ParseError, false, null(), JSMSG_NONDEFAULT_FORMAL_AFTER_DEFAULT);
return false;
}
break;
@ -1710,6 +1713,9 @@ Parser<ParseHandler>::functionArguments(FunctionSyntaxKind kind, Node *listp, No
report(ParseError, false, null(), JSMSG_PAREN_AFTER_FORMAL);
return false;
}
if (!hasDefaults)
funbox->length = pc->numArgs() - *hasRest;
}
return true;
@ -2249,6 +2255,7 @@ Parser<FullParseHandler>::standaloneLazyFunction(HandleFunction fun, unsigned st
generatorKind);
if (!funbox)
return null();
funbox->length = fun->nargs - fun->hasRest();
Directives newDirectives = directives;
ParseContext<FullParseHandler> funpc(this, /* parent = */ NULL, pn, funbox,
@ -2292,14 +2299,12 @@ Parser<ParseHandler>::functionArgsAndBodyGeneric(Node pn, HandleFunction fun, Fu
Node prelude = null();
bool hasRest;
if (!functionArguments(kind, &prelude, pn, hasRest))
if (!functionArguments(kind, &prelude, pn, &hasRest))
return false;
FunctionBox *funbox = pc->sc->asFunctionBox();
fun->setArgCount(pc->numArgs());
if (funbox->ndefaults)
fun->setHasDefaults();
if (hasRest)
fun->setHasRest();

Просмотреть файл

@ -519,7 +519,7 @@ class Parser : private AutoGCRooter, public StrictModeGetter
/*
* Additional JS parsers.
*/
bool functionArguments(FunctionSyntaxKind kind, Node *list, Node funcpn, bool &hasRest);
bool functionArguments(FunctionSyntaxKind kind, Node *list, Node funcpn, bool *hasRest);
Node functionDef(HandlePropertyName name, const TokenStream::Position &start,
FunctionType type, FunctionSyntaxKind kind, GeneratorKind generatorKind);

Просмотреть файл

@ -258,7 +258,7 @@ class FunctionBox : public ObjectBox, public SharedContext
uint32_t bufEnd;
uint32_t startLine;
uint32_t startColumn;
uint16_t ndefaults;
uint16_t length;
uint8_t generatorKindBits_; /* The GeneratorKind of this function. */
bool inWith:1; /* some enclosing scope is a with-statement */
@ -307,6 +307,10 @@ class FunctionBox : public ObjectBox, public SharedContext
void setDefinitelyNeedsArgsObj() { JS_ASSERT(funCxFlags.argumentsHasLocalBinding);
funCxFlags.definitelyNeedsArgsObj = true; }
bool hasDefaults() const {
return length != function()->nargs - function()->hasRest();
}
// Return whether this function has either specified "use asm" or is
// (transitively) nested inside a function that has.
bool useAsmOrInsideUseAsm() const {

Просмотреть файл

@ -201,7 +201,7 @@ def main(argv):
sys.exit(1)
tc = job_list[0]
cmd = ['gdb', '--args'] + tc.command(prefix)
cmd = ['gdb', '--args'] + tc.command(prefix, jittests.LIB_DIR)
subprocess.call(cmd)
sys.exit()

Просмотреть файл

@ -24,3 +24,12 @@ function f3(a, b, c=4) {
assertEq(c, 4);
}
f3(1);
function f4(a, bIs, cIs, b=3, c) {
assertEq(a, 1);
assertEq(b, bIs);
assertEq(c, cIs);
}
assertEq(f4.length, 3);
f4(1, 3, undefined);
f4(1, 4, undefined, 4);
f4(1, 4, 5, 4, 5);

Просмотреть файл

@ -3,9 +3,6 @@ load(libdir + "asserts.js");
assertThrowsInstanceOf(function () {
eval("function f(...rest=23) {}");
}, SyntaxError);
assertThrowsInstanceOf(function () {
eval("function f(a=16, b) {}");
}, SyntaxError);
assertThrowsInstanceOf(function () {
eval("function f([a]=4) {}");
}, SyntaxError);

Просмотреть файл

@ -0,0 +1,9 @@
// |jit-test| error: InternalError: too much recursion
for (let y in []);
(function f(x) {
Float64Array(ArrayBuffer());
{
f(x)
function t() {}
}
})();

Просмотреть файл

@ -2575,8 +2575,6 @@ CheckFunctionHead(ModuleCompiler &m, ParseNode *fn)
JSFunction *fun = FunctionObject(fn);
if (fun->hasRest())
return m.fail(fn, "rest args not allowed");
if (fun->hasDefaults())
return m.fail(fn, "default args not allowed");
if (fun->isExprClosure())
return m.fail(fn, "expression closures not allowed");
if (fn->pn_funbox->hasDestructuringArgs)
@ -2590,7 +2588,7 @@ CheckArgument(ModuleCompiler &m, ParseNode *arg, PropertyName **name)
if (!IsDefinition(arg))
return m.fail(arg, "duplicate argument name not allowed");
if (MaybeDefinitionInitializer(arg))
if (arg->pn_dflags & PND_DEFAULT)
return m.fail(arg, "default arguments not allowed");
if (!CheckIdentifier(m, arg, arg->name()))

Просмотреть файл

@ -458,7 +458,17 @@ JSObject *
NewCallObject(JSContext *cx, HandleScript script,
HandleShape shape, HandleTypeObject type, HeapSlot *slots)
{
return CallObject::create(cx, script, shape, type, slots);
JSObject *obj = CallObject::create(cx, script, shape, type, slots);
#ifdef JSGC_GENERATIONAL
// The JIT creates call objects in the nursery, so elides barriers for
// the initializing writes. The interpreter, however, may have allocated
// the call object tenured, so barrier as needed before re-entering.
if (!IsInsideNursery(cx->runtime(), obj))
cx->runtime()->gcStoreBuffer.putWholeCell(obj);
#endif
return obj;
}
JSObject *

Просмотреть файл

@ -1106,9 +1106,13 @@ JS_WrapObject(JSContext *cx, JSObject **objp)
{
AssertHeapIsIdle(cx);
CHECK_REQUEST(cx);
if (*objp)
JS::ExposeGCThingToActiveJS(*objp, JSTRACE_OBJECT);
return cx->compartment()->wrap(cx, objp);
RootedObject obj(cx, *objp);
if (obj)
JS::ExposeGCThingToActiveJS(obj, JSTRACE_OBJECT);
if (!cx->compartment()->wrap(cx, &obj))
return false;
*objp = obj;
return true;
}
JS_PUBLIC_API(bool)

Просмотреть файл

@ -932,13 +932,13 @@ array_join_sub(JSContext *cx, CallArgs &args, bool locale)
// Various optimized versions of steps 7-10
if (!locale && !seplen && obj->is<ArrayObject>() && !ObjectMayHaveExtraIndexedProperties(obj)) {
const Value *start = obj->getDenseElements();
const Value *end = start + obj->getDenseInitializedLength();
const Value *elem;
for (elem = start; elem < end; elem++) {
uint32_t i;
for (i = 0; i < obj->getDenseInitializedLength(); ++i) {
if (!JS_CHECK_OPERATION_LIMIT(cx))
return false;
const Value *elem = &obj->getDenseElement(i);
/*
* Object stringifying is slow; delegate it to a separate loop to
* keep this one tight.
@ -953,7 +953,7 @@ array_join_sub(JSContext *cx, CallArgs &args, bool locale)
}
RootedValue v(cx);
for (uint32_t i = uint32_t(PointerRangeSize(start, elem)); i < length; i++) {
for (; i < length; ++i) {
if (!JS_CHECK_OPERATION_LIMIT(cx))
return false;

Просмотреть файл

@ -175,18 +175,17 @@ JSCompartment::ensureIonCompartmentExists(JSContext *cx)
#endif
static bool
WrapForSameCompartment(JSContext *cx, HandleObject obj, MutableHandleValue vp)
WrapForSameCompartment(JSContext *cx, MutableHandleObject obj)
{
JS_ASSERT(cx->compartment() == obj->compartment());
if (!cx->runtime()->sameCompartmentWrapObjectCallback) {
vp.setObject(*obj);
if (!cx->runtime()->sameCompartmentWrapObjectCallback)
return true;
}
JSObject *wrapped = cx->runtime()->sameCompartmentWrapObjectCallback(cx, obj);
RootedObject wrapped(cx);
wrapped = cx->runtime()->sameCompartmentWrapObjectCallback(cx, obj);
if (!wrapped)
return false;
vp.setObject(*wrapped);
obj.set(wrapped);
return true;
}
@ -203,40 +202,78 @@ JSCompartment::putWrapper(const CrossCompartmentKey &wrapped, const js::Value &w
}
bool
JSCompartment::wrap(JSContext *cx, MutableHandleValue vp, HandleObject existingArg)
JSCompartment::wrap(JSContext *cx, JSString **strp)
{
JSRuntime *rt = runtimeFromMainThread();
JS_ASSERT(!cx->runtime()->isAtomsCompartment(this));
JS_ASSERT(cx->compartment() == this);
JS_ASSERT(!rt->isAtomsCompartment(this));
JS_ASSERT_IF(existingArg, existingArg->compartment() == cx->compartment());
JS_ASSERT_IF(existingArg, vp.isObject());
JS_ASSERT_IF(existingArg, IsDeadProxyObject(existingArg));
unsigned flags = 0;
JS_CHECK_CHROME_RECURSION(cx, return false);
AutoDisableProxyCheck adpc(rt);
/* Only GC things have to be wrapped or copied. */
if (!vp.isMarkable())
/* If the string is already in this compartment, we are done. */
JSString *str = *strp;
if (str->zone() == zone())
return true;
if (vp.isString()) {
JSString *str = vp.toString();
/* If the string is already in this compartment, we are done. */
if (str->zone() == zone())
return true;
/* If the string is an atom, we don't have to copy. */
if (str->isAtom()) {
JS_ASSERT(cx->runtime()->isAtomsZone(str->zone()));
return true;
}
/* If the string is an atom, we don't have to copy. */
if (str->isAtom()) {
JS_ASSERT(cx->runtime()->isAtomsZone(str->zone()));
return true;
}
/* Check the cache. */
RootedValue key(cx, StringValue(str));
if (WrapperMap::Ptr p = crossCompartmentWrappers.lookup(key)) {
*strp = p->value.get().toString();
return true;
}
/* No dice. Make a copy, and cache it. */
Rooted<JSLinearString *> linear(cx, str->ensureLinear(cx));
if (!linear)
return false;
JSString *copy = js_NewStringCopyN<CanGC>(cx, linear->chars(),
linear->length());
if (!copy)
return false;
if (!putWrapper(key, StringValue(copy)))
return false;
if (linear->zone()->isGCMarking()) {
/*
* All string wrappers are dropped when collection starts, but we
* just created a new one. Mark the wrapped string to stop it being
* finalized, because if it was then the pointer in this
* compartment's wrapper map would be left dangling.
*/
JSString *tmp = linear;
MarkStringUnbarriered(&cx->runtime()->gcMarker, &tmp, "wrapped string");
JS_ASSERT(tmp == linear);
}
*strp = copy;
return true;
}
bool
JSCompartment::wrap(JSContext *cx, HeapPtrString *strp)
{
RootedString str(cx, *strp);
if (!wrap(cx, str.address()))
return false;
*strp = str;
return true;
}
bool
JSCompartment::wrap(JSContext *cx, MutableHandleObject obj, HandleObject existingArg)
{
JS_ASSERT(!cx->runtime()->isAtomsCompartment(this));
JS_ASSERT(cx->compartment() == this);
JS_ASSERT_IF(existingArg, existingArg->compartment() == cx->compartment());
JS_ASSERT_IF(existingArg, IsDeadProxyObject(existingArg));
if (!obj)
return true;
AutoDisableProxyCheck adpc(cx->runtime());
/*
* Wrappers should really be parented to the wrapped parent of the wrapped
* object, but in that case a wrapped global object would have a NULL
@ -247,84 +284,54 @@ JSCompartment::wrap(JSContext *cx, MutableHandleValue vp, HandleObject existingA
HandleObject global = cx->global();
JS_ASSERT(global);
/* Unwrap incoming objects. */
if (vp.isObject()) {
RootedObject obj(cx, &vp.toObject());
if (obj->compartment() == this)
return WrapForSameCompartment(cx, obj);
if (obj->compartment() == this)
return WrapForSameCompartment(cx, obj, vp);
/* Translate StopIteration singleton. */
if (obj->is<StopIterationObject>())
return js_FindClassObject(cx, JSProto_StopIteration, vp);
/* Unwrap the object, but don't unwrap outer windows. */
obj = UncheckedUnwrap(obj, /* stopAtOuter = */ true, &flags);
if (obj->compartment() == this)
return WrapForSameCompartment(cx, obj, vp);
if (cx->runtime()->preWrapObjectCallback) {
obj = cx->runtime()->preWrapObjectCallback(cx, global, obj, flags);
if (!obj)
return false;
}
if (obj->compartment() == this)
return WrapForSameCompartment(cx, obj, vp);
vp.setObject(*obj);
#ifdef DEBUG
{
JSObject *outer = GetOuterObject(cx, obj);
JS_ASSERT(outer && outer == obj);
}
#endif
}
RootedValue key(cx, vp);
/* If we already have a wrapper for this value, use it. */
if (WrapperMap::Ptr p = crossCompartmentWrappers.lookup(key)) {
vp.set(p->value);
if (vp.isObject()) {
DebugOnly<JSObject *> obj = &vp.toObject();
JS_ASSERT(obj->is<CrossCompartmentWrapperObject>());
JS_ASSERT(obj->getParent() == global);
}
/* Translate StopIteration singleton. */
if (obj->is<StopIterationObject>()) {
RootedValue v(cx);
if (!js_FindClassObject(cx, JSProto_StopIteration, &v))
return false;
obj.set(&v.toObject());
return true;
}
if (vp.isString()) {
Rooted<JSLinearString *> str(cx, vp.toString()->ensureLinear(cx));
if (!str)
/* Unwrap the object, but don't unwrap outer windows. */
unsigned flags = 0;
obj.set(UncheckedUnwrap(obj, /* stopAtOuter = */ true, &flags));
if (obj->compartment() == this)
return WrapForSameCompartment(cx, obj);
/* Invoke the prewrap callback. We're a bit worried about infinite
* recursion here, so we do a check - see bug 809295. */
JS_CHECK_CHROME_RECURSION(cx, return false);
if (cx->runtime()->preWrapObjectCallback) {
obj.set(cx->runtime()->preWrapObjectCallback(cx, global, obj, flags));
if (!obj)
return false;
}
JSString *wrapped = js_NewStringCopyN<CanGC>(cx, str->chars(), str->length());
if (!wrapped)
return false;
if (obj->compartment() == this)
return WrapForSameCompartment(cx, obj);
vp.setString(wrapped);
if (!putWrapper(key, vp))
return false;
if (str->zone()->isGCMarking()) {
/*
* All string wrappers are dropped when collection starts, but we
* just created a new one. Mark the wrapped string to stop it being
* finalized, because if it was then the pointer in this
* compartment's wrapper map would be left dangling.
*/
JSString *tmp = str;
MarkStringUnbarriered(&rt->gcMarker, &tmp, "wrapped string");
JS_ASSERT(tmp == str);
}
#ifdef DEBUG
{
JSObject *outer = GetOuterObject(cx, obj);
JS_ASSERT(outer && outer == obj);
}
#endif
/* If we already have a wrapper for this value, use it. */
RootedValue key(cx, ObjectValue(*obj));
if (WrapperMap::Ptr p = crossCompartmentWrappers.lookup(key)) {
obj.set(&p->value.get().toObject());
JS_ASSERT(obj->is<CrossCompartmentWrapperObject>());
JS_ASSERT(obj->getParent() == global);
return true;
}
RootedObject proto(cx, Proxy::LazyProto);
RootedObject obj(cx, &vp.toObject());
RootedObject existing(cx, existingArg);
if (existing) {
/* Is it possible to reuse |existing|? */
@ -343,50 +350,17 @@ JSCompartment::wrap(JSContext *cx, MutableHandleValue vp, HandleObject existingA
* the wrap hook to reason over what wrappers are currently applied
* to the object.
*/
RootedObject wrapper(cx);
wrapper = cx->runtime()->wrapObjectCallback(cx, existing, obj, proto, global, flags);
if (!wrapper)
obj.set(cx->runtime()->wrapObjectCallback(cx, existing, obj, proto, global, flags));
if (!obj)
return false;
// We maintain the invariant that the key in the cross-compartment wrapper
// map is always directly wrapped by the value.
JS_ASSERT(Wrapper::wrappedObject(wrapper) == &key.get().toObject());
/*
* We maintain the invariant that the key in the cross-compartment wrapper
* map is always directly wrapped by the value.
*/
JS_ASSERT(Wrapper::wrappedObject(obj) == &key.get().toObject());
vp.setObject(*wrapper);
return putWrapper(key, vp);
}
bool
JSCompartment::wrap(JSContext *cx, JSString **strp)
{
RootedValue value(cx, StringValue(*strp));
if (!wrap(cx, &value))
return false;
*strp = value.get().toString();
return true;
}
bool
JSCompartment::wrap(JSContext *cx, HeapPtrString *strp)
{
RootedValue value(cx, StringValue(*strp));
if (!wrap(cx, &value))
return false;
*strp = value.get().toString();
return true;
}
bool
JSCompartment::wrap(JSContext *cx, JSObject **objp, JSObject *existingArg)
{
if (!*objp)
return true;
RootedValue value(cx, ObjectValue(**objp));
RootedObject existing(cx, existingArg);
if (!wrap(cx, &value, existing))
return false;
*objp = &value.get().toObject();
return true;
return putWrapper(key, ObjectValue(*obj));
}
bool
@ -429,7 +403,7 @@ JSCompartment::wrap(JSContext *cx, StrictPropertyOp *propp)
bool
JSCompartment::wrap(JSContext *cx, MutableHandle<PropertyDescriptor> desc)
{
if (!wrap(cx, desc.object().address()))
if (!wrap(cx, desc.object()))
return false;
if (desc.hasGetterObject()) {

Просмотреть файл

@ -281,10 +281,71 @@ struct JSCompartment
void markCrossCompartmentWrappers(JSTracer *trc);
void markAllCrossCompartmentWrappers(JSTracer *trc);
bool wrap(JSContext *cx, JS::MutableHandleValue vp, JS::HandleObject existing = js::NullPtr());
bool wrap(JSContext *cx, JS::MutableHandleValue vp,
JS::HandleObject existing = js::NullPtr())
{
JS_ASSERT_IF(existing, vp.isObject());
/* Only GC things have to be wrapped or copied. */
if (!vp.isMarkable())
return true;
/* Handle strings. */
if (vp.isString()) {
JSString *str = vp.toString();
if (!wrap(cx, &str))
return false;
vp.setString(str);
return true;
}
JS_ASSERT(vp.isObject());
/*
* All that's left are objects.
*
* Object wrapping isn't the fastest thing in the world, in part because
* we have to unwrap and invoke the prewrap hook to find the identity
* object before we even start checking the cache. Neither of these
* operations are needed in the common case, where we're just wrapping
* a plain JS object from the wrappee's side of the membrane to the
* wrapper's side.
*
* To optimize this, we note that the cache should only ever contain
* identity objects - that is to say, objects that serve as the
* canonical representation for a unique object identity observable by
* script. Unwrap and prewrap are both steps that we take to get to the
* identity of an incoming objects, and as such, they shuld never map
* one identity object to another object. This means that we can safely
* check the cache immediately, and only risk false negatives. Do this
* in opt builds, and do both in debug builds so that we can assert
* that we get the same answer.
*/
#ifdef DEBUG
JS::RootedObject cacheResult(cx);
#endif
JS::RootedValue v(cx, vp);
if (js::WrapperMap::Ptr p = crossCompartmentWrappers.lookup(v)) {
#ifdef DEBUG
cacheResult = &p->value.get().toObject();
#else
vp.set(p->value);
return true;
#endif
}
JS::RootedObject obj(cx, &vp.toObject());
if (!wrap(cx, &obj, existing))
return false;
vp.setObject(*obj);
JS_ASSERT_IF(cacheResult, obj == cacheResult);
return true;
}
bool wrap(JSContext *cx, JSString **strp);
bool wrap(JSContext *cx, js::HeapPtrString *strp);
bool wrap(JSContext *cx, JSObject **objp, JSObject *existing = NULL);
bool wrap(JSContext *cx, JS::MutableHandleObject obj,
JS::HandleObject existingArg = js::NullPtr());
bool wrapId(JSContext *cx, jsid *idp);
bool wrap(JSContext *cx, js::PropertyOp *op);
bool wrap(JSContext *cx, js::StrictPropertyOp *op);

Просмотреть файл

@ -272,8 +272,9 @@ js::fun_resolve(JSContext *cx, HandleObject obj, HandleId id, unsigned flags,
if (JSID_IS_ATOM(id, cx->names().length)) {
if (fun->isInterpretedLazy() && !fun->getOrCreateScript(cx))
return false;
uint16_t ndefaults = fun->hasScript() ? fun->nonLazyScript()->ndefaults : 0;
v.setInt32(fun->nargs - ndefaults - fun->hasRest());
uint16_t length = fun->hasScript() ? fun->nonLazyScript()->funLength :
fun->nargs - fun->hasRest();
v.setInt32(length);
} else {
v.setString(fun->atom() == NULL ? cx->runtime()->emptyString : fun->atom());
}

Просмотреть файл

@ -43,7 +43,7 @@ class JSFunction : public JSObject
SELF_HOSTED_CTOR = 0x0200, /* function is self-hosted builtin constructor and
must be constructible but not decompilable. */
HAS_REST = 0x0400, /* function has a rest (...) parameter */
HAS_DEFAULTS = 0x0800, /* function has at least one default parameter */
// 0x0800 is available
INTERPRETED_LAZY = 0x1000, /* function is interpreted but doesn't have a script yet */
ARROW = 0x2000, /* ES6 '(args) => body' syntax */
SH_WRAPPABLE = 0x4000, /* self-hosted function is wrappable, doesn't need to be cloned */
@ -60,8 +60,8 @@ class JSFunction : public JSObject
"shadow interface must match actual interface");
}
uint16_t nargs; /* maximum number of specified arguments,
reflected as f.length/f.arity */
uint16_t nargs; /* number of formal arguments
(including defaults and the rest parameter unlike f.length) */
uint16_t flags; /* bitfield composed of the above Flags enum */
union U {
class Native {
@ -117,7 +117,6 @@ class JSFunction : public JSObject
bool isSelfHostedBuiltin() const { return flags & SELF_HOSTED; }
bool isSelfHostedConstructor() const { return flags & SELF_HOSTED_CTOR; }
bool hasRest() const { return flags & HAS_REST; }
bool hasDefaults() const { return flags & HAS_DEFAULTS; }
bool isWrappable() const {
JS_ASSERT_IF(flags & SH_WRAPPABLE, isSelfHostedBuiltin());
return flags & SH_WRAPPABLE;
@ -170,11 +169,6 @@ class JSFunction : public JSObject
flags |= HAS_REST;
}
// Can be called multiple times by the parser.
void setHasDefaults() {
flags |= HAS_DEFAULTS;
}
void setIsSelfHostedBuiltin() {
JS_ASSERT(!isSelfHostedBuiltin());
flags |= SELF_HOSTED;

Просмотреть файл

@ -419,7 +419,7 @@ js::XDRScript(XDRState<mode> *xdr, HandleObject enclosingScope, HandleScript enc
uint32_t length, lineno, nslots;
uint32_t natoms, nsrcnotes, ntrynotes, nobjects, nregexps, nconsts, i;
uint32_t prologLength, version;
uint32_t ndefaults = 0;
uint32_t funLength = 0;
uint32_t nTypeSets = 0;
uint32_t scriptBits = 0;
@ -471,7 +471,7 @@ js::XDRScript(XDRState<mode> *xdr, HandleObject enclosingScope, HandleScript enc
ntrynotes = script->trynotes()->length;
nTypeSets = script->nTypeSets;
ndefaults = script->ndefaults;
funLength = script->funLength;
if (script->noScriptRval)
scriptBits |= (1 << NoScriptRval);
@ -531,7 +531,7 @@ js::XDRScript(XDRState<mode> *xdr, HandleObject enclosingScope, HandleScript enc
return false;
if (!xdr->codeUint32(&nTypeSets))
return false;
if (!xdr->codeUint32(&ndefaults))
if (!xdr->codeUint32(&funLength))
return false;
if (!xdr->codeUint32(&scriptBits))
return false;
@ -577,7 +577,7 @@ js::XDRScript(XDRState<mode> *xdr, HandleObject enclosingScope, HandleScript enc
script->mainOffset = prologLength;
script->length = length;
script->nfixed = uint16_t(version >> 16);
script->ndefaults = ndefaults;
script->funLength = funLength;
scriptp.set(script);
@ -1978,7 +1978,7 @@ JSScript::fullyInitFromEmitter(ExclusiveContext *cx, HandleScript script, Byteco
JS_ASSERT(!funbox->definitelyNeedsArgsObj());
}
script->ndefaults = funbox->ndefaults;
script->funLength = funbox->length;
}
RootedFunction fun(cx, NULL);
@ -2469,6 +2469,7 @@ js::CloneScript(JSContext *cx, HandleObject enclosingScope, HandleFunction fun,
dst->lineno = src->lineno;
dst->mainOffset = src->mainOffset;
dst->natoms = src->natoms;
dst->funLength = src->funLength;
dst->nfixed = src->nfixed;
dst->nTypeSets = src->nTypeSets;
dst->nslots = src->nslots;

Просмотреть файл

@ -521,7 +521,7 @@ class JSScript : public js::gc::Cell
uint16_t version; /* JS version under which script was compiled */
public:
uint16_t ndefaults; /* number of defaults the function has */
uint16_t funLength; /* ES6 function length */
uint16_t nfixed; /* number of slots besides stack operands in
slot array */

Просмотреть файл

@ -293,7 +293,7 @@ CrossCompartmentWrapper::get(JSContext *cx, HandleObject wrapper, HandleObject r
RootedId idCopy(cx, id);
{
AutoCompartment call(cx, wrappedObject(wrapper));
if (!cx->compartment()->wrap(cx, receiverCopy.address()) ||
if (!cx->compartment()->wrap(cx, &receiverCopy) ||
!cx->compartment()->wrapId(cx, idCopy.address()))
{
return false;
@ -312,7 +312,7 @@ CrossCompartmentWrapper::set(JSContext *cx, HandleObject wrapper, HandleObject r
RootedObject receiverCopy(cx, receiver);
RootedId idCopy(cx, id);
PIERCE(cx, wrapper,
cx->compartment()->wrap(cx, receiverCopy.address()) &&
cx->compartment()->wrap(cx, &receiverCopy) &&
cx->compartment()->wrapId(cx, idCopy.address()) &&
cx->compartment()->wrap(cx, vp),
Wrapper::set(cx, wrapper, receiverCopy, idCopy, strict, vp),
@ -364,7 +364,7 @@ Reify(JSContext *cx, JSCompartment *origin, MutableHandleValue vp)
/* Wrap the iteratee. */
RootedObject obj(cx, ni->obj);
if (!origin->wrap(cx, obj.address()))
if (!origin->wrap(cx, &obj))
return false;
/*
@ -575,7 +575,7 @@ CrossCompartmentWrapper::getPrototypeOf(JSContext *cx, HandleObject wrapper,
protop->setDelegate(cx);
}
return cx->compartment()->wrap(cx, protop.address());
return cx->compartment()->wrap(cx, protop);
}
CrossCompartmentWrapper CrossCompartmentWrapper::singleton(0u);
@ -933,7 +933,7 @@ js::RemapWrapper(JSContext *cx, JSObject *wobjArg, JSObject *newTargetArg)
// the choice to reuse |wobj| or not.
RootedObject tobj(cx, newTarget);
AutoCompartment ac(cx, wobj);
if (!wcompartment->wrap(cx, tobj.address(), wobj))
if (!wcompartment->wrap(cx, &tobj, wobj))
MOZ_CRASH();
// If wrap() reused |wobj|, it will have overwritten it and returned with

Просмотреть файл

@ -2519,7 +2519,7 @@ NewSandbox(JSContext *cx, bool lazy)
JS_FireOnNewGlobalObject(cx, obj);
if (!cx->compartment()->wrap(cx, obj.address()))
if (!cx->compartment()->wrap(cx, &obj))
return NULL;
return obj;
}

Просмотреть файл

@ -859,7 +859,7 @@ CloneObject(JSContext *cx, HandleObject srcObj, CloneMemory &clonedObjects)
if (srcObj->is<JSFunction>()) {
if (srcObj->as<JSFunction>().isWrappable()) {
clone = srcObj;
if (!cx->compartment()->wrap(cx, clone.address()))
if (!cx->compartment()->wrap(cx, &clone))
return NULL;
} else {
RootedFunction fun(cx, &srcObj->as<JSFunction>());

Просмотреть файл

@ -23,7 +23,7 @@ namespace js {
* and saved versions. If deserialization fails, the data should be
* invalidated if possible.
*/
static const uint32_t XDR_BYTECODE_VERSION = uint32_t(0xb973c0de - 150);
static const uint32_t XDR_BYTECODE_VERSION = uint32_t(0xb973c0de - 151);
class XDRBuffer {
public:

Просмотреть файл

@ -573,6 +573,22 @@ nsXPCWrappedJSClass::DelegatedQueryInterface(nsXPCWrappedJS* self,
REFNSIID aIID,
void** aInstancePtr)
{
if (MOZ_UNLIKELY(!NS_IsMainThread())) {
printf("Uh oh! DelegatedQueryInterface called off-main-thread!\n");
printf("Name: %s\n", GetInterfaceName());
JSCompartment *c = js::GetObjectCompartment(self->GetJSObjectPreserveColor());
char *origin = nullptr;
nsresult rv = xpc::GetCompartmentPrincipal(c)->GetOrigin(&origin);
if (NS_SUCCEEDED(rv)) {
printf("Principal origin: %s\n", origin);
NS_Free(origin);
} else {
printf("Unable to get origin from principal :-(\n");
}
nsAutoCString loc(EnsureCompartmentPrivate(c)->GetLocation());
printf("Global's Location: %s\n", loc.get());
MOZ_CRASH();
}
if (aIID.Equals(NS_GET_IID(nsIXPConnectJSObjectHolder))) {
NS_ADDREF(self);
*aInstancePtr = (void*) static_cast<nsIXPConnectJSObjectHolder*>(self);

Просмотреть файл

@ -27,6 +27,7 @@ typedef gfx::IntSizeTyped<CSSPixel> CSSIntSize;
typedef gfx::RectTyped<CSSPixel> CSSRect;
typedef gfx::IntRectTyped<CSSPixel> CSSIntRect;
typedef gfx::MarginTyped<CSSPixel> CSSMargin;
typedef gfx::IntMarginTyped<CSSPixel> CSSIntMargin;
typedef gfx::PointTyped<LayoutDevicePixel> LayoutDevicePoint;
typedef gfx::IntPointTyped<LayoutDevicePixel> LayoutDeviceIntPoint;
@ -35,6 +36,7 @@ typedef gfx::IntSizeTyped<LayoutDevicePixel> LayoutDeviceIntSize;
typedef gfx::RectTyped<LayoutDevicePixel> LayoutDeviceRect;
typedef gfx::IntRectTyped<LayoutDevicePixel> LayoutDeviceIntRect;
typedef gfx::MarginTyped<LayoutDevicePixel> LayoutDeviceMargin;
typedef gfx::IntMarginTyped<LayoutDevicePixel> LayoutDeviceIntMargin;
typedef gfx::PointTyped<LayerPixel> LayerPoint;
typedef gfx::IntPointTyped<LayerPixel> LayerIntPoint;
@ -43,6 +45,7 @@ typedef gfx::IntSizeTyped<LayerPixel> LayerIntSize;
typedef gfx::RectTyped<LayerPixel> LayerRect;
typedef gfx::IntRectTyped<LayerPixel> LayerIntRect;
typedef gfx::MarginTyped<LayerPixel> LayerMargin;
typedef gfx::IntMarginTyped<LayerPixel> LayerIntMargin;
typedef gfx::PointTyped<ScreenPixel> ScreenPoint;
typedef gfx::IntPointTyped<ScreenPixel> ScreenIntPoint;
@ -51,6 +54,7 @@ typedef gfx::IntSizeTyped<ScreenPixel> ScreenIntSize;
typedef gfx::RectTyped<ScreenPixel> ScreenRect;
typedef gfx::IntRectTyped<ScreenPixel> ScreenIntRect;
typedef gfx::MarginTyped<ScreenPixel> ScreenMargin;
typedef gfx::IntMarginTyped<ScreenPixel> ScreenIntMargin;
typedef gfx::ScaleFactor<CSSPixel, LayoutDevicePixel> CSSToLayoutDeviceScale;
typedef gfx::ScaleFactor<LayoutDevicePixel, CSSPixel> LayoutDeviceToCSSScale;

Просмотреть файл

@ -678,6 +678,16 @@ static void RecordFrameMetrics(nsIFrame* aForFrame,
mozilla::gfx::IntRect(bounds.x, bounds.y, bounds.width, bounds.height));
}
// Adjust for the size of scroll bars.
if (scrollableFrame) {
nsMargin sizes = scrollableFrame->GetActualScrollbarSizes();
ScreenIntMargin boundMargins(nsPresContext::AppUnitsToIntCSSPixels(sizes.top),
nsPresContext::AppUnitsToIntCSSPixels(sizes.right),
nsPresContext::AppUnitsToIntCSSPixels(sizes.bottom),
nsPresContext::AppUnitsToIntCSSPixels(sizes.left));
metrics.mCompositionBounds.Deflate(boundMargins);
}
metrics.mPresShellId = presShell->GetPresShellId();
aRoot->SetFrameMetrics(metrics);

Просмотреть файл

@ -6,7 +6,6 @@
#include "ScrollbarActivity.h"
#include "nsIScrollbarOwner.h"
#include "nsIDOMEvent.h"
#include "nsIDOMNSEvent.h"
#include "nsIDOMElementCSSInlineStyle.h"
#include "nsIDOMCSSStyleDeclaration.h"
#include "nsIFrame.h"

Просмотреть файл

@ -19,7 +19,6 @@
#include "nsRect.h"
#include "nsRenderingContext.h"
#include "nsTextFrame.h"
#include "nsStyleStructInlines.h"
#include "mozilla/Util.h"
#include "mozilla/Likely.h"

Просмотреть файл

@ -8,14 +8,13 @@
#define TextOverflow_h_
#include "nsDisplayList.h"
#include "nsLineBox.h"
#include "nsStyleStruct.h"
#include "nsTHashtable.h"
#include "mozilla/Likely.h"
#include <algorithm>
class nsIScrollableFrame;
class gfxTextRun;
class nsLineBox;
namespace mozilla {
namespace css {

Просмотреть файл

@ -13,12 +13,9 @@
#include "nsContainerFrame.h"
#include "nsGkAtoms.h"
#include "nsIPresShell.h"
#include "nsHTMLParts.h"
#include "nsHTMLReflowState.h"
#include "nsPresContext.h"
#include "nsFrameManager.h"
#include "nsCSSFrameConstructor.h"
#include "nsIDocumentInlines.h"
#ifdef DEBUG
#include "nsBlockFrame.h"

Просмотреть файл

@ -7,7 +7,6 @@
#include "nsCOMPtr.h"
#include "nsFrame.h"
#include "nsHTMLParts.h"
#include "nsPresContext.h"
#include "nsLineLayout.h"
#include "nsStyleConsts.h"
@ -17,7 +16,6 @@
//FOR SELECTION
#include "nsIContent.h"
#include "nsFrameSelection.h"
//END INCLUDES FOR SELECTION
using namespace mozilla;

Просмотреть файл

@ -10,7 +10,6 @@
*/
#include "mozilla/DebugOnly.h"
#include "mozilla/Likely.h"
#include "mozilla/Util.h"
#include "nsCOMPtr.h"
@ -20,7 +19,6 @@
#include "nsBlockReflowState.h"
#include "nsBulletFrame.h"
#include "nsLineBox.h"
#include "nsInlineFrame.h"
#include "nsLineLayout.h"
#include "nsPlaceholderFrame.h"
#include "nsStyleConsts.h"
@ -28,23 +26,16 @@
#include "nsPresContext.h"
#include "nsIPresShell.h"
#include "nsStyleContext.h"
#include "nsView.h"
#include "nsHTMLParts.h"
#include "nsGkAtoms.h"
#include "nsIDOMEvent.h"
#include "nsGenericHTMLElement.h"
#include "nsAttrValueInlines.h"
#include "prprf.h"
#include "nsStyleChangeList.h"
#include "nsFrameSelection.h"
#include "nsFloatManager.h"
#include "nsIntervalSet.h"
#include "prenv.h"
#include "plstr.h"
#include "nsGUIEvent.h"
#include "nsError.h"
#include "nsAutoPtr.h"
#include "nsIServiceManager.h"
#include "nsIScrollableFrame.h"
#include <algorithm>
#ifdef ACCESSIBILITY
@ -54,18 +45,13 @@
#include "nsDisplayList.h"
#include "nsCSSAnonBoxes.h"
#include "nsCSSFrameConstructor.h"
#include "nsCSSRendering.h"
#include "FrameLayerBuilder.h"
#include "nsRenderingContext.h"
#include "TextOverflow.h"
#include "nsStyleStructInlines.h"
#ifdef IBMBIDI
#include "nsBidiPresUtils.h"
#endif // IBMBIDI
#include "nsIDOMHTMLHtmlElement.h"
static const int MIN_LINES_NEEDING_CURSOR = 20;
static const PRUnichar kDiscCharacter = 0x2022;

Просмотреть файл

@ -44,9 +44,7 @@ enum LineReflowStatus {
class nsBlockReflowState;
class nsBlockInFlowLineIterator;
class nsBulletFrame;
class nsLineBox;
class nsFirstLineFrame;
class nsIntervalSet;
/**
* Some invariants:

Просмотреть файл

@ -7,17 +7,11 @@
/* class that a parent frame uses to reflow a block frame */
#include "nsBlockReflowContext.h"
#include "nsLineLayout.h"
#include "nsBlockReflowState.h"
#include "nsFloatManager.h"
#include "nsPresContext.h"
#include "nsFrameManager.h"
#include "nsIContent.h"
#include "nsStyleContext.h"
#include "nsContainerFrame.h"
#include "nsBlockFrame.h"
#include "nsLineBox.h"
#include "nsGkAtoms.h"
#include "nsCOMPtr.h"
#include "nsLayoutUtils.h"
#ifdef DEBUG

Просмотреть файл

@ -16,10 +16,8 @@ class nsBlockFrame;
class nsBlockReflowState;
struct nsHTMLReflowState;
class nsLineBox;
class nsIFrame;
class nsPresContext;
class nsLineLayout;
struct nsStylePosition;
struct nsBlockHorizontalAlign;
/**

Просмотреть файл

@ -6,21 +6,13 @@
/* state used in reflow of block frames */
#include "nsBlockReflowState.h"
#include "mozilla/DebugOnly.h"
#include "nsBlockReflowContext.h"
#include "nsBlockFrame.h"
#include "nsLineLayout.h"
#include "nsPresContext.h"
#include "nsGkAtoms.h"
#include "nsIFrame.h"
#include "nsFrameManager.h"
#include "mozilla/AutoRestore.h"
#include "FrameLayerBuilder.h"
#include "nsINameSpaceManager.h"
#include <algorithm>
#ifdef DEBUG

Просмотреть файл

@ -10,10 +10,10 @@
#include "nsFloatManager.h"
#include "nsLineBox.h"
#include "nsFrameList.h"
#include "nsHTMLReflowState.h"
class nsBlockFrame;
class nsFrameList;
class nsOverflowContinuationTracker;
// block reflow state flags

Просмотреть файл

@ -8,27 +8,19 @@
#include "nsCOMPtr.h"
#include "nsBulletFrame.h"
#include "nsGkAtoms.h"
#include "nsHTMLParts.h"
#include "nsContainerFrame.h"
#include "nsGenericHTMLElement.h"
#include "nsAttrValueInlines.h"
#include "nsPresContext.h"
#include "nsIPresShell.h"
#include "nsIDocument.h"
#include "nsRenderingContext.h"
#include "nsILoadGroup.h"
#include "nsIURL.h"
#include "nsNetUtil.h"
#include "prprf.h"
#include "nsDisplayList.h"
#include "nsCounterManager.h"
#include "imgILoader.h"
#include "imgIContainer.h"
#include "imgRequestProxy.h"
#include "nsIServiceManager.h"
#include "nsIComponentManager.h"
#include <algorithm>
#ifdef ACCESSIBILITY

Просмотреть файл

@ -10,9 +10,7 @@
#include "mozilla/Attributes.h"
#include "nsFrame.h"
#include "nsStyleContext.h"
#include "imgIRequest.h"
#include "imgINotificationObserver.h"
class imgIContainer;

Просмотреть файл

@ -6,26 +6,22 @@
/* rendering object that goes directly inside the document's scrollbars */
#include "nsCanvasFrame.h"
#include "nsIServiceManager.h"
#include "nsHTMLParts.h"
#include "nsContainerFrame.h"
#include "nsCSSRendering.h"
#include "nsPresContext.h"
#include "nsStyleContext.h"
#include "nsRenderingContext.h"
#include "nsGUIEvent.h"
#include "nsStyleConsts.h"
#include "nsGkAtoms.h"
#include "nsEventStateManager.h"
#include "nsIPresShell.h"
#include "nsIScrollPositionListener.h"
#include "nsDisplayList.h"
#include "nsCSSFrameConstructor.h"
#include "nsFrameManager.h"
// for focus
#include "nsIScrollableFrame.h"
#ifdef DEBUG_CANVAS_FOCUS
#include "nsIDocShell.h"
#endif
//#define DEBUG_CANVAS_FOCUS

Просмотреть файл

@ -12,7 +12,6 @@
#include "nsContainerFrame.h"
#include "nsIScrollPositionListener.h"
#include "nsDisplayList.h"
#include "nsGkAtoms.h"
class nsPresContext;
class nsRenderingContext;

Просмотреть файл

@ -6,6 +6,8 @@
/* rendering object for css3 multi-column layout */
#include "nsColumnSetFrame.h"
#include "nsCSSRendering.h"
#include "nsDisplayList.h"
using namespace mozilla;
using namespace mozilla::layout;

Просмотреть файл

@ -7,19 +7,6 @@
#include "mozilla/Attributes.h"
#include "nsContainerFrame.h"
#include "nsIContent.h"
#include "nsIFrame.h"
#include "nsISupports.h"
#include "nsIAtom.h"
#include "nsPresContext.h"
#include "nsHTMLParts.h"
#include "nsGkAtoms.h"
#include "nsStyleConsts.h"
#include "nsCOMPtr.h"
#include "nsLayoutUtils.h"
#include "nsDisplayList.h"
#include "nsCSSRendering.h"
#include <algorithm>
class nsColumnSetFrame : public nsContainerFrame {
public:

Просмотреть файл

@ -8,37 +8,26 @@
#include "nsContainerFrame.h"
#include "nsAbsoluteContainingBlock.h"
#include "nsIContent.h"
#include "nsIDocument.h"
#include "nsPresContext.h"
#include "nsStyleContext.h"
#include "nsRect.h"
#include "nsPoint.h"
#include "nsGUIEvent.h"
#include "nsStyleConsts.h"
#include "nsView.h"
#include "nsFrameManager.h"
#include "nsIPresShell.h"
#include "nsCOMPtr.h"
#include "nsGkAtoms.h"
#include "nsCSSAnonBoxes.h"
#include "nsViewManager.h"
#include "nsIWidget.h"
#include "nsGfxCIID.h"
#include "nsIServiceManager.h"
#include "nsCSSRendering.h"
#include "nsTransform2D.h"
#include "nsRegion.h"
#include "nsError.h"
#include "nsDisplayList.h"
#include "nsListControlFrame.h"
#include "nsIBaseWindow.h"
#include "nsThemeConstants.h"
#include "nsBoxLayoutState.h"
#include "nsRenderingContext.h"
#include "nsCSSFrameConstructor.h"
#include "nsBlockFrame.h"
#include "mozilla/AutoRestore.h"
#include "mozilla/dom/Element.h"
#include <algorithm>
#ifdef DEBUG

Просмотреть файл

@ -5,7 +5,6 @@
/* rendering object for CSS :first-letter pseudo-element */
#include "nsCOMPtr.h"
#include "nsFirstLetterFrame.h"
#include "nsPresContext.h"
#include "nsStyleContext.h"

Просмотреть файл

@ -993,7 +993,6 @@ private:
// Utility class for managing our position along the cross axis along
// the whole flex container (at a higher level than a single line)
class SingleLineCrossAxisPositionTracker;
class MOZ_STACK_CLASS CrossAxisPositionTracker : public PositionTracker {
public:
CrossAxisPositionTracker(nsFlexContainerFrame* aFlexContainerFrame,

Просмотреть файл

@ -11,8 +11,6 @@
#define nsFlexContainerFrame_h___
#include "nsContainerFrame.h"
#include "nsTArray.h"
#include "mozilla/Types.h"
nsIFrame* NS_NewFlexContainerFrame(nsIPresShell* aPresShell,
nsStyleContext* aContext);
@ -23,6 +21,7 @@ class FlexItem;
class FlexboxAxisTracker;
class MainAxisPositionTracker;
class SingleLineCrossAxisPositionTracker;
template <class T> class nsTArray;
class nsFlexContainerFrame : public nsFlexContainerFrameSuper {
NS_DECL_FRAMEARENA_HELPERS

Просмотреть файл

@ -7,8 +7,6 @@
#include "nsFontInflationData.h"
#include "FramePropertyTable.h"
#include "nsTextFragment.h"
#include "nsIFormControlFrame.h"
#include "nsTextControlFrame.h"
#include "nsListControlFrame.h"
#include "nsComboboxControlFrame.h"

Просмотреть файл

@ -9,8 +9,6 @@
#define nsFontInflationData_h_
#include "nsIFrame.h"
#include "nsLayoutUtils.h"
#include "nsBlockFrame.h"
struct nsHTMLReflowState;

Просмотреть файл

@ -13,7 +13,6 @@
#include "nsFrame.h"
#include "nsFrameList.h"
#include "nsPlaceholderFrame.h"
#include "nsLineLayout.h"
#include "nsIContent.h"
#include "nsContentUtils.h"
#include "nsIAtom.h"
@ -25,9 +24,7 @@
#include "nsViewManager.h"
#include "nsIScrollableFrame.h"
#include "nsPresContext.h"
#include "nsCRT.h"
#include "nsGUIEvent.h"
#include "nsIDOMEvent.h"
#include "nsAsyncDOMEvent.h"
#include "nsStyleConsts.h"
#include "nsIPresShell.h"
@ -35,7 +32,6 @@
#include "prprf.h"
#include <stdarg.h>
#include "nsFrameManager.h"
#include "nsCSSRendering.h"
#include "nsLayoutUtils.h"
#include "nsIDOMNode.h"
@ -43,17 +39,11 @@
#include "nsISelection.h"
#include "nsISelectionPrivate.h"
#include "nsFrameSelection.h"
#include "nsHTMLParts.h"
#include "nsGkAtoms.h"
#include "nsCSSAnonBoxes.h"
#include "nsCSSPseudoElements.h"
#include "nsCSSFrameConstructor.h"
#include "nsFrameTraversal.h"
#include "nsStyleChangeList.h"
#include "nsIDOMRange.h"
#include "nsRange.h"
#include "nsITableCellLayout.h"// "
#include "nsITextControlFrame.h"
#include "nsINameSpaceManager.h"
#include "nsIPercentHeightObserver.h"
@ -65,33 +55,25 @@
#endif
// For triple-click pref
#include "nsIServiceManager.h"
#include "imgIContainer.h"
#include "imgIRequest.h"
#include "nsLayoutCID.h"
#include "nsUnicharUtils.h"
#include "nsError.h"
#include "nsContainerFrame.h"
#include "nsBoxLayoutState.h"
#include "nsBlockFrame.h"
#include "nsDisplayList.h"
#include "nsIObjectLoadingContent.h"
#include "nsExpirationTracker.h"
#include "nsSVGIntegrationUtils.h"
#include "nsSVGEffects.h"
#include "nsChangeHint.h"
#include "nsDeckFrame.h"
#include "nsTableFrame.h"
#include "nsSubDocumentFrame.h"
#include "nsSVGTextFrame2.h"
#include "gfxContext.h"
#include "nsRenderingContext.h"
#include "CSSCalc.h"
#include "nsAbsoluteContainingBlock.h"
#include "nsFontInflationData.h"
#include "nsAnimationManager.h"
#include "nsTransitionManager.h"
#include "mozilla/Preferences.h"
#include "mozilla/LookAndFeel.h"

Просмотреть файл

@ -12,14 +12,12 @@
#include "mozilla/Likely.h"
#include "nsBox.h"
#include "nsRect.h"
#include "nsString.h"
#include "prlog.h"
#include "nsIPresShell.h"
#include "nsFrameSelection.h"
#include "nsHTMLReflowState.h"
#include "nsHTMLReflowMetrics.h"
#include "nsHTMLParts.h"
#include "nsISelectionDisplay.h"
/**
* nsFrame logging constants. We redefine the nspr

Просмотреть файл

@ -10,7 +10,6 @@
#include "nsIPresShell.h"
#ifdef IBMBIDI
#include "nsCOMPtr.h"
#include "nsGkAtoms.h"
#include "nsILineIterator.h"
#include "nsBidiPresUtils.h"

Просмотреть файл

@ -6,15 +6,13 @@
#ifndef nsFrameList_h___
#define nsFrameList_h___
#include "nscore.h"
#include "nsTraceRefcnt.h"
#include <stdio.h> /* for FILE* */
#include "nsDebug.h"
#include "nsTArray.h"
class nsIFrame;
class nsIPresShell;
class nsPresContext;
template <class T> class nsTArray;
namespace mozilla {
namespace layout {

Просмотреть файл

@ -8,7 +8,6 @@
#include "mozilla/DebugOnly.h"
#include "mozilla/Likely.h"
#include "nsCOMPtr.h"
#include "nsFrameSetFrame.h"
#include "nsGenericHTMLElement.h"
#include "nsAttrValueInlines.h"
@ -16,22 +15,12 @@
#include "nsContainerFrame.h"
#include "nsPresContext.h"
#include "nsIPresShell.h"
#include "nsIComponentManager.h"
#include "nsIStreamListener.h"
#include "nsIURL.h"
#include "nsIDocument.h"
#include "nsINodeInfo.h"
#include "nsView.h"
#include "nsViewManager.h"
#include "nsWidgetsCID.h"
#include "nsGkAtoms.h"
#include "nsStyleCoord.h"
#include "nsStyleConsts.h"
#include "nsStyleContext.h"
#include "nsHTMLParts.h"
#include "nsGUIEvent.h"
#include "nsRenderingContext.h"
#include "nsIServiceManager.h"
#include "nsIDOMMutationEvent.h"
#include "nsINameSpaceManager.h"
#include "nsCSSAnonBoxes.h"

Просмотреть файл

@ -9,16 +9,11 @@
#define nsHTMLFrameset_h___
#include "mozilla/Attributes.h"
#include "nsGkAtoms.h"
#include "nsContainerFrame.h"
#include "nsColor.h"
#include "nsIObserver.h"
#include "nsWeakPtr.h"
class nsIContent;
class nsIFrame;
class nsPresContext;
class nsRenderingContext;
struct nsRect;
struct nsHTMLReflowState;
struct nsSize;

Просмотреть файл

@ -7,12 +7,9 @@
#include "base/compiler_specific.h"
#include "nsCOMPtr.h"
#include "nsHTMLParts.h"
#include "nsPresContext.h"
#include "nsIServiceManager.h"
#include "nsView.h"
#include "nsIScrollable.h"
#include "nsViewManager.h"
#include "nsContainerFrame.h"
#include "nsGfxScrollFrame.h"
#include "nsGkAtoms.h"
@ -20,7 +17,6 @@
#include "nsContentList.h"
#include "nsIDocumentInlines.h"
#include "nsFontMetrics.h"
#include "nsIDocumentObserver.h"
#include "nsBoxLayoutState.h"
#include "nsINodeInfo.h"
#include "nsScrollbarFrame.h"
@ -28,24 +24,19 @@
#include "nsITextControlFrame.h"
#include "nsIDOMHTMLTextAreaElement.h"
#include "nsNodeInfoManager.h"
#include "nsIURI.h"
#include "nsGUIEvent.h"
#include "nsContentCreatorFunctions.h"
#include "nsISupportsPrimitives.h"
#include "nsAutoPtr.h"
#include "nsPresState.h"
#include "nsDocShellCID.h"
#include "nsIHTMLDocument.h"
#include "nsEventDispatcher.h"
#include "nsContentUtils.h"
#include "nsLayoutUtils.h"
#include "nsBidiUtils.h"
#include "nsFrameManager.h"
#include "mozilla/Preferences.h"
#include "mozilla/LookAndFeel.h"
#include "mozilla/dom/Element.h"
#include <stdint.h>
#include "mozilla/Util.h"
#include "mozilla/MathAlgorithms.h"
#include "FrameLayerBuilder.h"
#include "nsSMILKeySpline.h"
@ -54,8 +45,9 @@
#include "mozilla/Attributes.h"
#include "ScrollbarActivity.h"
#include "nsRefreshDriver.h"
#include "nsContentList.h"
#include "nsThemeConstants.h"
#include "nsSVGIntegrationUtils.h"
#include "nsIScrollPositionListener.h"
#include <algorithm>
#include <cstdlib> // for std::abs(int/long)
#include <cmath> // for std::abs(float/double)

Просмотреть файл

@ -12,25 +12,21 @@
#include "nsContainerFrame.h"
#include "nsIAnonymousContentCreator.h"
#include "nsBoxFrame.h"
#include "nsDisplayList.h"
#include "nsIScrollableFrame.h"
#include "nsIScrollPositionListener.h"
#include "nsIStatefulFrame.h"
#include "nsThreadUtils.h"
#include "nsIReflowCallback.h"
#include "nsBoxLayoutState.h"
#include "nsQueryFrame.h"
#include "nsCOMArray.h"
#include "nsSVGIntegrationUtils.h"
#include "nsExpirationTracker.h"
class nsPresContext;
class nsIPresShell;
class nsIContent;
class nsIAtom;
class nsIDocument;
class nsIScrollFrameInternal;
class nsPresState;
class nsIScrollPositionListener;
struct ScrollReflowState;
namespace mozilla {

Просмотреть файл

@ -5,20 +5,13 @@
/* rendering object for the HTML <canvas> element */
#include "nsHTMLParts.h"
#include "nsCOMPtr.h"
#include "nsIServiceManager.h"
#include "nsGkAtoms.h"
#include "nsHTMLCanvasFrame.h"
#include "mozilla/dom/HTMLCanvasElement.h"
#include "nsDisplayList.h"
#include "nsLayoutUtils.h"
#include "Layers.h"
#include "nsTransform2D.h"
#include "gfxContext.h"
#include <algorithm>
using namespace mozilla;

Просмотреть файл

@ -10,9 +10,6 @@
#include "mozilla/Attributes.h"
#include "nsContainerFrame.h"
#include "nsString.h"
#include "nsAString.h"
#include "nsIIOService.h"
#include "FrameLayerBuilder.h"
namespace mozilla {
@ -24,6 +21,7 @@ class LayerManager;
class nsPresContext;
class nsDisplayItem;
class nsAString;
nsIFrame* NS_NewHTMLCanvasFrame (nsIPresShell* aPresShell, nsStyleContext* aContext);

Просмотреть файл

@ -8,9 +8,6 @@
#ifndef nsHTMLReflowMetrics_h___
#define nsHTMLReflowMetrics_h___
#include <stdio.h>
#include "nsISupports.h"
#include "nsMargin.h"
#include "nsRect.h"
#include "nsBoundingMetrics.h"

Просмотреть файл

@ -5,7 +5,6 @@
/* struct containing the input to nsIFrame::Reflow */
#include "nsCOMPtr.h"
#include "nsStyleConsts.h"
#include "nsCSSAnonBoxes.h"
#include "nsFrame.h"
@ -20,11 +19,9 @@
#include "nsImageFrame.h"
#include "nsTableFrame.h"
#include "nsTableCellFrame.h"
#include "nsIServiceManager.h"
#include "nsIPercentHeightObserver.h"
#include "nsLayoutUtils.h"
#include "mozilla/Preferences.h"
#include "nsBidiUtils.h"
#include "nsFontInflationData.h"
#include <algorithm>

Просмотреть файл

@ -20,14 +20,6 @@ class nsRenderingContext;
class nsFloatManager;
class nsLineLayout;
class nsIPercentHeightObserver;
struct nsStyleDisplay;
struct nsStyleVisibility;
struct nsStylePosition;
struct nsStyleBorder;
struct nsStyleMargin;
struct nsStylePadding;
struct nsStyleText;
struct nsHypotheticalBox;

Просмотреть файл

@ -7,7 +7,6 @@
#include "mozilla/DebugOnly.h"
#include "nsHTMLParts.h"
#include "nsCOMPtr.h"
#include "nsImageFrame.h"
#include "nsIImageLoadingContent.h"
@ -18,7 +17,6 @@
#include "nsIPresShell.h"
#include "nsGkAtoms.h"
#include "nsIDocument.h"
#include "nsINodeInfo.h"
#include "nsContentUtils.h"
#include "nsCSSAnonBoxes.h"
#include "nsStyleContext.h"
@ -26,22 +24,13 @@
#include "nsStyleCoord.h"
#include "nsTransform2D.h"
#include "nsImageMap.h"
#include "nsILinkHandler.h"
#include "nsIURL.h"
#include "nsIIOService.h"
#include "nsILoadGroup.h"
#include "nsISupportsPriority.h"
#include "nsIServiceManager.h"
#include "nsNetUtil.h"
#include "nsContainerFrame.h"
#include "prprf.h"
#include "nsCSSRendering.h"
#include "nsIDOMHTMLAnchorElement.h"
#include "nsIDOMHTMLImageElement.h"
#include "nsINameSpaceManager.h"
#include "nsTextFragment.h"
#include "nsIDOMHTMLMapElement.h"
#include "nsIScriptSecurityManager.h"
#include <algorithm>
#ifdef ACCESSIBILITY
#include "nsAccessibilityService.h"
@ -58,8 +47,6 @@
#include "nsCSSFrameConstructor.h"
#include "nsIDOMRange.h"
#include "nsIContentPolicy.h"
#include "nsContentPolicyUtils.h"
#include "nsEventStates.h"
#include "nsError.h"
#include "nsBidiUtils.h"

Просмотреть файл

@ -18,19 +18,16 @@
#include "imgIContainer.h"
#include "mozilla/Attributes.h"
class nsIFrame;
class nsImageMap;
class nsIURI;
class nsILoadGroup;
struct nsHTMLReflowState;
struct nsHTMLReflowMetrics;
struct nsSize;
class nsDisplayImage;
class nsPresContext;
class nsImageFrame;
class nsTransform2D;
class nsImageLoadingContent;
class imgRequestProxy;
namespace mozilla {
namespace layers {

Просмотреть файл

@ -12,18 +12,11 @@
#include "nsReadableUtils.h"
#include "nsRenderingContext.h"
#include "nsPresContext.h"
#include "nsIURL.h"
#include "nsIServiceManager.h"
#include "nsNetUtil.h"
#include "nsTextFragment.h"
#include "mozilla/dom/Element.h"
#include "nsIDocument.h"
#include "nsINameSpaceManager.h"
#include "nsGkAtoms.h"
#include "nsIPresShell.h"
#include "nsImageFrame.h"
#include "nsCoord.h"
#include "nsIConsoleService.h"
#include "nsIScriptError.h"
#include "nsIStringBundle.h"
#include "nsContentUtils.h"

Просмотреть файл

@ -8,17 +8,18 @@
#ifndef nsImageMap_h
#define nsImageMap_h
#include "nsISupports.h"
#include "nsCOMPtr.h"
#include "nsCoord.h"
#include "nsTArray.h"
#include "nsStubMutationObserver.h"
#include "nsIDOMEventListener.h"
#include "nsIFrame.h"
#include "nsRect.h"
class Area;
class nsIDOMEvent;
class nsRenderingContext;
class nsImageFrame;
class nsIFrame;
class nsIContent;
class nsImageMap : public nsStubMutationObserver,
public nsIDOMEventListener

Просмотреть файл

@ -6,14 +6,11 @@
/* rendering object for CSS display:inline objects */
#include "nsInlineFrame.h"
#include "nsCOMPtr.h"
#include "nsLineLayout.h"
#include "nsBlockFrame.h"
#include "nsPlaceholderFrame.h"
#include "nsGkAtoms.h"
#include "nsHTMLParts.h"
#include "nsStyleContext.h"
#include "nsIPresShell.h"
#include "nsPresContext.h"
#include "nsRenderingContext.h"
#include "nsCSSAnonBoxes.h"

Просмотреть файл

@ -7,7 +7,6 @@
/* a set of ranges on a number-line */
#include "nsIntervalSet.h"
#include "nsAlgorithm.h"
#include <new>
#include <algorithm>

Просмотреть файл

@ -10,7 +10,6 @@
#define nsIntervalSet_h___
#include "nsCoord.h"
#include "nsDebug.h"
typedef void *
(* IntervalSetAlloc)(size_t aBytes, void *aClosure);

Просмотреть файл

@ -5,10 +5,7 @@
/* base class for rendering objects that do not have child lists */
#include "nsCOMPtr.h"
#include "nsLeafFrame.h"
#include "nsContainerFrame.h"
#include "nsHTMLParts.h"
#include "nsPresContext.h"
nsLeafFrame::~nsLeafFrame()

Просмотреть файл

@ -7,15 +7,12 @@
/* representation of one line within a block frame, a CSS line box */
#include "nsLineBox.h"
#include "nsLineLayout.h"
#include "prprf.h"
#include "nsBlockFrame.h"
#include "nsIFrame.h"
#include "nsFrame.h"
#include "nsPresArena.h"
#ifdef IBMBIDI
#include "nsBidiPresUtils.h"
#endif
#include "nsStyleStructInlines.h"
#include "mozilla/Assertions.h"
#include "mozilla/Likely.h"

Просмотреть файл

@ -9,10 +9,8 @@
#include "plarena.h"
#include "mozilla/Util.h"
#include "nsCOMPtr.h"
#include "nsLineLayout.h"
#include "nsBlockFrame.h"
#include "nsInlineFrame.h"
#include "nsStyleConsts.h"
#include "nsContainerFrame.h"
#include "nsFloatManager.h"
@ -20,13 +18,9 @@
#include "nsPresContext.h"
#include "nsRenderingContext.h"
#include "nsGkAtoms.h"
#include "nsPlaceholderFrame.h"
#include "nsIContent.h"
#include "nsTextFragment.h"
#include "nsBidiUtils.h"
#include "nsLayoutUtils.h"
#include "nsTextFrame.h"
#include "nsCSSRendering.h"
#include <algorithm>
#ifdef DEBUG

Просмотреть файл

@ -17,17 +17,12 @@
#ifndef nsLineLayout_h___
#define nsLineLayout_h___
#include "nsFrame.h"
#include "nsDeque.h"
#include "nsLineBox.h"
#include "nsBlockReflowState.h"
#include "plarena.h"
#include "gfxTypes.h"
class nsBlockFrame;
class nsFloatManager;
class nsPlaceholderFrame;
struct nsStyleText;
class nsLineLayout {

Просмотреть файл

@ -6,7 +6,10 @@
/* rendering objects for replaced elements implemented by a plugin */
#ifdef XP_WIN
// This is needed for DoublePassRenderingEvent.
#include "mozilla/plugins/PluginMessageUtils.h"
#endif
#include "nscore.h"
#include "nsCOMPtr.h"
@ -15,89 +18,40 @@
#include "nsWidgetsCID.h"
#include "nsView.h"
#include "nsViewManager.h"
#include "nsIDOMEventListener.h"
#include "nsIDOMDragEvent.h"
#include "nsPluginHost.h"
#include "nsString.h"
#include "nsReadableUtils.h"
#include "nsGkAtoms.h"
#include "nsIAppShell.h"
#include "nsIDocument.h"
#include "nsINodeInfo.h"
#include "nsIURL.h"
#include "nsNetUtil.h"
#include "nsIPluginInstanceOwner.h"
#include "nsNPAPIPluginInstance.h"
#include "nsIPluginTagInfo.h"
#include "plstr.h"
#include "nsILinkHandler.h"
#include "nsIScrollPositionListener.h"
#include "nsITimer.h"
#include "nsIDocShellTreeItem.h"
#include "nsIDocShellTreeOwner.h"
#include "nsDocShellCID.h"
#include "nsIWebBrowserChrome.h"
#include "nsIDOMElement.h"
#include "nsIDOMNodeList.h"
#include "nsIDOMHTMLObjectElement.h"
#include "nsIDOMHTMLEmbedElement.h"
#include "nsIDOMHTMLAppletElement.h"
#include "nsIDOMWindow.h"
#include "nsIDocumentEncoder.h"
#include "nsXPIDLString.h"
#include "nsIDOMRange.h"
#include "nsIPluginWidget.h"
#include "nsGUIEvent.h"
#include "nsRenderingContext.h"
#include "npapi.h"
#include "nsTransform2D.h"
#include "nsIImageLoadingContent.h"
#include "nsIObjectLoadingContent.h"
#include "nsPIDOMWindow.h"
#include "nsContentUtils.h"
#include "nsDisplayList.h"
#include "nsAttrName.h"
#include "nsDataHashtable.h"
#include "nsDOMClassInfo.h"
#include "nsFocusManager.h"
#include "nsLayoutUtils.h"
#include "nsFrameManager.h"
#include "nsComponentManagerUtils.h"
#include "nsIObserverService.h"
#include "nsIScrollableFrame.h"
#include "mozilla/Preferences.h"
#include "GeckoProfiler.h"
#include <algorithm>
// headers for plugin scriptability
#include "nsIScriptGlobalObject.h"
#include "nsIScriptContext.h"
#include "nsIXPConnect.h"
#include "nsIXPCScriptable.h"
#include "nsIClassInfo.h"
#include "nsIDOMClientRect.h"
#include "nsObjectFrame.h"
#include "nsIObjectFrame.h"
#include "nsPluginNativeWindow.h"
#include "nsIPluginDocument.h"
#include "FrameLayerBuilder.h"
#include "nsThreadUtils.h"
#include "gfxContext.h"
#include "gfxPlatform.h"
#include "ImageLayers.h"
#include "nsPluginInstanceOwner.h"
#ifdef XP_WIN
#include "gfxWindowsNativeDrawing.h"
#include "gfxWindowsSurface.h"
#endif
#include "gfxImageSurface.h"
#include "gfxUtils.h"
#include "Layers.h"
#include "ReadbackLayer.h"
#include "ImageContainer.h"
// accessibility support
#ifdef ACCESSIBILITY
@ -109,9 +63,6 @@
#endif /* MOZ_LOGGING */
#include "prlog.h"
#include <errno.h>
#include "nsContentCID.h"
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
#ifdef XP_MACOSX
@ -120,13 +71,6 @@ static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
#include "mozilla/gfx/QuartzSupport.h"
#endif
#if defined(MOZ_WIDGET_GTK)
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
#include "gfxXlibNativeRenderer.h"
#endif
#ifdef MOZ_X11
#include "mozilla/X11Util.h"
using mozilla::DefaultXDisplay;

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше