Merge mozilla-central into mozilla-inbound

This commit is contained in:
Ehsan Akhgari 2012-11-04 11:09:45 -05:00
commit a782ddd2a1
26 changed files with 162 additions and 198 deletions

View File

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<head>
<script>
function boom()
{
setTimeout(function(){
document.documentElement.removeChild(document.body);
}, 0);
}
</script>
</head>
<body onload="boom();">
<input value="f" pattern="[">
</body>
</html>

View File

@ -104,6 +104,7 @@ load 700090-2.html
load 700512.html
load xhr_html_nullresponse.html
load 709384.html
load 709954.html
load 713417.html
load 713417-2.html
load 715056.html

View File

@ -6682,30 +6682,34 @@ nsContentUtils::IsPatternMatching(nsAString& aValue, nsAString& aPattern,
NS_ASSERTION(aDocument, "aDocument should be a valid pointer (not null)");
NS_ENSURE_TRUE(aDocument->GetScriptGlobalObject(), true);
JSContext* ctx = (JSContext*) aDocument->GetScriptGlobalObject()->
JSContext* cx = aDocument->GetScriptGlobalObject()->
GetContext()->GetNativeContext();
NS_ENSURE_TRUE(ctx, true);
NS_ENSURE_TRUE(cx, true);
JSAutoRequest ar(ctx);
JSAutoRequest ar(cx);
// The pattern has to match the entire value.
aPattern.Insert(NS_LITERAL_STRING("^(?:"), 0);
aPattern.Append(NS_LITERAL_STRING(")$"));
JSObject* re = JS_NewUCRegExpObjectNoStatics(ctx, reinterpret_cast<jschar*>
JSObject* re = JS_NewUCRegExpObjectNoStatics(cx, static_cast<jschar*>
(aPattern.BeginWriting()),
aPattern.Length(), 0);
NS_ENSURE_TRUE(re, true);
aPattern.Length(), 0);
if (!re) {
JS_ClearPendingException(cx);
return true;
}
jsval rval = JSVAL_NULL;
JS::Value rval = JS::NullValue();
size_t idx = 0;
JSBool res;
if (!JS_ExecuteRegExpNoStatics(cx, re,
static_cast<jschar*>(aValue.BeginWriting()),
aValue.Length(), &idx, true, &rval)) {
JS_ClearPendingException(cx);
return true;
}
res = JS_ExecuteRegExpNoStatics(ctx, re, reinterpret_cast<jschar*>
(aValue.BeginWriting()),
aValue.Length(), &idx, JS_TRUE, &rval);
return res == JS_FALSE || rval != JSVAL_NULL;
return !rval.isNull();
}
// static

View File

@ -793,10 +793,7 @@ CanvasRenderingContext2D::Redraw(const mgfx::Rect &r)
nsSVGEffects::InvalidateDirectRenderingObservers(mCanvasElement);
gfxRect tmpR = ThebesRect(r);
mCanvasElement->InvalidateCanvasContent(&tmpR);
return;
mCanvasElement->InvalidateCanvasContent(&r);
}
void
@ -3775,6 +3772,11 @@ CanvasRenderingContext2D::DrawImage(const HTMLImageOrCanvasOrVideoElement& image
sh = (double) imgSize.height;
}
if (sw == 0.0 || sh == 0.0) {
error.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
return;
}
if (dw == 0.0 || dh == 0.0) {
// not really failure, but nothing to do --
// and noone likes a divide-by-zero

View File

@ -3741,13 +3741,13 @@ ctx.fillStyle = '#0f0';
ctx.fillRect(0, 0, 100, 50);
var _thrown = undefined; try {
ctx.drawImage(document.getElementById('red_14.png'), 10, 10, 0, 1, 0, 0, 100, 50);
} catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "IndexSizeError" && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw IndexSizeError");
} catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "IndexSizeError" && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw IndexSizeError");
var _thrown = undefined; try {
ctx.drawImage(document.getElementById('red_14.png'), 10, 10, 1, 0, 0, 0, 100, 50);
} catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "IndexSizeError" && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw IndexSizeError");
} catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "IndexSizeError" && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw IndexSizeError");
var _thrown = undefined; try {
ctx.drawImage(document.getElementById('red_14.png'), 10, 10, 0, 0, 0, 0, 100, 50);
} catch (e) { _thrown = e }; todo(_thrown && _thrown.name == "IndexSizeError" && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw IndexSizeError");
} catch (e) { _thrown = e }; ok(_thrown && _thrown.name == "IndexSizeError" && _thrown.code == DOMException.INDEX_SIZE_ERR, "should throw IndexSizeError");
isPixel(ctx, 50,25, 0,255,0,255, 2);
@ -19591,8 +19591,8 @@ ok(ctx.clip() === undefined, "ctx.clip() === undefined");
if (ctx.putImageData) {
ok(ctx.putImageData(ctx.getImageData(0, 0, 1, 1), 0, 0) === undefined, "ctx.putImageData(ctx.getImageData(0, 0, 1, 1), 0, 0) === undefined");
}
ok(ctx.drawImage(document.getElementById('yellow_11.png'), 0, 0, 0, 0, 0, 0, 0, 0) === undefined, "ctx.drawImage(document.getElementById('yellow_11.png'), 0, 0, 0, 0, 0, 0, 0, 0) === undefined");
ok(ctx.drawImage(canvas, 0, 0, 0, 0, 0, 0, 0, 0) === undefined, "ctx.drawImage(canvas, 0, 0, 0, 0, 0, 0, 0, 0) === undefined");
ok(ctx.drawImage(document.getElementById('yellow_11.png'), 0, 0, 1, 1, 0, 0, 0, 0) === undefined, "ctx.drawImage(document.getElementById('yellow_11.png'), 0, 0, 1, 1, 0, 0, 0, 0) === undefined");
ok(ctx.drawImage(canvas, 0, 0, 1, 1, 0, 0, 0, 0) === undefined, "ctx.drawImage(canvas, 0, 0, 1, 1, 0, 0, 0, 0) === undefined");
ok(ctx.createLinearGradient(0, 0, 0, 0).addColorStop(0, 'white') === undefined, "ctx.createLinearGradient(0, 0, 0, 0).addColorStop(0, 'white') === undefined");

