This morning, suddenly found that our users are saying app crashes after we had breakpoints found iOS 10 of the iphone, JavaScript & UIWebview interface problem occurs in the injected JSContext object, the proxy method can not be performed, and direct crash to the stack area, cause I can not modify on the line.
EDIT: The following original comment is not helpful. My use of window.webkit.messagehandlers in UIWebView is an unsupported hack (to match the API of WKWebView), so no surprise that broke, and the overflow crash when attaching Safari is reportedly not happening to other devs who are on Safari 10 (I haven't updated yet)
-- Original Comment --
Seeing the same bug on iOS 10, filing to Apple now. Problem #1, adding callbacks to window.webkit.messagehandlers: this object now only allows for a single callback function added, it used to allow multiple, i.e. messagehandlers.doOneThing, messagehandlers.doAnother.
Problem #2, seeing crashes: first an EXC_BREAKPOINT on WTF::CrashOnOverflow::overflowed() then a crash
* thread #10: tid = 0x81c29d, 0x0dfb3d1d JavaScriptCore`JSC::DFG::SpeculativeJIT::speculate(JSC::DFG::Node*, JSC::DFG::Edge) + 1197, name = 'WebThread', stop reason = EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)
* frame #0: 0x0dfb3d1d JavaScriptCore`JSC::DFG::SpeculativeJIT::speculate(JSC::DFG::Node*, JSC::DFG::Edge) + 1197
Related
I am running a hybrid PhoneGap app (for a several years, running Cordova Android 6.1.2, more recently 9.0); for years, our #1 javascript error by a significant margin has been
ResizeObserver loop limit exceeded
However, the key distinction for my issue compared to the many other reports found on Google of this error is is that there are 0 instances of ResizeObserver being used anywhere in my code. Searching my entire computer, the only instance of ResizeObserver showing up anywhere is a random Steam file. Looking at my app while it's running, setting window.ResizeObserver = undefined doesn't break/do anything and document.resizeObservers (per the W3C documentation) returns nothing.
I have seen this post, which seems to be the canonical one for this error: ResizeObserver - loop limit exceeded . The answer of "This error means that ResizeObserver was not able to deliver all observations within a single animation frame. It is benign (your site will not break)." would be sufficient for me if I was actually using ResizeObserver. Since I am not using it, I am concerned that this error showing up is indicative of something larger going wrong.
There is no discernible pattern from our users' Chrome version/locale/time zone/Android version/etc/etc, unfortunately.
I've researched this API extensively and have found nothing that would indicate to my issue; either why there would be some sort of phantom ResizeObserver running and/or why that error would show up in an app that doesn't use that API.
Any help here (even just a vague direction to look at) would be very much appreciated. Thanks so much!
https://bugs.chromium.org/p/chromium/issues/detail?id=809574
Even the browser's Shadow DOM may be using this API, and cause this error to fire.
You can still safely ignore it.
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.
I have been determining the version of the IE Trident engine using javascript conditional compilation:
var ieVersion = undefined;
/*#cc_on
ieVersion = Math.floor(#_jscript_version);
#*/
This worked fine for IE8, 9 and 10. In IE11, the conditionally-commented block does not execute, unless I use the F12 dev tools to emulate IE10 (in which case it returns the correct value, 11).
This is confusing, since the MSDN page on conditional compilation specifies that it applies to Internet Explorer 11. (UPDATE 2015-02-03: this page has since been updated to explicitly state that its content does not apply to IE11 in standards mode.) I've not found any information online to suggest that IE11 should not support conditional comments.
Does anyone have any information about this? Can anyone reproduce this behaviour in IE11?
Edit: the relevance of this is in IE's <audio> support. I have a web app that requires playback of around 50 short (~1sec) audio files, which should be played in a (pseudo-)random order, and individually after user interaction. The problems are various:
IE9 has an undocumented limit of 41 audio elements (whether declared in HTML or as JS objects). All subsequent audio files silently fail to load and play. (Each of the 41 elements can have its source re-assigned, but every second re-assignment also fails silently. I would love to see the code behind these bugs...)
IE10 and IE11 "stutter" when playing short sounds: they play a fraction of a second, then pause, then continue on. The effect to the end-user is that the audio is unintelligible. (The audios have preload="auto" and report a non-zero buffer.)
Naturally there's no practical way to feature-detect these issues, hence the browser-detect. I generally feel user-agent sniffing is too dicey for production code; the #cc_on technique seemed more robust.
My workaround for IE9 is to serialise the app state to sessionStorage after the 25th sound, then reload the page and deserialise.
In IE10/11, my workaround is to play the last 90% of the audio at 0 volume, which seems to force IE to actually buffer the file.
Yes, IE11 has removed javascript conditional compilation
The google search linked in the question returns this question as its third result, after two MSDN pages also linked above. This establishes the lack of a better source, so I think this question (including comments) should be considered the authoritative reference for the fact that Javascript conditional compilation is not available in IE11.
I have submitted feedback on the MSDN pages to the effect that they are incorrect.
Update 2015-02-03: MSDN now acknowledges that IE11 no longer supports #cc_on.
Some workarounds are as follows:
User-agent detection
/\([^)]*Trident[^)]*rv:([0-9.]+)/.exec(ua)
will parse IE11's UA string and return the "revision number" at the end.
ScriptEngineMajorVersion() (thanks #Teemu)
var tridentVersion =
typeof ScriptEngineMajorVersion === "function" ?
ScriptEngineMajorVersion() : undefined
should evaluate correctly on all browsers, but we can't guarantee ScriptEngineMajorVersion will not be dropped without warning just as conditional compilation has been.
Thanks to all commenters.
Can anyone suggest a Javascript IDE that will help me with debugging, for example be able to tell me which .js file & which function/line caused a crash?
I am currently using Notepad2 & its extremely difficult if not impossible to figure out why the app is crashing. Right now if I attempt to print out the object/variable causing the crash using...
alert(obj);
...It causes a crash. It is really frustrating because something weird is happening where just accessing the variable - ie passing the variable in a function as a parameter or alerting it - causes Firefox to have a catastrophic crash & Safari just has no failure output(I'm sure the error occurs but it recovers gracefully).
Ever experienced this kind of problem with Javascript before? Maybe you can say "I know what that is because its happened to me before, its x doing y"?
For example: "I know what that is because its happened to me before, your calling a prototype/object static function as a member function"
Internet explorer have Console ( in IE 8 and IE 9 console is usable ) - press F12
Firefox have plugin named firebug
Chrome and Opera have built in consoles ( Press Ctrl + Shift + I )
All of them know what it is break point, can watch some variables etc.
Chrome speciality is break on event.
IE speciality is break on error, and recover from error.
All of them allows you to find out place where script crashes
Most modern browsers come with a Javascript debugger. Safari/Chrome have the Script area in the Webkit Inspector. It allows you to set breakpoints, step through code and inspect variable states. Firefox has something similar in Firebug.
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