Followup to r90240: clean up some stray code, check for an error condition

This commit is contained in:
Brion Vibber 2011-06-16 23:04:26 +00:00
parent c981d97061
commit c09fc16d54
Notes: Brion Vibber 2011-06-16 23:04:26 +00:00

View file

@ -232,8 +232,10 @@ var saveAndExtend = function( base, extended ) {
base[name] = function() {
if (context.codeEditorActive) {
return func.apply(this, arguments);
} else {
} else if (orig) {
return orig.apply(this, arguments);
} else {
throw new Error('CodeEditor: no original function to call for ' + name);
}
}
} else {
@ -244,34 +246,18 @@ var saveAndExtend = function( base, extended ) {
saveAndExtend( context.fn, {
'saveCursorAndScrollTop': function() {
if ( context.codeEditor ) {
// Stub out textarea behavior
return;
} else {
context.codeEditorStubs.saveCursorAndScrollTop.apply(this);
}
},
'restoreCursorAndScrollTop': function() {
if ( context.codeEditor ) {
// Stub out textarea behavior
return;
} else {
context.codeEditorStubs.saveCursorAndScrollTop.apply(this);
}
},
'saveSelection': function() {
if ( context.codeEditor ) {
mw.log('codeEditor stub function saveSelection called');
} else {
context.codeEditorStubs.saveCursorAndScrollTop.apply(this);
}
},
'restoreSelection': function() {
if ( context.codeEditor ) {
mw.log('codeEditor stub function restoreSelection called');
} else {
context.codeEditorStubs.saveCursorAndScrollTop.apply(this);
}
},
/* Needed for search/replace */