Opened 11 years ago

Last modified 11 years ago

#11649 closed Bug

node.js: cross domain getPrarent() permission access denied error — at Version 2

Reported by: Feng Owned by:
Priority: Normal Milestone:
Component: General Version:
Keywords: Cc:

Description (last modified by Piotrek Koszuliński)

Hi CKEditor team,

So we iframed a page using CKEditor in another page with different domain. Since getParent() in core/dom/noide.js could try to access the parent of this.$ (which could be a "document" level node) that will give access denied permission error.

I would suggest below code:

	getParent: function( allowFragmentParent ) {
		var parent;
		try{
		  parent = this.$.parentNode;
		} catch(err){
                  //for no permission to access the parentNode
		  parent = null;
		}
		return ( parent && ( parent.nodeType == CKEDITOR.NODE_ELEMENT || allowFragmentParent && parent.nodeType == CKEDITOR.NODE_DOCUMENT_FRAGMENT ) ) ? new CKEDITOR.dom.node( parent ) : null;
	},

Change History (2)

comment:1 Changed 11 years ago by Feng

I messed up the format above. The wikiFormatting doesn't take {code} marcos. :(

This is what I mean:

	getParent: function( allowFragmentParent ) {
		var parent;
		try{
		  parent = this.$.parentNode;
		} catch(err){
		  parent = null;
		}
		return ( parent && ( parent.nodeType == CKEDITOR.NODE_ELEMENT || allowFragmentParent && parent.nodeType == CKEDITOR.NODE_DOCUMENT_FRAGMENT ) ) ? new CKEDITOR.dom.node( parent ) : null;
	},

This might not be the best solution. If we could handle "parentNode" more gracefully then it would be even better.

comment:2 Changed 11 years ago by Piotrek Koszuliński

Description: modified (diff)
Version: 4.3.2
Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy