mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-14 02:31:59 +00:00
Backed out changeset 9035e4de3c03 (bug 1117851
) for suspicion of causing Linux32 dromaeo DOM regressions (bug 1118257).
This commit is contained in:
parent
caec1fe4eb
commit
dadc725623
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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!");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user