Backed out changeset 9035e4de3c03 (bug 1117851) for suspicion of causing Linux32 dromaeo DOM regressions (bug 1118257).

This commit is contained in:
Ryan VanderMeulen 2015-01-06 15:24:45 -05:00
parent caec1fe4eb
commit dadc725623
7 changed files with 47 additions and 25 deletions

View File

@ -201,7 +201,11 @@ EventSource::Init(nsISupports* aOwner,
// The conditional here is historical and not necessarily sane.
if (JSContext *cx = nsContentUtils::GetCurrentJSContext()) {
nsJSUtils::GetCallingLocation(cx, mScriptFile, &mScriptLine);
const char *filename;
if (nsJSUtils::GetCallingLocation(cx, &filename, &mScriptLine)) {
mScriptFile.AssignASCII(filename);
}
mInnerWindowID = nsJSUtils::GetCurrentlyRunningCodeInnerWindowID(cx);
}

View File

@ -3364,7 +3364,12 @@ nsContentUtils::ReportToConsoleNonLocalized(const nsAString& aErrorText,
if (!aLineNumber) {
JSContext *cx = GetCurrentJSContext();
if (cx) {
nsJSUtils::GetCallingLocation(cx, spec, &aLineNumber);
const char* filename;
uint32_t lineno;
if (nsJSUtils::GetCallingLocation(cx, &filename, &lineno)) {
spec = filename;
aLineNumber = lineno;
}
}
}
if (spec.IsEmpty() && aURI)

View File

@ -173,8 +173,11 @@ CheckCSPForEval(JSContext* aCx, nsGlobalWindow* aWindow, ErrorResult& aError)
// Get the calling location.
uint32_t lineNum = 0;
const char *fileName;
nsAutoString fileNameString;
if (!nsJSUtils::GetCallingLocation(aCx, fileNameString, &lineNum)) {
if (nsJSUtils::GetCallingLocation(aCx, &fileName, &lineNum)) {
AppendUTF8toUTF16(fileName, fileNameString);
} else {
fileNameString.AssignLiteral("unknown");
}
@ -230,7 +233,10 @@ nsJSScriptTimeoutHandler::nsJSScriptTimeoutHandler(JSContext* aCx,
}
// Get the calling location.
nsJSUtils::GetCallingLocation(aCx, mFileName, &mLineNo);
const char *filename;
if (nsJSUtils::GetCallingLocation(aCx, &filename, &mLineNo)) {
mFileName.Assign(filename);
}
}
nsJSScriptTimeoutHandler::~nsJSScriptTimeoutHandler()
@ -347,7 +353,10 @@ nsJSScriptTimeoutHandler::Init(nsGlobalWindow *aWindow, bool *aIsInterval,
AssignJSFlatString(mExpr, expr);
// Get the calling location.
nsJSUtils::GetCallingLocation(cx, mFileName, &mLineNo);
const char *filename;
if (nsJSUtils::GetCallingLocation(cx, &filename, &mLineNo)) {
mFileName.Assign(filename);
}
} else if (funobj) {
*aAllowEval = true;

View File

@ -34,28 +34,19 @@
using namespace mozilla::dom;
bool
nsJSUtils::GetCallingLocation(JSContext* aContext, nsACString& aFilename,
nsJSUtils::GetCallingLocation(JSContext* aContext, const char* *aFilename,
uint32_t* aLineno)
{
JS::AutoFilename filename;
if (!JS::DescribeScriptedCaller(aContext, &filename, aLineno)) {
unsigned lineno = 0;
if (!JS::DescribeScriptedCaller(aContext, &filename, &lineno)) {
return false;
}
aFilename.Assign(filename.get());
return true;
}
*aFilename = filename.get();
*aLineno = lineno;
bool
nsJSUtils::GetCallingLocation(JSContext* aContext, nsAString& aFilename,
uint32_t* aLineno)
{
JS::AutoFilename filename;
if (!JS::DescribeScriptedCaller(aContext, &filename, aLineno)) {
return false;
}
aFilename.Assign(NS_ConvertUTF8toUTF16(filename.get()));
return true;
}

View File

@ -32,9 +32,7 @@ class Element;
class nsJSUtils
{
public:
static bool GetCallingLocation(JSContext* aContext, nsACString& aFilename,
uint32_t* aLineno);
static bool GetCallingLocation(JSContext* aContext, nsAString& aFilename,
static bool GetCallingLocation(JSContext* aContext, const char* *aFilename,
uint32_t* aLineno);
static nsIScriptGlobalObject *GetStaticScriptGlobal(JSObject* aObj);

View File

@ -168,7 +168,16 @@ IDBRequest::CaptureCaller(nsAString& aFilename, uint32_t* aLineNo)
MOZ_ASSERT(aLineNo);
ThreadsafeAutoJSContext cx;
nsJSUtils::GetCallingLocation(cx, aFilename, aLineNo);
const char* filename = nullptr;
uint32_t lineNo = 0;
if (!nsJSUtils::GetCallingLocation(cx, &filename, &lineNo)) {
*aLineNo = 0;
return;
}
aFilename.Assign(NS_ConvertUTF8toUTF16(filename));
*aLineNo = lineNo;
}
void

View File

@ -5702,7 +5702,13 @@ WorkerPrivate::SetTimeout(JSContext* aCx,
newInfo->mTargetTime = TimeStamp::Now() + newInfo->mInterval;
if (!newInfo->mTimeoutString.IsEmpty()) {
if (!nsJSUtils::GetCallingLocation(aCx, newInfo->mFilename, &newInfo->mLineNumber)) {
const char* filenameChars;
uint32_t lineNumber;
if (nsJSUtils::GetCallingLocation(aCx, &filenameChars, &lineNumber)) {
newInfo->mFilename = filenameChars;
newInfo->mLineNumber = lineNumber;
}
else {
NS_WARNING("Failed to get calling location!");
}
}