Eclipse is hanged on copy/paste in JavaScript files - javascript

I've been running Eclipse Helios 3.6 using the Java/CFEclipse IDEs, and finding some very strange and aggravating errors when trying to edit Javascript files. After the .js file reaches a certain size (~250 lines of code), Eclipse will randomly hang whenever I try to select, copy-paste selections, or save. Clicking after the hang starts will result in the "file edit source ... help" bar being whited out, and clicking again leads to the windows "(not responding)" message displayed in the program header. The hang then goes away after another 5-10 seconds of waiting. This is the case for all JavaScript files I try to edit, although shorter ones don't hang as long and don't bring up the "(not responding)" message.
I've thought it was a problem with the Javascript validation/autocomplete options, and have accordingly turned those off; however, the copy-paste hang problem still persists. I've also tried the Javascript IDE - same problem. Is this a problem with Eclipse Javascript handling, period? Has anyone else gotten errors like these? And if it's a fundamentally Eclipse problem, would anyone be able to suggest a better Javascript/Coldfusion editor?
EDIT: For more information, log output from the latest hang:
!ENTRY org.eclipse.wst.jsdt.ui 4 2 2010-08-18 11:25:54.699
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.wst.jsdt.ui".
!STACK 0
java.lang.NullPointerException
at org.eclipse.wst.jsdt.internal.compiler.lookup.ArrayBinding.getExactMethod(ArrayBinding.java:233)
at org.eclipse.wst.jsdt.internal.compiler.lookup.Scope.findExactMethod(Scope.java:401)
at org.eclipse.wst.jsdt.internal.compiler.lookup.Scope.getMethod(Scope.java:1813)
at org.eclipse.wst.jsdt.internal.compiler.ast.MessageSend.resolveType(MessageSend.java:307)
at org.eclipse.wst.jsdt.internal.compiler.ast.Expression.resolve(Expression.java:477)
at org.eclipse.wst.jsdt.internal.compiler.ast.Block.resolve(Block.java:89)
at org.eclipse.wst.jsdt.internal.compiler.ast.ForStatement.resolve(ForStatement.java:280)
at org.eclipse.wst.jsdt.internal.compiler.ast.Block.resolve(Block.java:89)
at org.eclipse.wst.jsdt.internal.compiler.ast.ForStatement.resolve(ForStatement.java:280)
at org.eclipse.wst.jsdt.internal.compiler.ast.Block.resolve(Block.java:89)
at org.eclipse.wst.jsdt.internal.compiler.ast.IfStatement.resolve(IfStatement.java:191)
at org.eclipse.wst.jsdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:337)
at org.eclipse.wst.jsdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:139)
at org.eclipse.wst.jsdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:291)
at org.eclipse.wst.jsdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:362)
at org.eclipse.wst.jsdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:394)
at org.eclipse.wst.jsdt.core.dom.JavaScriptUnitResolver.resolve(JavaScriptUnitResolver.java:859)
at org.eclipse.wst.jsdt.core.dom.JavaScriptUnitResolver.resolve(JavaScriptUnitResolver.java:527)
at org.eclipse.wst.jsdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:862)
at org.eclipse.wst.jsdt.core.dom.ASTParser.createAST(ASTParser.java:647)
at org.eclipse.wst.jsdt.internal.ui.javaeditor.ASTProvider$1.run(ASTProvider.java:581)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.wst.jsdt.internal.ui.javaeditor.ASTProvider.createAST(ASTProvider.java:574)
at org.eclipse.wst.jsdt.internal.ui.javaeditor.ASTProvider.getAST(ASTProvider.java:509)
at org.eclipse.wst.jsdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup.calculateASTandInform(SelectionListenerWithASTManager.java:150)
at org.eclipse.wst.jsdt.internal.ui.viewsupport.SelectionListenerWithASTManager$3.run(SelectionListenerWithASTManager.java:135)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
!ENTRY org.eclipse.wst.jsdt.ui 4 0 2010-08-18 11:25:54.824
!MESSAGE Error in JSDT Core during AST creation
!STACK 0
java.lang.NullPointerException
at org.eclipse.wst.jsdt.internal.compiler.lookup.ArrayBinding.getExactMethod(ArrayBinding.java:233)
at org.eclipse.wst.jsdt.internal.compiler.lookup.Scope.findExactMethod(Scope.java:401)
at org.eclipse.wst.jsdt.internal.compiler.lookup.Scope.getMethod(Scope.java:1813)
at org.eclipse.wst.jsdt.internal.compiler.ast.MessageSend.resolveType(MessageSend.java:307)
at org.eclipse.wst.jsdt.internal.compiler.ast.Expression.resolve(Expression.java:477)
at org.eclipse.wst.jsdt.internal.compiler.ast.Block.resolve(Block.java:89)
at org.eclipse.wst.jsdt.internal.compiler.ast.ForStatement.resolve(ForStatement.java:280)
at org.eclipse.wst.jsdt.internal.compiler.ast.Block.resolve(Block.java:89)
at org.eclipse.wst.jsdt.internal.compiler.ast.ForStatement.resolve(ForStatement.java:280)
at org.eclipse.wst.jsdt.internal.compiler.ast.Block.resolve(Block.java:89)
at org.eclipse.wst.jsdt.internal.compiler.ast.IfStatement.resolve(IfStatement.java:191)
at org.eclipse.wst.jsdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:337)
at org.eclipse.wst.jsdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:139)
at org.eclipse.wst.jsdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:291)
at org.eclipse.wst.jsdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:362)
at org.eclipse.wst.jsdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:394)
at org.eclipse.wst.jsdt.core.dom.JavaScriptUnitResolver.resolve(JavaScriptUnitResolver.java:859)
at org.eclipse.wst.jsdt.core.dom.JavaScriptUnitResolver.resolve(JavaScriptUnitResolver.java:527)
at org.eclipse.wst.jsdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:862)
at org.eclipse.wst.jsdt.core.dom.ASTParser.createAST(ASTParser.java:647)
at org.eclipse.wst.jsdt.internal.ui.javaeditor.ASTProvider$1.run(ASTProvider.java:581)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.wst.jsdt.internal.ui.javaeditor.ASTProvider.createAST(ASTProvider.java:574)
at org.eclipse.wst.jsdt.internal.ui.javaeditor.ASTProvider.getAST(ASTProvider.java:509)
at org.eclipse.wst.jsdt.internal.ui.viewsupport.SelectionListenerWithASTManager$PartListenerGroup.calculateASTandInform(SelectionListenerWithASTManager.java:150)
at org.eclipse.wst.jsdt.internal.ui.viewsupport.SelectionListenerWithASTManager$3.run(SelectionListenerWithASTManager.java:135)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)

