Closed
Bug 457332
Opened 16 years ago
Closed 2 years ago
execCommand does not work in iframe editor I have built with NS_ERROR_NOT_INITIALIZED NS_ERROR_NOT_INITIALIZED errors.
Categories
(Core :: DOM: Editor, defect)
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: monkeymagix, Unassigned)
References
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.2) Gecko/2008091620 Firefox/3.0.2 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.2) Gecko/2008091620 Firefox/3.0.2 Since upgrading to Firefox version 3 I have started getting 2 related errors on any page that uses a WYSIWYG editor that I have built. The problems never existed in previous versions of Firefox and the code works in IE, Opera, Safari etc. The errors are below and occur when using the execCommand function to carry out an action on the Iframe document. However it only ocurrs once the editor has been opened and then closed again once. On the second time of opening nothing that uses execCommand will fire. Error: uncaught exception: [Exception... "Component returned failure code: 0x80004003 (NS_ERROR_NOT_INITIALIZED) [nsIDOMNSHTMLDocument.execCommand]" nsresult: "0x80004003 (NS_ERROR_INVALID_POINTER)" location: "JS frame :: /stratEditor/stratEditor.js :: anonymous :: line 570" data: no] this.GetIframe().contentWindow.document.execCommand("selectAll", false, null); Error: [Exception... "Component returned failure code: 0xc1f30001 (NS_ERROR_NOT_INITIALIZED) [nsIDOMNSHTMLDocument.execCommand]" nsresult: "0xc1f30001 (NS_ERROR_NOT_INITIALIZED)" location: "JS frame :: /stratEditor/stratEditor.js :: anonymous :: line 1066" data: no] Source File: /stratEditor/stratEditor.js Line: 1066 this.GetIframe().contentWindow.document.execCommand(id,false,selected); I have put debug into the functions that get references to the editors elements (iframe, document) and you can see the output below. There is no difference between the output apart from the error. -- Working 421: Going to try execCommand = Bold 422: IN getIframe iframe = wysiwygCMStextarea 423: return getElementById 424: IN getIframeDoc iframe = [object HTMLIFrameElement] - wysiwygCMStextarea - IFRAME 425: return iframe.contentDocument 426: Frame object pointer = [object HTMLIFrameElement] 427: Frame Document pointer = [object HTMLDocument] 428: Did that execCommand work?? -- Broken 700: Going to try execCommand = Bold 701: IN getIframe iframe = wysiwygCMStextarea 702: return getElementById 703: IN getIframeDoc iframe = [object HTMLIFrameElement] - wysiwygCMStextarea - IFRAME 704: return iframe.contentDocument 705: Frame object pointer = [object HTMLIFrameElement] 706: Frame Document pointer = [object HTMLDocument] [Exception... "Component returned failure code: 0xc1f30001 (NS_ERROR_NOT_INITIALIZED) [nsIDOMNSHTMLDocument.execCommand]" nsresult: "0xc1f30001 (NS_ERROR_NOT_INITIALIZED)" location: "JS frame :: /stratEditor/stratEditor.js :: anonymous :: line 1072" data: no] [Break on this error] this.GetIframe().contentWindow.document.execCommand(id,false,selected); This is the only problem I have found with FF3 but its quite a major one as its preventing the CMS system from working so we are having to tell our users to revert back to FF2 or use another browser which we don't really want to do. Does anyone know whats going on or how I can get this issue resolved if its a bug in FF3? I cannot really get a simple test page up and running so hopefully this is enought information. From reading the bugzilla problem list the only thing I can find similar is bug 434998 https://bugzilla.mozilla.org/show_bug.cgi?id=434998 Thanks in advance for any help recieved. Reproducible: Always Steps to Reproduce: 1 The widget editor is contained within a floating div that is initially on the page but hidden. 2. When the user opens the widget any functions that use execCommand run fine with no errors when execCommand is run. 3. The user closes the editor by clicking a link. The div is hidden with display:none. 4. If the user does not refresh the page and re-opens the editor again then any function that uses execCommand will raise an error. The editor is totally unusable until the page is refreshed and the editor is re-opened.
Updated•16 years ago
|
Component: General → Editor
Product: Firefox → Core
QA Contact: general → editor
Version: unspecified → 1.9.0 Branch
I have managed to prevent this issue from happening now. I don't know if its a bug in FF3 or not but this problem did not happen in FF2. I have a function that initialises my iframe editor by setting contentEditable and designmode on. All I have done is put a check before each of these tests so that it will not try and set it true if its already set to true. This seems to have fixed the issues.
Comment 2•2 years ago
|
||
Marking this as Resolved > wfm based on comment 1 and since there are no new updates on it for 13 years it might not be relevant anymore. Feel free to re-open if the issue is still reproducible on your end in the latest FF versions.
Status: UNCONFIRMED → RESOLVED
Closed: 2 years ago
Resolution: --- → WORKSFORME
Comment 3•2 years ago
|
||
Document.execCommand
won't throw exception unless the document is not XHTML document nor HTML one.
Depends on: 1697078
You need to log in
before you can comment on or make changes to this bug.
Description
•