Skip to content
Permalink
Browse files

Fixed: Permission denied in magicline when using editor inside of an …

…iframe with sandbox=allow-scripts.
  • Loading branch information...
oleq committed Nov 23, 2012
1 parent 0b31fbf commit 9d12fc4a84675b8de0be38bb17816d10e2292e6e
Showing with 25 additions and 16 deletions.
  1. +25 −16 plugins/magicline/plugin.js
@@ -28,22 +28,6 @@
triggerOffset = config.magicline_triggerOffset || 30,
enterMode = config.enterMode,
that = {
// %REMOVE_START%
// Internal DEBUG uses tools located in the topmost window.
debug: window.top.DEBUG || {
groupEnd: function() {},
groupStart: function() {},
log: function() {},
logElements: function() {},
logElementsEnd: function() {},
logEnd: function() {},
mousePos: function() {},
showHidden: function() {},
showTrigger: function() {},
startTimer: function() {},
stopTimer: function() {}
},
// %REMOVE_END%
// Global stuff is being initialized here.
editor: editor,
enterBehavior: enterBehaviors[ enterMode ], // A tag which is to be inserted by the magicline.
@@ -56,6 +40,31 @@
},
scrollTimeout, hideTimeout, checkMouseTimeoutPending, checkMouseTimeout, checkMouseTimer;

// %REMOVE_START%
// Internal DEBUG uses tools located in the topmost window.

// (#9701) Due to security limitations some browsers may throw
// errors when accessing window.top object. Do it safely first then.
try {
that.debug = window.top.DEBUG;
}
catch ( e ) {}

that.debug = that.debug || {
groupEnd: function() {},
groupStart: function() {},
log: function() {},
logElements: function() {},
logElementsEnd: function() {},
logEnd: function() {},
mousePos: function() {},
showHidden: function() {},
showTrigger: function() {},
startTimer: function() {},
stopTimer: function() {}
};
// %REMOVE_END%

// Simple irrelevant elements filter.
that.isRelevant = function( node ) {
return isHtml( node ) // -> Node must be an existing HTML element.

0 comments on commit 9d12fc4

Please sign in to comment.
You can’t perform that action at this time.