View File

@ -23,10 +23,16 @@ class nsITimerCallback;
class nsIPropertyBag;
namespace mozilla {
namespace layers {
class CanvasLayer;
class LayerManager;
}
namespace gfx {
struct Rect;
}
}
class nsHTMLCanvasElement : public nsGenericHTMLElement,
@ -85,7 +91,7 @@ public:
* Notify that some canvas content has changed and the window may
* need to be updated. aDamageRect is in canvas coordinates.
*/
void InvalidateCanvasContent(const gfxRect* aDamageRect);
void InvalidateCanvasContent(const mozilla::gfx::Rect* aDamageRect);
/*
* Notify that we need to repaint the entire canvas, including updating of
* the layer tree.

View File

@ -8,6 +8,9 @@
#include "mozilla/Base64.h"
#include "mozilla/CheckedInt.h"
#include "mozilla/gfx/Rect.h"
#include "mozilla/Preferences.h"
#include "mozilla/Telemetry.h"
#include "nsNetUtil.h"
#include "nsDOMFile.h"
@ -21,8 +24,6 @@
#include "nsJSUtils.h"
#include "nsMathUtils.h"
#include "nsStreamUtils.h"
#include "mozilla/Preferences.h"
#include "mozilla/Telemetry.h"
#include "nsFrameManager.h"
#include "nsDisplayList.h"
@ -889,7 +890,7 @@ nsHTMLCanvasElement::SetWriteOnly()
}
void
nsHTMLCanvasElement::InvalidateCanvasContent(const gfxRect* damageRect)
nsHTMLCanvasElement::InvalidateCanvasContent(const gfx::Rect* damageRect)
{
// We don't need to flush anything here; if there's no frame or if
// we plan to reframe we don't need to invalidate it anyway.
@ -904,10 +905,10 @@ nsHTMLCanvasElement::InvalidateCanvasContent(const gfxRect* damageRect)
nsIntSize size = GetWidthHeight();
if (size.width != 0 && size.height != 0) {
gfxRect realRect(*damageRect);
gfx::Rect realRect(*damageRect);
realRect.RoundOut();
// then make it a nsRect
// then make it a nsIntRect
nsIntRect invalRect(realRect.X(), realRect.Y(),
realRect.Width(), realRect.Height());

View File

@ -258,7 +258,7 @@ nsXBLDocGlobalObject::EnsureScriptEnvironment()
NS_GetJSRuntime(getter_AddRefs(scriptRuntime));
NS_ENSURE_TRUE(scriptRuntime, NS_OK);
nsCOMPtr<nsIScriptContext> newCtx = scriptRuntime->CreateContext();
nsCOMPtr<nsIScriptContext> newCtx = scriptRuntime->CreateContext(false, nullptr);
MOZ_ASSERT(newCtx);
newCtx->WillInitializeContext();
@ -267,7 +267,6 @@ nsXBLDocGlobalObject::EnsureScriptEnvironment()
// nsGlobalWindow.
DebugOnly<nsresult> rv = newCtx->InitContext();
NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Script Language's InitContext failed");
newCtx->SetGCOnDestruction(false);
newCtx->DidInitializeContext();
mScriptContext = newCtx;

View File

@ -742,7 +742,7 @@ nsXULPDGlobalObject::EnsureScriptEnvironment()
nsresult rv = NS_GetJSRuntime(getter_AddRefs(languageRuntime));
NS_ENSURE_SUCCESS(rv, NS_OK);
nsCOMPtr<nsIScriptContext> ctxNew = languageRuntime->CreateContext();
nsCOMPtr<nsIScriptContext> ctxNew = languageRuntime->CreateContext(false, nullptr);
MOZ_ASSERT(ctxNew);
// We have to setup a special global object. We do this then
@ -770,7 +770,6 @@ nsXULPDGlobalObject::EnsureScriptEnvironment()
rv = ctxNew->InitContext();
NS_ENSURE_SUCCESS(rv, NS_OK);
ctxNew->SetGCOnDestruction(false);
ctxNew->DidInitializeContext();
JSObject* global = ctxNew->GetNativeGlobal();

View File

@ -7015,6 +7015,7 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
js::RootedId id(cx, id_);
nsGlobalWindow *win = nsGlobalWindow::FromWrapper(wrapper);
MOZ_ASSERT(win->IsInnerWindow());
if (!JSID_IS_STRING(id)) {
if (JSID_IS_INT(id) && JSID_TO_INT(id) >= 0 && !(flags & JSRESOLVE_ASSIGNING)) {
@ -7126,32 +7127,13 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
// here) since we must define window.location to prevent the
// getter from being overriden (for security reasons).
// Note: Because we explicitly don't forward to the inner window
// above, we have to ensure here that our window has a current
// inner window so that the location object we return will work.
if (win->IsOuterWindow()) {
win->EnsureInnerWindow();
}
nsCOMPtr<nsIDOMLocation> location;
rv = win->GetLocation(getter_AddRefs(location));
NS_ENSURE_SUCCESS(rv, rv);
// Make sure we wrap the location object in the inner window's
// scope if we've got an inner window.
// Make sure we wrap the location object in the window's scope.
JSObject *scope = nullptr;
if (win->IsOuterWindow()) {
nsGlobalWindow *innerWin = win->GetCurrentInnerWindowInternal();
if (innerWin) {
scope = innerWin->GetGlobalJSObject();
}
}
if (!scope) {
wrapper->GetJSObject(&scope);
}
wrapper->GetJSObject(&scope);
nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
jsval v;

View File

@ -1450,28 +1450,20 @@ nsGlobalWindow::EnsureScriptEnvironment()
nsresult rv = NS_GetJSRuntime(getter_AddRefs(scriptRuntime));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIScriptContext> context = scriptRuntime->CreateContext();
// If this window is a [i]frame, don't bother GC'ing when the frame's context
// is destroyed since a GC will happen when the frameset or host document is
// destroyed anyway.
nsCOMPtr<nsIScriptContext> context =
scriptRuntime->CreateContext(!IsFrame(), this);
NS_ASSERTION(!mContext, "Will overwrite mContext!");
// should probably assert the context is clean???
context->WillInitializeContext();
// We need point the context to the global window before initializing it
// so that it can make various decisions properly.
context->SetGlobalObject(this);
rv = context->InitContext();
NS_ENSURE_SUCCESS(rv, rv);
if (IsFrame()) {
// This window is a [i]frame, don't bother GC'ing when the
// frame's context is destroyed since a GC will happen when the
// frameset or host document is destroyed anyway.
context->SetGCOnDestruction(false);
}
mContext = context;
return NS_OK;
}

View File

@ -45,8 +45,8 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIScriptContextPrincipal,
NS_ISCRIPTCONTEXTPRINCIPAL_IID)
#define NS_ISCRIPTCONTEXT_IID \
{ 0x8bdcea47, 0x6704, 0x4dd9, \
{ 0xa1, 0x48, 0x05, 0x34, 0xcf, 0xe2, 0xdd, 0x57 } }
{ 0x95870c91, 0xe21d, 0x4499, \
{ 0x9b, 0x61, 0x45, 0x79, 0x5f, 0x12, 0x0c, 0x98 } }
/* This MUST match JSVERSION_DEFAULT. This version stuff if we don't
know what language we have is a little silly... */
@ -61,8 +61,6 @@ class nsIScriptContext : public nsIScriptContextPrincipal
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISCRIPTCONTEXT_IID)
virtual void SetGlobalObject(nsIScriptGlobalObject* aGlobalObject) = 0;
/**
* Compile and execute a script.
*
@ -335,12 +333,6 @@ public:
*/
virtual bool GetExecutingScript() = 0;
/**
* Tell the context whether or not to GC when destroyed. An optimization
* used when the window is a [i]frame, so GC will happen anyway.
*/
virtual void SetGCOnDestruction(bool aGCOnDestruction) = 0;
/**
* Initialize DOM classes on aGlobalObj, always call
* WillInitializeContext() before calling InitContext(), and always

View File

@ -8,8 +8,8 @@
#include "nsIScriptContext.h"
#define NS_ISCRIPTRUNTIME_IID \
{ 0xfa30d7a8, 0x7f0a, 0x437a, \
{ 0xa1, 0x0c, 0xc2, 0xbe, 0xa3, 0xdb, 0x4f, 0x4b } }
{ 0x41ded433, 0x83a5, 0x43fb, \
{ 0x85, 0xf4, 0x33, 0xba, 0x8f, 0xd1, 0x3f, 0xdc } }
/**
* A singleton language environment for an application. Responsible for
@ -22,7 +22,9 @@ public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISCRIPTRUNTIME_IID)
/* Factory for a new context for this language */
virtual already_AddRefed<nsIScriptContext> CreateContext() = 0;
virtual already_AddRefed<nsIScriptContext>
CreateContext(bool aGCOnDestruction,
nsIScriptGlobalObject* aGlobalObject) = 0;
/* Memory managment for script objects returned from various
* nsIScriptContext methods. These are identical to those in

View File

@ -1071,10 +1071,12 @@ nsJSContext::JSOptionChangedCallback(const char *pref, void *data)
return 0;
}
nsJSContext::nsJSContext(JSRuntime *aRuntime)
: mActive(false),
mGCOnDestruction(true),
mExecuteDepth(0)
nsJSContext::nsJSContext(JSRuntime *aRuntime, bool aGCOnDestruction,
nsIScriptGlobalObject* aGlobalObject)
: mActive(false)
, mGCOnDestruction(aGCOnDestruction)
, mExecuteDepth(0)
, mGlobalObjectRef(aGlobalObject)
{
mNext = sContextList;
mPrev = &sContextList;
@ -2841,12 +2843,6 @@ nsJSContext::GetExecutingScript()
return JS_IsRunning(mContext) || mExecuteDepth > 0;
}
void
nsJSContext::SetGCOnDestruction(bool aGCOnDestruction)
{
mGCOnDestruction = aGCOnDestruction;
}
NS_IMETHODIMP
nsJSContext::ScriptExecuted()
{
@ -3624,9 +3620,11 @@ NS_IMPL_ADDREF(nsJSRuntime)
NS_IMPL_RELEASE(nsJSRuntime)
already_AddRefed<nsIScriptContext>
nsJSRuntime::CreateContext()
nsJSRuntime::CreateContext(bool aGCOnDestruction,
nsIScriptGlobalObject* aGlobalObject)
{
nsCOMPtr<nsIScriptContext> scriptContext = new nsJSContext(sRuntime);
nsCOMPtr<nsIScriptContext> scriptContext =
new nsJSContext(sRuntime, aGCOnDestruction, aGlobalObject);
return scriptContext.forget();
}

View File

@ -34,7 +34,8 @@ class nsJSContext : public nsIScriptContext,
public nsIXPCScriptNotify
{
public:
nsJSContext(JSRuntime *aRuntime);
nsJSContext(JSRuntime* aRuntime, bool aGCOnDestruction,
nsIScriptGlobalObject* aGlobalObject);
virtual ~nsJSContext();
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
@ -43,11 +44,6 @@ public:
virtual nsIScriptObjectPrincipal* GetObjectPrincipal();
virtual void SetGlobalObject(nsIScriptGlobalObject* aGlobalObject)
{
mGlobalObjectRef = aGlobalObject;
}
virtual nsresult EvaluateString(const nsAString& aScript,
JSObject* aScopeObject,
nsIPrincipal *principal,
@ -124,8 +120,6 @@ public:
virtual bool GetExecutingScript();
virtual void SetGCOnDestruction(bool aGCOnDestruction);
virtual nsresult InitClasses(JSObject* aGlobalObj);
virtual void WillInitializeContext();
@ -314,7 +308,9 @@ public:
// nsISupports
NS_DECL_ISUPPORTS
virtual already_AddRefed<nsIScriptContext> CreateContext();
virtual already_AddRefed<nsIScriptContext>
CreateContext(bool aGCOnDestruction,
nsIScriptGlobalObject* aGlobalObject);
virtual nsresult DropScriptObject(void *object);
virtual nsresult HoldScriptObject(void *object);

View File

@ -10,6 +10,8 @@ Note: removes both source and destination directory before starting. Do not
use with outstanding changes in either directory.
"""
from __future__ import print_function, unicode_literals
import os
import shutil
import subprocess
@ -32,7 +34,7 @@ def getData(confFile):
dest = ""
directories = []
try:
fp = open(confFile, "rb")
fp = open(confFile, "r")
first = True
for line in fp:
if first:
@ -56,7 +58,7 @@ def copy(thissrcdir, dest, directories):
"""Copy mochitests and support files from the external HG directory to their
place in mozilla-central.
"""
print "Copying %s..." % (directories, )
print("Copying %s..." % directories)
for d in directories:
subdirs, mochitests, supportfiles = parseManifestFile(dest, d)
sourcedir = makePath("hg-%s" % dest, d)
@ -79,9 +81,9 @@ def printMakefile(dest, directories):
"""Create a .mk file to be included into the main Makefile.in, which lists the
directories with tests.
"""
print "Creating .mk..."
print("Creating .mk...")
path = dest + ".mk"
fp = open(path, "wb")
fp = open(path, "w")
fp.write("DIRS += \\\n")
fp.write(writeMakefile.makefileString([makePath(dest, d) for d in directories]))
fp.write("\n")
@ -91,14 +93,10 @@ def printMakefile(dest, directories):
def printMakefiles(thissrcdir, dest, directories):
"""Create Makefile.in files for each directory that contains tests we import.
"""
print "Creating Makefile.ins..."
print("Creating Makefile.ins...")
for d in directories:
if d:
path = "%s/%s" % (dest, d)
else:
# Empty directory, i.e., the repository root
path = dest
print "Creating Makefile.in in %s..." % (path, )
path = makePath(dest, d)
print("Creating Makefile.in in %s..." % path)
subdirs, mochitests, supportfiles = parseManifestFile(dest, d)
@ -107,13 +105,13 @@ def printMakefiles(thissrcdir, dest, directories):
result = writeMakefile.substMakefile("importTestsuite.py", subdirs, files)
fp = open(path + "/Makefile.in", "wb")
fp = open(path + "/Makefile.in", "w")
fp.write(result)
fp.close()
def hgadd(dest, directories):
"""Inform hg of the files in |directories|."""
print "hg addremoving..."
print("hg addremoving...")
for d in directories:
subprocess.check_call(["hg", "addremove", "%s/%s" % (dest, d)])
@ -125,26 +123,26 @@ def importRepo(confFile, thissrcdir):
try:
repo, dest, directories = getData(confFile)
hgdest = "hg-%s" % (dest, )
print "Going to clone %s to %s..." % (repo, hgdest)
print "Removing %s..." % dest
print("Going to clone %s to %s..." % (repo, hgdest))
print("Removing %s..." % dest)
subprocess.check_call(["rm", "--recursive", "--force", dest])
print "Removing %s..." % hgdest
print("Removing %s..." % hgdest)
subprocess.check_call(["rm", "--recursive", "--force", hgdest])
print "Cloning %s to %s..." % (repo, hgdest)
print("Cloning %s to %s..." % (repo, hgdest))
subprocess.check_call(["hg", "clone", repo, hgdest])
print "Going to import %s..." % (directories, )
print("Going to import %s..." % directories)
importDirs(thissrcdir, dest, directories)
printMakefile(dest, directories)
hgadd(dest, directories)
print "Removing %s again..." % hgdest
print("Removing %s again..." % hgdest)
subprocess.check_call(["rm", "--recursive", "--force", hgdest])
except subprocess.CalledProcessError, e:
print e.returncode
except subprocess.CalledProcessError as e:
print(e.returncode)
finally:
print "Done"
print("Done")
if __name__ == "__main__":
if len(sys.argv) != 2:
print "Need one argument."
print("Need one argument.")
else:
importRepo(sys.argv[1], "dom/imptests")

View File

@ -2,10 +2,12 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import print_function, unicode_literals
import collections
import json
import os
import sys
import collections
import writeMakefile
@ -54,15 +56,15 @@ def writeMakefiles(files):
dirp, leaf = path.rsplit('/', 1)
pathmap.setdefault(dirp, []).append(leaf)
for k, v in pathmap.iteritems():
for k, v in pathmap.items():
result = writeMakefile.substMakefile('parseFailures.py', [], v)
fp = open(k + '/Makefile.in', 'wb')
fp = open(k + '/Makefile.in', 'w')
fp.write(result)
fp.close()
def main(logPath):
fp = open(logPath, 'rb')
fp = open(logPath, 'r')
lines = extractLines(fp)
fp.close()
@ -71,5 +73,5 @@ def main(logPath):
if __name__ == '__main__':
if len(sys.argv) < 2:
print "Please pass the path to the logfile from which failures should be extracted."
print("Please pass the path to the logfile from which failures should be extracted.")
main(sys.argv[1])

View File

@ -3,6 +3,8 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import unicode_literals
import subprocess
repo = "https://dvcs.w3.org/hg/resources"

View File

@ -2,6 +2,8 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
from __future__ import unicode_literals
import string
makefileTemplate = """# THIS FILE IS AUTOGENERATED BY ${caller} - DO NOT EDIT

View File

@ -867,7 +867,6 @@ JSRuntime::JSRuntime(JSUseHelperThreads useHelperThreads)
useHelperThreads_(useHelperThreads)
{
/* Initialize infallibly first, so we can goto bad and JS_DestroyRuntime. */
JS_INIT_CLIST(&contextList);
JS_INIT_CLIST(&debuggerList);
JS_INIT_CLIST(&onNewGlobalObjectWatchers);
@ -975,7 +974,7 @@ JSRuntime::~JSRuntime()
#ifdef DEBUG
/* Don't hurt everyone in leaky ol' Mozilla with a fatal JS_ASSERT! */
if (!JS_CLIST_IS_EMPTY(&contextList)) {
if (hasContexts()) {
unsigned cxcount = 0;
for (ContextIter acx(this); !acx.done(); acx.next()) {
fprintf(stderr,
@ -1271,8 +1270,7 @@ JS_PUBLIC_API(JSContext *)
JS_ContextIterator(JSRuntime *rt, JSContext **iterp)
{
JSContext *cx = *iterp;
JSCList *next = cx ? cx->link.next : rt->contextList.next;
cx = (next == &rt->contextList) ? NULL : JSContext::fromLinkField(next);
cx = cx ? cx->getNext() : rt->contextList.getFirst();
*iterp = cx;
return cx;
}

View File

@ -440,8 +440,8 @@ js::NewContext(JSRuntime *rt, size_t stackChunkSize)
* Here the GC lock is still held after js_InitContextThreadAndLockGC took it and
* the GC is not running on another thread.
*/
bool first = JS_CLIST_IS_EMPTY(&rt->contextList);
JS_APPEND_LINK(&cx->link, &rt->contextList);
bool first = rt->contextList.isEmpty();
rt->contextList.insertBack(cx);
js_InitRandom(cx);
@ -503,7 +503,7 @@ js::DestroyContext(JSContext *cx, DestroyContextMode mode)
}
}
JS_REMOVE_LINK(&cx->link);
cx->remove();
bool last = !rt->hasContexts();
if (last) {
JS_ASSERT(!rt->isHeapBusy());
@ -1304,7 +1304,6 @@ JSContext::JSContext(JSRuntime *rt)
#endif
activeCompilations(0)
{
PodZero(&link);
#ifdef JSGC_ROOT_ANALYSIS
PodArrayZero(thingGCRooters);
#if defined(JS_GC_ZEAL) && defined(DEBUG) && !defined(JS_THREADSAFE)

View File

@ -11,6 +11,7 @@
#define jscntxt_h___
#include "mozilla/Attributes.h"
#include "mozilla/LinkedList.h"
#include <string.h>
@ -781,10 +782,10 @@ struct JSRuntime : js::RuntimeFriendFields
js::PropertyName *emptyString;
/* List of active contexts sharing this runtime. */
JSCList contextList;
mozilla::LinkedList<JSContext> contextList;
bool hasContexts() const {
return !JS_CLIST_IS_EMPTY(&contextList);
return !contextList.isEmpty();
}
JS_SourceHook sourceHook;
@ -1233,15 +1234,13 @@ FreeOp::free_(void* p) {
} /* namespace js */
struct JSContext : js::ContextFriendFields
struct JSContext : js::ContextFriendFields,
public mozilla::LinkedListElement<JSContext>
{
explicit JSContext(JSRuntime *rt);
JSContext *thisDuringConstruction() { return this; }
~JSContext();
/* JSRuntime contextList linkage. */
JSCList link;
private:
/* See JSContext::findVersion. */
JSVersion defaultVersion; /* script compilation version */
@ -1601,11 +1600,6 @@ struct JSContext : js::ContextFriendFields
JS_FRIEND_API(size_t) sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) const;
static inline JSContext *fromLinkField(JSCList *link) {
JS_ASSERT(link);
return reinterpret_cast<JSContext *>(uintptr_t(link) - offsetof(JSContext, link));
}
void mark(JSTracer *trc);
private:
@ -1823,27 +1817,25 @@ namespace js {
* Enumerate all contexts in a runtime.
*/
class ContextIter {
JSCList *begin;
JSCList *end;
JSContext *iter;
public:
explicit ContextIter(JSRuntime *rt) {
end = &rt->contextList;
begin = end->next;
iter = rt->contextList.getFirst();
}
bool done() const {
return begin == end;
return !iter;
}
void next() {
JS_ASSERT(!done());
begin = begin->next;
iter = iter->getNext();
}
JSContext *get() const {
JS_ASSERT(!done());
return JSContext::fromLinkField(begin);
return iter;
}
operator JSContext *() const {

View File

@ -525,7 +525,7 @@ js_InitRandom(JSContext *cx)
* the context and its successor. We don't just use the context because it might be
* possible to reverse engineer the context pointer if one guesses the time right.
*/
random_setSeed(&cx->rngSeed, (PRMJ_Now() / 1000) ^ int64_t(cx) ^ int64_t(cx->link.next));
random_setSeed(&cx->rngSeed, (PRMJ_Now() / 1000) ^ int64_t(cx) ^ int64_t(cx->getNext()));
}
extern uint64_t

View File

@ -514,16 +514,6 @@ nsIDOMStorage_Clear_customMethodCallCode = """
JS_ClearNonGlobalObject(cx, obj);
"""
CUSTOM_QS = {
'skipgen': True,
'traceable': False
}
CUSTOM_QS_TN = {
'skipgen': True,
'traceable': True
}
customMethodCalls = {
'nsIDOMNode_GetNextSibling': {
'thisType': 'nsINode',

View File

@ -180,7 +180,7 @@ def addStubMember(memberId, member):
# Add this member to the list.
member.iface.stubMembers.append(member)
def checkStubMember(member, isCustom):
def checkStubMember(member):
memberId = member.iface.name + "." + member.name
if member.kind not in ('method', 'attribute'):
raise UserError("Member %s is %r, not a method or attribute."
@ -195,8 +195,7 @@ def checkStubMember(member, isCustom):
if (member.kind == 'attribute'
and not member.readonly
and isSpecificInterfaceType(member.realtype, 'nsIVariant')
and not isCustom):
and isSpecificInterfaceType(member.realtype, 'nsIVariant')):
raise UserError(
"Attribute %s: Non-readonly attributes of type nsIVariant "
"are not supported."
@ -233,7 +232,6 @@ class Configuration:
# optional settings
self.irregularFilenames = config.get('irregularFilenames', {})
self.customIncludes = config.get('customIncludes', [])
self.customQuickStubs = config.get('customQuickStubs', [])
self.customReturnInterfaces = config.get('customReturnInterfaces', [])
self.customMethodCalls = config.get('customMethodCalls', {})
@ -317,9 +315,7 @@ def readConfigFile(filename, includePath, cachedir):
# Now go through and check all the interfaces' members
for iface in stubbedInterfaces:
for member in iface.stubMembers:
cmc = conf.customMethodCalls.get(iface.name + "_" + header.methodNativeName(member), None)
skipgen = cmc is not None and cmc.get('skipgen', False)
checkStubMember(member, skipgen)
checkStubMember(member)
for iface in conf.customReturnInterfaces:
# just ensure that it exists so that we can grab it later
@ -1029,20 +1025,15 @@ def writeQuickStub(f, customMethodCalls, member, stubName, isSetter=False):
f.write(callTemplate)
def writeAttrStubs(f, customMethodCalls, stringtable, attr):
cmc = customMethodCalls.get(attr.iface.name + "_" + header.methodNativeName(attr), None)
custom = cmc and cmc.get('skipgen', False)
getterName = (attr.iface.name + '_'
+ header.attributeNativeName(attr, True))
if not custom:
writeQuickStub(f, customMethodCalls, attr, getterName)
writeQuickStub(f, customMethodCalls, attr, getterName)
if attr.readonly:
setterName = 'xpc_qsGetterOnlyPropertyStub'
else:
setterName = (attr.iface.name + '_'
+ header.attributeNativeName(attr, False))
if not custom:
writeQuickStub(f, customMethodCalls, attr, setterName, isSetter=True)
writeQuickStub(f, customMethodCalls, attr, setterName, isSetter=True)
ps = ('{%d, %s, %s}'
% (stringtable.stringIndex(attr.name), getterName, setterName))
@ -1051,12 +1042,8 @@ def writeAttrStubs(f, customMethodCalls, stringtable, attr):
def writeMethodStub(f, customMethodCalls, stringtable, method):
""" Write a method stub to `f`. Return an xpc_qsFunctionSpec initializer. """
cmc = customMethodCalls.get(method.iface.name + "_" + header.methodNativeName(method), None)
custom = cmc and cmc.get('skipgen', False)
stubName = method.iface.name + '_' + header.methodNativeName(method)
if not custom:
writeQuickStub(f, customMethodCalls, method, stubName)
writeQuickStub(f, customMethodCalls, method, stubName)
fs = '{%d, %d, %s}' % (stringtable.stringIndex(method.name),
len(method.params), stubName)
return fs
@ -1305,8 +1292,6 @@ def writeStubFile(filename, headerFilename, conf, interfaces):
f.write('#include "%s"\n' % customInclude)
f.write("\n\n")
writeResultXPCInterfacesArray(f, conf, frozenset(resulttypes))
for customQS in conf.customQuickStubs:
f.write('#include "%s"\n' % customQS)
stringtable = StringTable()
for iface in interfaces:
writeStubsForInterface(f, conf.customMethodCalls, stringtable, iface)

View File

@ -35,8 +35,9 @@
#include "nsPIWindowRoot.h"
#include "nsFrameManager.h"
#include "nsIObserverService.h"
#include "mozilla/Services.h"
#include "mozilla/dom/Element.h"
#include "mozilla/LookAndFeel.h"
#include "mozilla/Services.h"
using namespace mozilla;
@ -1612,9 +1613,10 @@ nsXULPopupManager::UpdateMenuItems(nsIContent* aPopup)
// Walk all of the menu's children, checking to see if any of them has a
// command attribute. If so, then several attributes must potentially be updated.
nsCOMPtr<nsIDOMDocument> domDoc(do_QueryInterface(aPopup->GetDocument()));
if (!domDoc)
nsCOMPtr<nsIDocument> document = aPopup->GetCurrentDoc();
if (!document) {
return;
}
for (nsCOMPtr<nsIContent> grandChild = aPopup->GetFirstChild();
grandChild;
@ -1625,13 +1627,12 @@ nsXULPopupManager::UpdateMenuItems(nsIContent* aPopup)
grandChild->GetAttr(kNameSpaceID_None, nsGkAtoms::command, command);
if (!command.IsEmpty()) {
// We do! Look it up in our document
nsCOMPtr<nsIDOMElement> commandElt;
domDoc->GetElementById(command, getter_AddRefs(commandElt));
nsCOMPtr<nsIContent> commandContent(do_QueryInterface(commandElt));
if (commandContent) {
nsRefPtr<dom::Element> commandElement =
document->GetElementById(command);
if (commandElement) {
nsAutoString commandValue;
// The menu's disabled state needs to be updated to match the command.
if (commandContent->GetAttr(kNameSpaceID_None, nsGkAtoms::disabled, commandValue))
if (commandElement->GetAttr(kNameSpaceID_None, nsGkAtoms::disabled, commandValue))
grandChild->SetAttr(kNameSpaceID_None, nsGkAtoms::disabled, commandValue, true);
else
grandChild->UnsetAttr(kNameSpaceID_None, nsGkAtoms::disabled, true);
@ -1639,16 +1640,16 @@ nsXULPopupManager::UpdateMenuItems(nsIContent* aPopup)
// The menu's label, accesskey checked and hidden states need to be updated
// to match the command. Note that unlike the disabled state if the
// command has *no* value, we assume the menu is supplying its own.
if (commandContent->GetAttr(kNameSpaceID_None, nsGkAtoms::label, commandValue))
if (commandElement->GetAttr(kNameSpaceID_None, nsGkAtoms::label, commandValue))
grandChild->SetAttr(kNameSpaceID_None, nsGkAtoms::label, commandValue, true);
if (commandContent->GetAttr(kNameSpaceID_None, nsGkAtoms::accesskey, commandValue))
if (commandElement->GetAttr(kNameSpaceID_None, nsGkAtoms::accesskey, commandValue))
grandChild->SetAttr(kNameSpaceID_None, nsGkAtoms::accesskey, commandValue, true);
if (commandContent->GetAttr(kNameSpaceID_None, nsGkAtoms::checked, commandValue))
if (commandElement->GetAttr(kNameSpaceID_None, nsGkAtoms::checked, commandValue))
grandChild->SetAttr(kNameSpaceID_None, nsGkAtoms::checked, commandValue, true);
if (commandContent->GetAttr(kNameSpaceID_None, nsGkAtoms::hidden, commandValue))
if (commandElement->GetAttr(kNameSpaceID_None, nsGkAtoms::hidden, commandValue))
grandChild->SetAttr(kNameSpaceID_None, nsGkAtoms::hidden, commandValue, true);
}
}