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