зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1847469 - Part 23: Use uint32_t for line and column in DescribeScriptedCaller* functions as a preparation to use column number types. r=iain
Differential Revision: https://phabricator.services.mozilla.com/D185761
This commit is contained in:
Родитель
42fee3cf02
Коммит
f61ba91ee2
|
@ -531,8 +531,8 @@ bool nsScriptSecurityManager::ContentSecurityPolicyPermitsJSAction(
|
|||
if (reportViolation) {
|
||||
JS::AutoFilename scriptFilename;
|
||||
nsAutoString fileName;
|
||||
unsigned lineNum = 0;
|
||||
unsigned columnNum = 0;
|
||||
uint32_t lineNum = 0;
|
||||
uint32_t columnNum = 0;
|
||||
if (JS::DescribeScriptedCaller(cx, &scriptFilename, &lineNum, &columnNum)) {
|
||||
if (const char* file = scriptFilename.get()) {
|
||||
CopyUTF8toUTF16(nsDependentCString(file), fileName);
|
||||
|
|
|
@ -5045,14 +5045,14 @@ nsGlobalWindowInner::ShowSlowScriptDialog(JSContext* aCx,
|
|||
|
||||
// Check if we should offer the option to debug
|
||||
JS::AutoFilename filename;
|
||||
unsigned lineno;
|
||||
uint32_t lineno;
|
||||
// Computing the line number can be very expensive (see bug 1330231 for
|
||||
// example), and we don't use the line number anywhere except than in the
|
||||
// parent process, so we avoid computing it elsewhere. This gives us most of
|
||||
// the wins we are interested in, since the source of the slowness here is
|
||||
// minified scripts which is more common in Web content that is loaded in the
|
||||
// content process.
|
||||
unsigned* linenop = XRE_IsParentProcess() ? &lineno : nullptr;
|
||||
uint32_t* linenop = XRE_IsParentProcess() ? &lineno : nullptr;
|
||||
bool hasFrame = JS::DescribeScriptedCaller(aCx, &filename, linenop);
|
||||
|
||||
// Record the slow script event if we haven't done so already for this inner
|
||||
|
|
|
@ -978,8 +978,8 @@ nsresult EventListenerManager::SetEventHandler(nsAtom* aName,
|
|||
|
||||
// Perform CSP check
|
||||
nsCOMPtr<nsIContentSecurityPolicy> csp = doc->GetCsp();
|
||||
unsigned lineNum = 0;
|
||||
unsigned columnNum = 0;
|
||||
uint32_t lineNum = 0;
|
||||
uint32_t columnNum = 0;
|
||||
|
||||
JSContext* cx = nsContentUtils::GetCurrentJSContext();
|
||||
if (cx && !JS::DescribeScriptedCaller(cx, nullptr, &lineNum, &columnNum)) {
|
||||
|
|
|
@ -289,8 +289,8 @@ static bool AssertParentProcessWithCallerLocationImpl(GlobalObject& aGlobal,
|
|||
JSContext* cx = jsapi.cx();
|
||||
|
||||
JS::AutoFilename scriptFilename;
|
||||
unsigned lineNo = 0;
|
||||
unsigned colNo = 0;
|
||||
uint32_t lineNo = 0;
|
||||
uint32_t colNo = 0;
|
||||
|
||||
NS_ENSURE_TRUE(
|
||||
JS::DescribeScriptedCaller(cx, &scriptFilename, &lineNo, &colNo), false);
|
||||
|
|
|
@ -1371,7 +1371,7 @@ already_AddRefed<WebSocket> WebSocket::ConstructorCommon(
|
|||
WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
|
||||
MOZ_ASSERT(workerPrivate);
|
||||
|
||||
unsigned lineno, column;
|
||||
uint32_t lineno, column;
|
||||
JS::AutoFilename file;
|
||||
if (!JS::DescribeScriptedCaller(aGlobal.Context(), &file, &lineno,
|
||||
&column)) {
|
||||
|
@ -1608,7 +1608,7 @@ nsresult WebSocketImpl::Init(JSContext* aCx, bool aIsSecure,
|
|||
} else {
|
||||
MOZ_ASSERT(aCx);
|
||||
|
||||
unsigned lineno, column;
|
||||
uint32_t lineno, column;
|
||||
JS::AutoFilename file;
|
||||
if (JS::DescribeScriptedCaller(aCx, &file, &lineno, &column)) {
|
||||
mScriptFile = file.get();
|
||||
|
|
|
@ -276,7 +276,7 @@ static bool EvalKernel(JSContext* cx, HandleValue v, EvalType evalType,
|
|||
|
||||
if (!esg.foundScript()) {
|
||||
RootedScript maybeScript(cx);
|
||||
unsigned lineno;
|
||||
uint32_t lineno;
|
||||
const char* filename;
|
||||
bool mutedErrors;
|
||||
uint32_t pcOffset;
|
||||
|
|
|
@ -232,7 +232,7 @@ static bool PerformShadowRealmEval(JSContext* cx, Handle<JSString*> sourceText,
|
|||
// https://bugzilla.mozilla.org/show_bug.cgi?id=1770017
|
||||
RootedScript callerScript(cx);
|
||||
const char* filename;
|
||||
unsigned lineno;
|
||||
uint32_t lineno;
|
||||
uint32_t pcOffset;
|
||||
bool mutedErrors;
|
||||
DescribeScriptedCallerForCompilation(cx, &callerScript, &filename, &lineno,
|
||||
|
@ -419,7 +419,7 @@ static JSObject* ShadowRealmImportValue(JSContext* cx,
|
|||
// Not Speced: Get referencing private to pass to importHook.
|
||||
RootedScript script(cx);
|
||||
const char* filename;
|
||||
unsigned lineno;
|
||||
uint32_t lineno;
|
||||
uint32_t pcOffset;
|
||||
bool mutedErrors;
|
||||
DescribeScriptedCallerForCompilation(cx, &script, &filename, &lineno,
|
||||
|
|
|
@ -6661,7 +6661,7 @@ static bool EvalReturningScope(JSContext* cx, unsigned argc, Value* vp) {
|
|||
}
|
||||
|
||||
JS::AutoFilename filename;
|
||||
unsigned lineno;
|
||||
uint32_t lineno;
|
||||
|
||||
JS::DescribeScriptedCaller(cx, &filename, &lineno);
|
||||
|
||||
|
|
|
@ -2462,7 +2462,7 @@ CompileOptions& CompileOptions::setIntroductionInfoToCaller(
|
|||
MutableHandle<JSScript*> introductionScript) {
|
||||
RootedScript maybeScript(cx);
|
||||
const char* filename;
|
||||
unsigned lineno;
|
||||
uint32_t lineno;
|
||||
uint32_t pcOffset;
|
||||
bool mutedErrors;
|
||||
DescribeScriptedCallerForCompilation(cx, &maybeScript, &filename, &lineno,
|
||||
|
@ -4524,7 +4524,7 @@ const char* AutoFilename::get() const {
|
|||
}
|
||||
|
||||
JS_PUBLIC_API bool DescribeScriptedCaller(JSContext* cx, AutoFilename* filename,
|
||||
unsigned* lineno, unsigned* column) {
|
||||
uint32_t* lineno, uint32_t* column) {
|
||||
if (filename) {
|
||||
filename->reset();
|
||||
}
|
||||
|
|
|
@ -933,8 +933,8 @@ class MOZ_RAII JS_PUBLIC_API AutoFilename {
|
|||
* record, this will also return false.
|
||||
*/
|
||||
extern JS_PUBLIC_API bool DescribeScriptedCaller(
|
||||
JSContext* cx, AutoFilename* filename = nullptr, unsigned* lineno = nullptr,
|
||||
unsigned* column = nullptr);
|
||||
JSContext* cx, AutoFilename* filename = nullptr, uint32_t* lineno = nullptr,
|
||||
uint32_t* column = nullptr);
|
||||
|
||||
extern JS_PUBLIC_API JSObject* GetScriptedCallerGlobal(JSContext* cx);
|
||||
|
||||
|
|
|
@ -4144,7 +4144,7 @@ static bool EvalInContext(JSContext* cx, unsigned argc, Value* vp) {
|
|||
}
|
||||
|
||||
JS::AutoFilename filename;
|
||||
unsigned lineno;
|
||||
uint32_t lineno;
|
||||
|
||||
DescribeScriptedCaller(cx, &filename, &lineno);
|
||||
{
|
||||
|
|
|
@ -1192,7 +1192,7 @@ static bool CreateDynamicFunction(JSContext* cx, const CallArgs& args,
|
|||
|
||||
RootedScript maybeScript(cx);
|
||||
const char* filename;
|
||||
unsigned lineno;
|
||||
uint32_t lineno;
|
||||
bool mutedErrors;
|
||||
uint32_t pcOffset;
|
||||
DescribeScriptedCallerForCompilation(cx, &maybeScript, &filename, &lineno,
|
||||
|
|
|
@ -1872,7 +1872,7 @@ template bool ScriptSource::initializeUnretrievableUncompressedSource(
|
|||
// For example:
|
||||
// foo.js line 7 > eval
|
||||
// indicating code compiled by the call to 'eval' on line 7 of foo.js.
|
||||
UniqueChars js::FormatIntroducedFilename(const char* filename, unsigned lineno,
|
||||
UniqueChars js::FormatIntroducedFilename(const char* filename, uint32_t lineno,
|
||||
const char* introducer) {
|
||||
// Compute the length of the string in advance, so we can allocate a
|
||||
// buffer of the right size on the first shot.
|
||||
|
@ -2844,7 +2844,7 @@ void js::maybeSpewScriptFinalWarmUpCount(JSScript* script) {
|
|||
|
||||
void js::DescribeScriptedCallerForDirectEval(JSContext* cx, HandleScript script,
|
||||
jsbytecode* pc, const char** file,
|
||||
unsigned* linenop,
|
||||
uint32_t* linenop,
|
||||
uint32_t* pcOffset,
|
||||
bool* mutedErrors) {
|
||||
MOZ_ASSERT(script->containsPC(pc));
|
||||
|
@ -2872,7 +2872,7 @@ void js::DescribeScriptedCallerForDirectEval(JSContext* cx, HandleScript script,
|
|||
|
||||
void js::DescribeScriptedCallerForCompilation(
|
||||
JSContext* cx, MutableHandleScript maybeScript, const char** file,
|
||||
unsigned* linenop, uint32_t* pcOffset, bool* mutedErrors) {
|
||||
uint32_t* linenop, uint32_t* pcOffset, bool* mutedErrors) {
|
||||
NonBuiltinFrameIter iter(cx, cx->realm()->principals());
|
||||
|
||||
if (iter.done()) {
|
||||
|
|
|
@ -2209,7 +2209,7 @@ struct ScriptAndCounts {
|
|||
};
|
||||
|
||||
extern JS::UniqueChars FormatIntroducedFilename(const char* filename,
|
||||
unsigned lineno,
|
||||
uint32_t lineno,
|
||||
const char* introducer);
|
||||
|
||||
struct GSNCache;
|
||||
|
@ -2250,7 +2250,7 @@ extern unsigned PCToLineNumber(
|
|||
*/
|
||||
extern void DescribeScriptedCallerForCompilation(
|
||||
JSContext* cx, MutableHandleScript maybeScript, const char** file,
|
||||
unsigned* linenop, uint32_t* pcOffset, bool* mutedErrors);
|
||||
uint32_t* linenop, uint32_t* pcOffset, bool* mutedErrors);
|
||||
|
||||
/*
|
||||
* Like DescribeScriptedCallerForCompilation, but this function avoids looking
|
||||
|
@ -2258,7 +2258,7 @@ extern void DescribeScriptedCallerForCompilation(
|
|||
*/
|
||||
extern void DescribeScriptedCallerForDirectEval(
|
||||
JSContext* cx, HandleScript script, jsbytecode* pc, const char** file,
|
||||
unsigned* linenop, uint32_t* pcOffset, bool* mutedErrors);
|
||||
uint32_t* linenop, uint32_t* pcOffset, bool* mutedErrors);
|
||||
|
||||
bool CheckCompileOptionsMatch(const JS::ReadOnlyCompileOptions& options,
|
||||
js::ImmutableScriptFlags flags);
|
||||
|
|
|
@ -111,7 +111,7 @@ struct FeatureArgs {
|
|||
struct ScriptedCaller {
|
||||
UniqueChars filename; // UTF-8 encoded
|
||||
bool filenameIsURL;
|
||||
unsigned line;
|
||||
uint32_t line;
|
||||
|
||||
ScriptedCaller() : filenameIsURL(false), line(0) {}
|
||||
};
|
||||
|
|
|
@ -4208,7 +4208,7 @@ static bool Reject(JSContext* cx, const CompileArgs& args,
|
|||
return false;
|
||||
}
|
||||
|
||||
unsigned line = args.scriptedCaller.line;
|
||||
uint32_t line = args.scriptedCaller.line;
|
||||
|
||||
// Ideally we'd report a JSMSG_WASM_COMPILE_ERROR here, but there's no easy
|
||||
// way to create an ErrorObject for an arbitrary error code with multiple
|
||||
|
|
|
@ -217,7 +217,7 @@ bool ReportWrapperDenial(JSContext* cx, HandleId id, WrapperDenialType type,
|
|||
return false;
|
||||
}
|
||||
AutoFilename filename;
|
||||
unsigned line = 0, column = 0;
|
||||
uint32_t line = 0, column = 0;
|
||||
DescribeScriptedCaller(cx, &filename, &line, &column);
|
||||
|
||||
// Warn to the terminal for the logs.
|
||||
|
|
Загрузка…
Ссылка в новой задаче