From 124fd26a4a91c003f45692c42f1ec0a6b2b757e3 Mon Sep 17 00:00:00 2001 From: Eric van der Vlist Date: Sat, 24 Apr 2021 18:25:09 +0200 Subject: [PATCH] Adding the code to launch a JS debugger --- oxygen/js-debugger/commons.js | 17 +++ oxygen/js-debugger/js-debugger.xpr | 10 ++ oxygen/js-debugger/sdf.framework | 213 +++++++++++++++++++++++++---- oxygen/js-debugger/test.js | 30 ++++ 4 files changed, 245 insertions(+), 25 deletions(-) create mode 100644 oxygen/js-debugger/commons.js create mode 100644 oxygen/js-debugger/js-debugger.xpr create mode 100644 oxygen/js-debugger/test.js diff --git a/oxygen/js-debugger/commons.js b/oxygen/js-debugger/commons.js new file mode 100644 index 0000000..e0753fa --- /dev/null +++ b/oxygen/js-debugger/commons.js @@ -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); + +} \ No newline at end of file diff --git a/oxygen/js-debugger/js-debugger.xpr b/oxygen/js-debugger/js-debugger.xpr new file mode 100644 index 0000000..854430f --- /dev/null +++ b/oxygen/js-debugger/js-debugger.xpr @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/oxygen/js-debugger/sdf.framework b/oxygen/js-debugger/sdf.framework index a6b0dd4..993b97b 100644 --- a/oxygen/js-debugger/sdf.framework +++ b/oxygen/js-debugger/sdf.framework @@ -1,10 +1,13 @@ - - + + document.types + + + SDF @@ -24,6 +27,9 @@ ${frameworks}/docbook/docbook.jar + + + @@ -44,6 +50,9 @@ true + + false + @@ -75,12 +84,12 @@ local-name()='section' or local-name()='book' or local-name()='article' - + fragment <section xmlns="http://www.oxygenxml.com/sample/documentation"><title/><para/></section> - + ro.sync.ecss.extensions.commons.operations.InsertFragmentOperation @@ -88,6 +97,9 @@ + + false + @@ -118,7 +130,7 @@ - + simple.documentation.framework.operations.table.InsertTableOperation @@ -126,6 +138,9 @@ + + false + @@ -156,7 +171,7 @@ - + simple.documentation.framework.operations.InsertImageOperation @@ -164,6 +179,9 @@ + + false + @@ -194,7 +212,7 @@ local-name()='section' - + simple.documentation.framework.operations.QueryDatabaseOperation @@ -202,6 +220,9 @@ + + false + @@ -232,12 +253,12 @@ - + fragment <ref location=""/> - + ro.sync.ecss.extensions.commons.operations.SurroundWithFragmentOperation @@ -245,6 +266,9 @@ + + false + @@ -275,7 +299,7 @@ true() - + simple.documentation.framework.operations.SDFRefreshCSSOperation @@ -283,6 +307,9 @@ + + false + @@ -313,7 +340,7 @@ true() - + simple.documentation.framework.operations.SDFShowFileStatusOperation @@ -321,6 +348,9 @@ + + false + @@ -351,7 +381,7 @@ true() - + simple.documentation.framework.operations.SDFStrictModeOperation @@ -359,6 +389,9 @@ + + false + @@ -389,7 +422,7 @@ true() - + simple.documentation.framework.operations.TrasformOperation @@ -397,6 +430,9 @@ + + false + @@ -427,7 +463,7 @@ - + simple.documentation.framework.operations.SelectNodesInOutlinerOperation @@ -435,6 +471,9 @@ + + false + @@ -465,7 +504,7 @@ - + simple.documentation.framework.operations.InsertElementOperation @@ -473,6 +512,9 @@ + + false + @@ -503,7 +545,7 @@ - + simple.documentation.framework.operations.ExtractNodeToFileOperation @@ -511,6 +553,9 @@ + + false + @@ -541,7 +586,7 @@ - + simple.documentation.framework.operations.highlight.AddHighlightOperation @@ -549,6 +594,9 @@ + + false + @@ -579,7 +627,7 @@ - + simple.documentation.framework.operations.highlight.EditHighlightsOperation @@ -587,6 +635,9 @@ + + false + @@ -617,7 +668,7 @@ - + simple.documentation.framework.operations.highlight.RemoveAllHighlightsOperation @@ -625,6 +676,9 @@ + + false + @@ -655,7 +709,7 @@ - + simple.documentation.framework.operations.highlight.ChangeReviewAuthorOperation @@ -663,6 +717,9 @@ + + false + @@ -693,7 +750,7 @@ true() - + simple.documentation.framework.operations.OpenInNewEditor @@ -701,6 +758,55 @@ + + false + + + + + debugger + + + debugger + + + Open a JS debugger + + + + + + + + + + + + M1 M2 D + + + + + + + + + + + script + doOperation = startDebugger; + + + + + ro.sync.ecss.extensions.commons.operations.JSOperation + + + + + + false + @@ -751,9 +857,15 @@ + + + + + + @@ -859,6 +971,9 @@ + + + @@ -867,6 +982,9 @@ + + + @@ -977,18 +1095,30 @@ + + + + + + + + + + + + @@ -1022,6 +1152,15 @@ simple.documentation.framework.CustomRule + + * + + + * + + + * + @@ -1039,6 +1178,15 @@ + + * + + + * + + + * + @@ -1087,7 +1235,7 @@ false - + @@ -1132,10 +1280,10 @@ - + - + @@ -1168,8 +1316,23 @@ + + 3 + + + + + + + + + + + + + - + \ No newline at end of file diff --git a/oxygen/js-debugger/test.js b/oxygen/js-debugger/test.js new file mode 100644 index 0000000..1e8e017 --- /dev/null +++ b/oxygen/js-debugger/test.js @@ -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); \ No newline at end of file