For me the solution was disable this option...
Preferences/JavaScript/Editor/Typing{When pasting}/Update imports

Ok, I think I found a brute force solution to this. I went into windows>preferences>javascript>[all sub menus] and just unchecked as many things as I could stomach to uncheck. I did that a couple of weeks ago and it's only hung once since then (I think it was unrelated as I had to force quit after 5 minutes).

First time met as Eclipse hangs on copy/cut for JavaScript files, and https://github.com/Nodeclipse/nodeclipse-1/issues/159
Current summary:
size matters: big project can cause Eclipse JSDT to freeze (this is old issue as #andreialecu has collected https://github.com/Nodeclipse/nodeclipse-1/issues/159#issuecomment-68098716)
hammer 100% solution is to remove JsNature for that one project
more subtle is to disable only some JSDT features
Window>Preferences>JavaScript>Editor>Mark Occurrences
and maybe even Window->Preferences->General->Editors->Text Editors->Hyperlinking
recommended by JSDT maintainers (for further observation): (by #vrubezhny )
get latest JSDT version
increase available memory settings
use resource filters to hide more files in folders like build/dist/bower/vendor (by #ppartida )
And generally:
pay attention what step you have taken when working with any software.
experiment with little changes
Please add more answers here
(the first issue raised Aug 18 '10)

Related

AppLab "readRecords()" is broken

I'm year 10 and my final project for APCS is to make a game/app and turn in the code, a video of it running, and a written response. My problem is that the entire class was taught using Code.org's AppLab and the readRecords() function is seemingly broken , I think its readRecords() because the concept version of the game doesn't use readRecords and works fine, but the current version does and nearly half of the buttons in the game don't work most of the time. Including the buttons to log in, sign up, etc.Meaning I can't even get past the welcome screen. My code isn't the issue and this is due in a few hours. s u g g e s t i o n s p l e a s e.
applab docs for readRecords
it looks like readRecords should probably still be supported
you should use your browser's javascript console/debugger to find your application's point of failure
here's some ideas for where that point of failure might be:
in your code which is using readRecords incorrectly
you have to find the bug and fix it yourself
in applab's readRecords code itself (less likely)
you have to submit a bug report to applab
find a workaround until you can implement a potential fix from applab
Because you are saying that your buttons do not work "most of the time", and the readRecords() command is asynchronous, I suspect you have a timing issue of some kind. To help determine if the problem is with the readRecords() command or with how you're using it in your project, you could put the share link to your project here, or in a message to code.org support.

Errors in Ajax Control Toolkit's JS files after upgrade?

I upgraded Ajax Control Toolkit to v15.x and have been working on cleaning up the code after doing so. I'm running across exceptions being thrown, and VS breaks at points in the toolkit's JS files. I'm not sure why or how.
I've already double-checked that any scripts are not referenced multiple times, as was the leading suggestion on Google, but I still haven't figured it out.
I really need some help with this, as I have two months invested in this project. By the way, I'm using VS2013 and the project is in ASP/VB.
Here are a couple of the errors (to get the next, I've hit Continue):
Unhandled exception at line 1647, column 38 in
http://localhost:50236/ScriptResource.axd?d=D9drwtSJ4hBA6O8UhT6CQmpVfriIlRNRich93DvwGtp67E1h_mWKZOFWLDGS9BMtlj8olqCr6zhXtNsVz0umlIymKK0GfDoqTLzNLe2YQI2ElwoX58_2MZEcEFLKjdG6fbv26oE3vanxWpdhskXpgCIAYbDVlsaWWDXPE-98sV01&t=ffffffffb53e74b8
and
Unhandled exception at line 785, column 42 in
http://localhost:50236/ScriptResource.axd?d=D9drwtSJ4hBA6O8UhT6CQmpVfriIlRNRich93DvwGtp67E1h_mWKZOFWLDGS9BMtlj8olqCr6zhXtNsVz0umlIymKK0GfDoqTLzNLe2YQI2ElwoX58_2MZEcEFLKjdG6fbv26oE3vanxWpdhskXpgCIAYbDVlsaWWDXPE-98sV01&t=ffffffffb53e74b8
0x800a139e - JavaScript runtime error: Sys.InvalidOperationException:
Type Sys.Timer has already been registered. The type may be defined
multiple times or the script file that defines it may have already
been loaded. A possible cause is a change of settings during a partial
update.
0x800a139e - JavaScript runtime error: Sys.InvalidOperationException:
Type Sys.Extended.UI.BoxSide has already been registered. The type may
be defined multiple times or the script file that defines it may have
already been loaded. A possible cause is a change of settings during a
partial update.
Any and all help is appreciated! Thanks!
As it turns out, I followed the instructions on the Ajax Control Toolkit website on "un-bundling" the scripts, and now everything works. Apparently I didn't do something right, or the instructions were wrong. More than likely, the former.

Browser.ExecScript() stopped working after updating windows

I've set up a simple testbed for WatiN (ver 2.1) which reads:
var browser = new IE();
browser.GoTo("http://www.google.co.il"); // webpage doesn't matter really
browser.RunScript("alert(123)");
This works only if KB3025390 is not installed. Installing it breaks the above test with an UnAuthorizedAccessException which has HRESULT set to E_ACCESSDENIED. What gives? Is there any workaround?
Update: Using IWebBrowser2.Navigate2 along with "javascript:console.log(123)" type of scripts works however
it makes me feel uneasy using such a backchannel
the scripts run through this back-channel of .Navigate2() may only have a max length of about 2070 chars (give or take) otherwise they get forcibly truncated to this length leading to javascript errors upon attempting to run them
using .Navigate2(), even with the most trivial script, will clog the ready state of Internet Explorer for good in the sense that it will be set to READYSTATE_LOADING without any hope of getting rid of it. In simple terms this means that once you use this hack, you either have to perform every single subsequent operation in WatiN in a "dont-wait-for-webpage-to-load" fashion (GoToNoWait, ClickNoWait etc) lest your code freezes upon waiting for the browser to turn back to READYSTATE_COMPLETE (which will never come about ofcourse as already mentioned).
there appears to be a much broader issue here in the sense that I can't even access the properties of an IHtmlWindow2 object p.e. window.document throws an unauthorized exception again making it virtually impossible to transfer over to the C# world the return-values of the scripts I'm running (using Expando etc) for documents other than window.top.document (for the window.top.document window there is IWebBrowser2.Document which does the trick)
Update#2: The folks over at the selenium project have also noticed this issue:
https://code.google.com/p/selenium/issues/detail?id=8302
A bug report has been created as well:
https://connect.microsoft.com/IE/feedback/details/1062093/installation-of-kb3025390-breaks-out-of-process-javascript-execution-in-ie11
Update#3: IHTMLWindow2.setInterval and IHTMLWindow2.setTimeout also throw UnauthorizedAccess exceptions. These methods are not marked as deprecated in:
http://msdn.microsoft.com/ko-kr/library/windows/desktop/aa741505%28v=vs.85%29.aspx
yet they have wounded up suffering from the same cutbacks all the same.
Update#4: I gave the approach recommended in this post a shot:
https://stackoverflow.com/a/18546866/863651
In order to dynamically invoke the "eval" method of the IHTMLWindow2 object (or any other method really). Got the same "System.UnauthorizedAccessException" as above. So no joy here either.
Microsoft recommends using "eval" over "execscript" however after the above experiment I suspect that they are refering to accessing "eval" only from within the browser.
As far as I can tell thus far, when it comes to the full-fledged IE11+ using "eval" out-of-process (via COM) appears to have been completely prohibited along with any other function-invocation of the window object, the only exception being the back-channel of the .Navigate2() mentioned above.
It turns out Microsoft eventually backpedaled on its decision to kill off .execScript at COM-level. Just install the latest updates for Windows including kb3025390: One of the updates for IE that came after kb3025390 brings back .execScript functionality at COM-level
Note, however, that .execScript is not accessible through IE's javascript anymore. In that context it's gone for good.
fyi: this one is also not working
ieInstance.Document.Script.<methodNameString>(<commaSeperatedParameterString>)
try this worked for me at some places but not all places
ieObject.Navigate "javascript:<methodNameString>(<commaSeperatedParameterString>)", Null, "_parent"
or
ieObject.Navigate2 "javascript:"<methodNameString>(<commaSeperatedParameterString>)", Null, "_parent"
now trying to find out solution using eval
I have found a way around the problem of an update installing automatically. You can just create a simple batch file with following content.
{code}
#echo off
wusa /uninstall /kb:3025390/quiet /norestart
END
{code}
Then go to task scheduler, create a new task for this batch file to run every one hour or day as per your requirements. Add it as a system task so it runs in the background and does not affect the running automations.

Eclipse error constantly pops up while editing Javascript

I am working on relatively small (100-300 lines) Javascript files in Eclipse and periodically it gets really upset about some piece of code and pops up this error every time I place the cursor on that line. The error is:
'Requesting JavaScript AST from Selection' has encountered a problem.
An internal error occured during "Requesting JavaScript AST from selection".
java.lang.NullPointerException
While I am converting this:
if(p){
// enter code here
} else { return false; }
into this:
if(p){
// enter code here
} return false;
the error pops up several times. Each time it stops my typing and requires me to click the okay button. I then type two more characters and the error appears again.
Any ideas how to either prevent the error or disable whatever Javascript AST is?
This is on Eclipse Java EE, Indigo Service Release 2. It is almost a flat install, only two plugins installed and neither are for SVN and have nothing to do with Javascript.
An even better answer (from the bug report linked by Cliff Ribaudo, comment #10 and others):
Turn off Toggle Mark Occurrences (Alt-Shift-O or the paintbrush icon on the toolbar, which handily, will show you your current state).
Thanks Cliff!
Edited:
At first I thought this was just a trick, but it is working so well, I had to post it as an actual answer.
When the error window pops up, don't close it. Just drag it off to the side, focus back on the main window and keep editing.
When the error happens again Eclipse doesn't change the focus back to the error message. Focus stays in the editing window and you can continue to edit the document.
Likely an eclipse bug. See this thread:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=359005
There is a patch posted there which you might try.
Ironically, the solution for me was to install another plugin. After I installed VJET, and set up my JavaScript project to be a VJET-enabled project, the issue went away.
just replace the xml in your .project file (which lies in home directory of your eclipse workspace .
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>your Project Name</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>
I've been getting this error lately. I am writing Groovy scripts. The fix for me was to update the Groovy plugin.
I was getting same error with gc overhead limit exceeded description in details section of error. To take action on it I have added following in configuration and issue resolved.
Xms512m
Xmx2048m
Ref: GC overhead limit exceeded problem
In short, for me it was eclipse memory problem.

VS2008 javascript debugger IE8 "there is no source code available for the current location"

I have almost the same problem as this unanswered question. The only difference is I'm using VS2008, but I'm in an MVC project calling this javascript function:
function CompanyChange(compCtrl) {
alert(compCtrl.value);
debugger;
var test;
for (var i = 0; i < document.all.length; i++) {
test = document.all[i];
}
}
I hit the alert, then I get the message "there is no source code available for the current location." At which point the page becomes unresponsive and I have to manually stop the debugger just to shut it down.
I've logged into another machine and ran this exact code and it works fine, I hit the debugger and can step through. I've checked to make sure all settings in VS>Tools>Options>Debugging are identical as well as IE>Options>Advanced and they are. Both machines are Windows 7 Enterprise edition 32-bit, VS2008, IE8.
I've also tried attaching a process manually in VS, and using the 'Developer Tools' in IE which didn't work (said there already was a process attached).
I was hoping someone may have had this problem and found a work-around because I've already done a lot of searching and tried all the options I've read. Anyone else run into this?
Thank you,
Jeff
I recently answered the original question, so thought I'd post my answer here too:
The debugger cannot debug both Silverlight code and Script code at the same time, if the Silverlight debugger is selected JavaScript debugging is switched off.
To resolve this go to the Project's Properties and select "Start Options". Next check that the Silverlight checkbox is NOT ticked if you want to be able to debug JavaScript. (It is unfortunate that the UI here is not clear about this side effect.)
Even I had the same "Source code not available" msg for ie8. Actually I was having 2 different methods with same names having different parameters in 2 different pages and one of the method which I was invoking was not getting called due to the overloaded method which Ie8 doesn't detect. So I just renamed the function and it resolved the issue

Categories

Resources