internet explorer 11 - How did I lose JavaScript built-in objects and all global variables? -
i'm working on umbraco site needs work in big browsers, including ie 11, , i've run weird issue can replicate on ie 11.
at point, script tinymce plug-in tries execute code (about 4 calls deep) in response blur
event:
function classtest(cls) { return new regexp("(^|\\s)" + cls + "(?:$|\\s)\\s*"); }
and throws "object doesn't support action" exception when trying create regexp object. cls
defined , has value expect.
while paused (using visual studio debugger) on unhandled exception, did little checking.
it turns out regexp
undefined
. found extremely weird.
a little more investigation revealed built-in objects undefined. number, array, object, math... of them. also, while enumerate global keys, values undefined.
weirder, use console or immediate-execution windows, within problematic scope, create regular expression objects using /pattern/
syntax.
but condition true in scope of event handler. event handler exits, built-in objects , global variable values restored.
how possible lose access built-in javascript objects, without losing access basic javascript parser , engine?
and, once lost, possible restore them?
i experienced problem well, , assuming you're having trouble tinymce codemirror plugin, problem triggered line in codemirror.js:
on(window, "blur", function () { return foreachcodemirror(onblur); })
where window
refers iframe containing codemirror editor.
this iframe inside of tinymce dialog. i've discovered error occurs when iframe (or element inside it) loses focus @ same time dialog closed, removing iframe dom. can test first clicking outside iframe (on page overlay, example) before closing dialog.
ie11 seems calling blur
event after has started destructing iframe's window
object. classify bug in ie11, never fixed. since don't care blur
event in iframe that's being removed dom, can work around problem modifying problem line skip in case:
on(window, "blur", function () { if (window.regexp) return foreachcodemirror(onblur); })
Comments
Post a Comment