зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1338914
- Optimize hidden/internal script detection for devtools. r=shu
MozReview-Commit-ID: JT1TJtJUGrq --HG-- extra : rebase_source : 82229aaff05fbc383714b134cdfc92aff6dbe0d4
This commit is contained in:
Родитель
5bb9a497ef
Коммит
9bb3caade2
|
@ -801,8 +801,7 @@ TabSources.prototype = {
|
||||||
* it's either internal or we don't support in the UI yet.
|
* it's either internal or we don't support in the UI yet.
|
||||||
*/
|
*/
|
||||||
function isHiddenSource(source) {
|
function isHiddenSource(source) {
|
||||||
// Ignore the internal Function.prototype script
|
return source.introductionType === "Function.prototype";
|
||||||
return source.text === "() {\n}";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -156,6 +156,8 @@ from its prototype:
|
||||||
|
|
||||||
* `"Function"`, for code passed to the `Function` constructor.
|
* `"Function"`, for code passed to the `Function` constructor.
|
||||||
|
|
||||||
|
* `"Function.prototype"`, for `Function.prototype` internally generated code.
|
||||||
|
|
||||||
* `"Worker"`, for code loaded by calling the Web worker constructor—the
|
* `"Worker"`, for code loaded by calling the Web worker constructor—the
|
||||||
worker's main script.
|
worker's main script.
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
// In a debuggee, the Function.prototype script source has the introductionType
|
||||||
|
// property set to "Function.prototype".
|
||||||
|
|
||||||
|
var g = newGlobal();
|
||||||
|
var dbg = new Debugger(g);
|
||||||
|
var scripts = dbg.findScripts();
|
||||||
|
assertEq(scripts.length > 0, true);
|
||||||
|
var fpScripts = scripts.filter(s => s.source.introductionType == "Function.prototype");
|
||||||
|
assertEq(fpScripts.length, 1);
|
||||||
|
var source = fpScripts[0].source;
|
||||||
|
assertEq(source.text, "() {\n}");
|
|
@ -854,8 +854,11 @@ CreateFunctionPrototype(JSContext* cx, JSProtoKey key)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
CompileOptions options(cx);
|
CompileOptions options(cx);
|
||||||
options.setNoScriptRval(true)
|
options.setIntroductionType("Function.prototype")
|
||||||
|
.setNoScriptRval(true)
|
||||||
.setVersion(JSVERSION_DEFAULT);
|
.setVersion(JSVERSION_DEFAULT);
|
||||||
|
if (!ss->initFromOptions(cx, options))
|
||||||
|
return nullptr;
|
||||||
RootedScriptSource sourceObject(cx, ScriptSourceObject::create(cx, ss));
|
RootedScriptSource sourceObject(cx, ScriptSourceObject::create(cx, ss));
|
||||||
if (!sourceObject || !ScriptSourceObject::initFromOptions(cx, sourceObject, options))
|
if (!sourceObject || !ScriptSourceObject::initFromOptions(cx, sourceObject, options))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче