Wootique Issues with sendtoeditor :maximum call stack size exceeded #613

Closed
helgatheviking opened this Issue Feb 10, 2012 · 4 comments

Projects

None yet

2 participants

@helgatheviking

When I am editing a page/post/product and try to insert an image i will sometimes get the following error:

Uncaught RangeError: Maximum call stack size exceeded

in

/wootique/functions/js/woo-medialibrary-uploader.js

and the console log traces it down to the woothemesMLU.mediaUpload.window.send_to_editor. i'm having a hard time determining what is causing the error as i have used a similar code myself plenty of times w/o seeing this error.

``` window.original_send_to_editor = window.send_to_editor;
window.send_to_editor = function(html) { //truncated }

window.original_send_to_editor(html);


i'm also seeing it live almost all the time, but locally only some of the time, even though i have disabled plugins locally.  
@helgatheviking

really stuck here, b/c the problem code is actually very similar to code that I have used myself numerous times.

window.original_send_to_editor = window.send_to_editor;
window.send_to_editor = function(html) {      
    if (formfield) {
        //truncated      
    } else {  //console.log(html);
        window.original_send_to_editor(html);
    }
}

the only difference is that you've got it wrapped in a function, but when i tried hacking it out of there i still see the same error so that isn't it. when i console.log(html) on the returned html it repeats it over and over again, which is the cause of the stack size exceeded error, but i still don't know why.

@mikejolley
WooCommerce member

Ill check with Jay/Matty since this could be from the WT framework

@helgatheviking

please do double check. however, i am beginning to think there is a conflict w/ the code i have doing exactly the same thing w/ my own custom metaboxes.

@helgatheviking

ok, i think the problem was that my own script had exactly the same bit of code.... and a function called window.original_send_to_editor, which caused it to loop between the two. i have since changed mine to something w/ a more unique name-space.

window.kia_backup_send_to_editor = window.send_to_editor;
window.send_to_editor = function(html) {      
    if (formfield) {
        //truncated      
    } else {  //console.log(html);
        window.kia_backup_send_to_editor(html);
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment