Adding the code to launch a JS debugger

This commit is contained in:
Eric van der Vlist 2021-04-24 18:25:09 +02:00
parent 6c294711e3
commit 124fd26a4a
4 changed files with 245 additions and 25 deletions

View File

@ -0,0 +1,17 @@
startDebugger = function () {
var runnable = {
run: function () {
main.dispose();
}
}
var context = Packages.org.mozilla.javascript.Context.getCurrentContext();
var contextFactory = context.getFactory();
var scope = Packages.org.mozilla.javascript.tools.shell.Environment(runnable.__parent__);
var main = Packages.org.mozilla.javascript.tools. debugger.Main.mainEmbedded(contextFactory, scope, 'Debugger');
main.setExitAction(java.lang.Runnable(runnable));
main.setVisible(true);
}

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="21.1">
<meta>
<filters directoryPatterns="" filePatterns="\Qjs-debugger.xpr\E" positiveFilePatterns="" showHiddenFiles="false"/>
<options/>
</meta>
<projectTree name="js-debugger.xpr">
<folder path="."/>
</projectTree>
</project>

View File

@ -1,10 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<serialized version="12.2" xml:space="preserve">
<map>
<serialized version="21.1" xml:space="preserve">
<serializableOrderedMap>
<entry>
<String>document.types</String>
<documentTypeDescriptor-array>
<documentTypeDescriptor>
<field name="extensionPatch">
<null/>
</field>
<field name="name">
<String>SDF</String>
</field>
@ -24,6 +27,9 @@
<String>${frameworks}/docbook/docbook.jar</String>
</String-array>
</field>
<field name="parentClassLoaderID">
<null/>
</field>
<field name="authorExtensionDescriptor">
<authorExtension>
<field name="cssDescriptors">
@ -44,6 +50,9 @@
<field name="mergeCSSsFromDocument">
<Boolean>true</Boolean>
</field>
<field name="multipleAlternateSelectionEnabled">
<Boolean>false</Boolean>
</field>
<field name="actionDescriptors">
<action-array>
<action>
@ -75,12 +84,12 @@
<String>local-name()='section' or local-name()='book' or local-name()='article'</String>
</field>
<field name="argValues">
<map>
<serializableOrderedMap>
<entry>
<String>fragment</String>
<String>&lt;section xmlns="http://www.oxygenxml.com/sample/documentation">&lt;title/>&lt;para/>&lt;/section></String>
</entry>
</map>
</serializableOrderedMap>
</field>
<field name="operationID">
<String>ro.sync.ecss.extensions.commons.operations.InsertFragmentOperation</String>
@ -88,6 +97,9 @@
</actionMode>
</actionMode-array>
</field>
<field name="enabledInReadOnlyContext">
<Boolean>false</Boolean>
</field>
</action>
<action>
<field name="id">
@ -118,7 +130,7 @@
<String></String>
</field>
<field name="argValues">
<map/>
<serializableOrderedMap/>
</field>
<field name="operationID">
<String>simple.documentation.framework.operations.table.InsertTableOperation</String>
@ -126,6 +138,9 @@
</actionMode>
</actionMode-array>
</field>
<field name="enabledInReadOnlyContext">
<Boolean>false</Boolean>
</field>
</action>
<action>
<field name="id">
@ -156,7 +171,7 @@
<String></String>
</field>
<field name="argValues">
<map/>
<serializableOrderedMap/>
</field>
<field name="operationID">
<String>simple.documentation.framework.operations.InsertImageOperation</String>
@ -164,6 +179,9 @@
</actionMode>
</actionMode-array>
</field>
<field name="enabledInReadOnlyContext">
<Boolean>false</Boolean>
</field>
</action>
<action>
<field name="id">
@ -194,7 +212,7 @@
<String>local-name()='section'</String>
</field>
<field name="argValues">
<map/>
<serializableOrderedMap/>
</field>
<field name="operationID">
<String>simple.documentation.framework.operations.QueryDatabaseOperation</String>
@ -202,6 +220,9 @@
</actionMode>
</actionMode-array>
</field>
<field name="enabledInReadOnlyContext">
<Boolean>false</Boolean>
</field>
</action>
<action>
<field name="id">
@ -232,12 +253,12 @@
<String></String>
</field>
<field name="argValues">
<map>
<serializableOrderedMap>
<entry>
<String>fragment</String>
<String>&lt;ref location=""/></String>
</entry>
</map>
</serializableOrderedMap>
</field>
<field name="operationID">
<String>ro.sync.ecss.extensions.commons.operations.SurroundWithFragmentOperation</String>
@ -245,6 +266,9 @@
</actionMode>
</actionMode-array>
</field>
<field name="enabledInReadOnlyContext">
<Boolean>false</Boolean>
</field>
</action>
<action>
<field name="id">
@ -275,7 +299,7 @@
<String>true()</String>
</field>
<field name="argValues">
<map/>
<serializableOrderedMap/>
</field>
<field name="operationID">
<String>simple.documentation.framework.operations.SDFRefreshCSSOperation</String>
@ -283,6 +307,9 @@
</actionMode>
</actionMode-array>
</field>
<field name="enabledInReadOnlyContext">
<Boolean>false</Boolean>
</field>
</action>
<action>
<field name="id">
@ -313,7 +340,7 @@
<String>true()</String>
</field>
<field name="argValues">
<map/>
<serializableOrderedMap/>
</field>
<field name="operationID">
<String>simple.documentation.framework.operations.SDFShowFileStatusOperation</String>
@ -321,6 +348,9 @@
</actionMode>
</actionMode-array>
</field>
<field name="enabledInReadOnlyContext">
<Boolean>false</Boolean>
</field>
</action>
<action>
<field name="id">
@ -351,7 +381,7 @@
<String>true()</String>
</field>
<field name="argValues">
<map/>
<serializableOrderedMap/>
</field>
<field name="operationID">
<String>simple.documentation.framework.operations.SDFStrictModeOperation</String>
@ -359,6 +389,9 @@
</actionMode>
</actionMode-array>
</field>
<field name="enabledInReadOnlyContext">
<Boolean>false</Boolean>
</field>
</action>
<action>
<field name="id">
@ -389,7 +422,7 @@
<String>true()</String>
</field>
<field name="argValues">
<map/>
<serializableOrderedMap/>
</field>
<field name="operationID">
<String>simple.documentation.framework.operations.TrasformOperation</String>
@ -397,6 +430,9 @@
</actionMode>
</actionMode-array>
</field>
<field name="enabledInReadOnlyContext">
<Boolean>false</Boolean>
</field>
</action>
<action>
<field name="id">
@ -427,7 +463,7 @@
<String></String>
</field>
<field name="argValues">
<map/>
<serializableOrderedMap/>
</field>
<field name="operationID">
<String>simple.documentation.framework.operations.SelectNodesInOutlinerOperation</String>
@ -435,6 +471,9 @@
</actionMode>
</actionMode-array>
</field>
<field name="enabledInReadOnlyContext">
<Boolean>false</Boolean>
</field>
</action>
<action>
<field name="id">
@ -465,7 +504,7 @@
<String></String>
</field>
<field name="argValues">
<map/>
<serializableOrderedMap/>
</field>
<field name="operationID">
<String>simple.documentation.framework.operations.InsertElementOperation</String>
@ -473,6 +512,9 @@
</actionMode>
</actionMode-array>
</field>
<field name="enabledInReadOnlyContext">
<Boolean>false</Boolean>
</field>
</action>
<action>
<field name="id">
@ -503,7 +545,7 @@
<String></String>
</field>
<field name="argValues">
<map/>
<serializableOrderedMap/>
</field>
<field name="operationID">
<String>simple.documentation.framework.operations.ExtractNodeToFileOperation</String>
@ -511,6 +553,9 @@
</actionMode>
</actionMode-array>
</field>
<field name="enabledInReadOnlyContext">
<Boolean>false</Boolean>
</field>
</action>
<action>
<field name="id">
@ -541,7 +586,7 @@
<String></String>
</field>
<field name="argValues">
<map/>
<serializableOrderedMap/>
</field>
<field name="operationID">
<String>simple.documentation.framework.operations.highlight.AddHighlightOperation</String>
@ -549,6 +594,9 @@
</actionMode>
</actionMode-array>
</field>
<field name="enabledInReadOnlyContext">
<Boolean>false</Boolean>
</field>
</action>
<action>
<field name="id">
@ -579,7 +627,7 @@
<String></String>
</field>
<field name="argValues">
<map/>
<serializableOrderedMap/>
</field>
<field name="operationID">
<String>simple.documentation.framework.operations.highlight.EditHighlightsOperation</String>
@ -587,6 +635,9 @@
</actionMode>
</actionMode-array>
</field>
<field name="enabledInReadOnlyContext">
<Boolean>false</Boolean>
</field>
</action>
<action>
<field name="id">
@ -617,7 +668,7 @@
<String></String>
</field>
<field name="argValues">
<map/>
<serializableOrderedMap/>
</field>
<field name="operationID">
<String>simple.documentation.framework.operations.highlight.RemoveAllHighlightsOperation</String>
@ -625,6 +676,9 @@
</actionMode>
</actionMode-array>
</field>
<field name="enabledInReadOnlyContext">
<Boolean>false</Boolean>
</field>
</action>
<action>
<field name="id">
@ -655,7 +709,7 @@
<String></String>
</field>
<field name="argValues">
<map/>
<serializableOrderedMap/>
</field>
<field name="operationID">
<String>simple.documentation.framework.operations.highlight.ChangeReviewAuthorOperation</String>
@ -663,6 +717,9 @@
</actionMode>
</actionMode-array>
</field>
<field name="enabledInReadOnlyContext">
<Boolean>false</Boolean>
</field>
</action>
<action>
<field name="id">
@ -693,7 +750,7 @@
<String>true()</String>
</field>
<field name="argValues">
<map/>
<serializableOrderedMap/>
</field>
<field name="operationID">
<String>simple.documentation.framework.operations.OpenInNewEditor</String>
@ -701,6 +758,55 @@
</actionMode>
</actionMode-array>
</field>
<field name="enabledInReadOnlyContext">
<Boolean>false</Boolean>
</field>
</action>
<action>
<field name="id">
<String>debugger</String>
</field>
<field name="name">
<String>debugger</String>
</field>
<field name="description">
<String>Open a JS debugger</String>
</field>
<field name="largeIconPath">
<String></String>
</field>
<field name="smallIconPath">
<String></String>
</field>
<field name="accessKey">
<String></String>
</field>
<field name="accelerator">
<String>M1 M2 D</String>
</field>
<field name="actionModes">
<actionMode-array>
<actionMode>
<field name="xpathCondition">
<String></String>
</field>
<field name="argValues">
<serializableOrderedMap>
<entry>
<String>script</String>
<String>doOperation = startDebugger;</String>
</entry>
</serializableOrderedMap>
</field>
<field name="operationID">
<String>ro.sync.ecss.extensions.commons.operations.JSOperation</String>
</field>
</actionMode>
</actionMode-array>
</field>
<field name="enabledInReadOnlyContext">
<Boolean>false</Boolean>
</field>
</action>
</action-array>
</field>
@ -751,9 +857,15 @@
</menuItem>
</menuEntry-array>
</field>
<field name="context">
<null/>
</field>
</menu>
</menuEntry-array>
</field>
<field name="context">
<null/>
</field>
</menu>
</field>
<field name="popupMenuDescriptor">
@ -859,6 +971,9 @@
</menuItem>
</menuEntry-array>
</field>
<field name="context">
<null/>
</field>
</menu>
<menuItem>
<field name="actionID">
@ -867,6 +982,9 @@
</menuItem>
</menuEntry-array>
</field>
<field name="context">
<null/>
</field>
</menu>
</field>
<field name="toolbarDescriptor">
@ -977,18 +1095,30 @@
<field name="tableSupportClassName">
<null/>
</field>
<field name="tableCellSeparatorSupportClassName">
<null/>
</field>
<field name="tableColWidthSupportClassName">
<null/>
</field>
<field name="customReferencesResolver">
<null/>
</field>
<field name="editPropertiesHandler">
<null/>
</field>
<field name="authorExtensionStateListener">
<null/>
</field>
<field name="attributesRecognizer">
<null/>
</field>
<field name="authorActionEventHandler">
<null/>
</field>
<field name="authorImageDecorator">
<null/>
</field>
</authorExtension>
</field>
<field name="templatesLocations">
@ -1022,6 +1152,15 @@
<field name="javaRuleClass">
<String>simple.documentation.framework.CustomRule</String>
</field>
<field name="attributeLocalName">
<String>*</String>
</field>
<field name="attributeNamespace">
<String>*</String>
</field>
<field name="attributeValue">
<String>*</String>
</field>
</documentTypeRule>
<documentTypeRule>
<field name="namespace">
@ -1039,6 +1178,15 @@
<field name="javaRuleClass">
<String></String>
</field>
<field name="attributeLocalName">
<String>*</String>
</field>
<field name="attributeNamespace">
<String>*</String>
</field>
<field name="attributeValue">
<String>*</String>
</field>
</documentTypeRule>
</documentTypeRule-array>
</field>
@ -1087,7 +1235,7 @@
<field name="openInBrowser">
<Boolean>false</Boolean>
</field>
<field name="outputFile">
<field name="outputResource">
<null/>
</field>
<field name="openOtherLocationInBrowser">
@ -1132,10 +1280,10 @@
<field name="validationScenarios">
<validationScenario-array/>
</field>
<field name="defaultValidationScenarioName">
<field name="defaultValidationScenarios">
<null/>
</field>
<field name="defaultTransformationScenarioName">
<field name="defaultTransformationScenarios">
<null/>
</field>
<field name="extensionsBundleClassName">
@ -1168,8 +1316,23 @@
<field name="attributesValueEditor">
<null/>
</field>
<field name="priority">
<Integer>3</Integer>
</field>
<field name="xmlNodeCustomizerExtension">
<null/>
</field>
<field name="externalObjectInsertionHandler">
<null/>
</field>
<field name="customAttributeValueEditor">
<null/>
</field>
<field name="textModeExternalObjectInsertionHandler">
<null/>
</field>
</documentTypeDescriptor>
</documentTypeDescriptor-array>
</entry>
</map>
</serializableOrderedMap>
</serialized>

View File

@ -0,0 +1,30 @@
function a() {}
b = function() {}
typeof a;
typeof b;
aclass = function () {
// this.foo = 1;
this.setFoo(1);
return this;
}
typeof aclass;
aclass.prototype.setFoo = function (v) {
this.foo = v;
}
anObject = new aclass() ;
anObject.setFoo(2);
anObject.foo;
// anobject = aclass();
// anobject.setFoo(3);