Last Comment Bug 646845 - The value set for textarea via javascript gets reset inside Jquery Dialog.
: The value set for textarea via javascript gets reset inside Jquery Dialog.
: regression, testcase
Product: Core
Classification: Components
Component: General (show other bugs)
: Trunk
: All All
-- normal with 1 vote (vote)
: mozilla8
Assigned To: :Ehsan Akhgari
Depends on:
Blocks: 534785
  Show dependency treegraph
Reported: 2011-03-31 08:37 PDT by bharadwaj.sjes
Modified: 2011-07-20 15:57 PDT (History)
8 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

Test Case (148.94 KB, application/octet-stream)
2011-07-11 08:05 PDT, rokeefe1
no flags Details
Patch (v1) (3.66 KB, patch)
2011-07-18 13:16 PDT, :Ehsan Akhgari
bzbarsky: review+
Details | Diff | Splinter Review

Description User image bharadwaj.sjes 2011-03-31 08:37:29 PDT
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US) AppleWebKit/534.16 (KHTML, like Gecko) Chrome/10.0.648.204 Safari/534.16
Build Identifier: Firefox 4.0

The value set for textarea via javascript gets reset inside Jquery Dialog. This behavior is seen in firefox 4.0. The same javascript code works fine in all other browsers.  

Reproducible: Always

Steps to Reproduce:
1.create a simple html page containing some text and buttons or hyper-link. 
2.Onclick of button or hyper-link bind it to jquery click event and pass some 
   text to display in textarea inside a dialog.
3.Add textarea to diplay the text, a button and also add close event in dialog.
4.Now set value insiide textarea via javascript.
5.Browser displays empty value inside text area.  
Actual Results:  
Value inside Textarea set inside dialog becomes empty string, and not the value set from java script. 

Expected Results:  
Value inside Textarea set inside dialog should display same string as set from java script.
Comment 1 User image Brandon Sterne (:bsterne) 2011-03-31 09:45:19 PDT
Not a security bug.
Comment 2 User image (mostly gone) XtC4UaLL [:xtc4uall] 2011-04-01 07:31:23 PDT
Can you attach a reduced Testcase showing your Issue?

Did it work in Fx 3.6? What is the last Beta of Fx 4 it worked okay?
Comment 3 User image rokeefe1 2011-07-07 12:36:41 PDT
I'm having this same problem in Firefox 5.
Comment 4 User image rokeefe1 2011-07-11 08:05:51 PDT
Created attachment 545171 [details]
Test Case

This is a test case for the issue described in this ticket.  To reproduce the issue click on the purple button.  A JQuery dialog will open.  Enter in some text and click okay.  Click on the purple button again.  This time enter in some additional text and click cancel.  Click on the purple button again and you will see that the text you entered when you clicked cancel is still there.  It should not be there.
Comment 5 User image (mostly gone) XtC4UaLL [:xtc4uall] 2011-07-11 10:40:50 PDT
Confirmed the Behavior of Comment 4 Testcase against Mozilla/5.0 (Windows NT 5.1; rv:8.0a1) Gecko/20110711 Firefox/8.0a1 ID:20110711030829

Google Chrome 14/Opera Next is as expected.

Last good nightly: 2010-06-05 First bad nightly: 2010-06-06


=> Bug 567701/Bug 534785?
Comment 6 User image Boris Zbarsky [:bz] (still a bit busy) 2011-07-12 08:56:08 PDT
Ehsan, could you take a look?
Comment 7 User image :Ehsan Akhgari 2011-07-18 12:43:34 PDT
Here's what's happening here.  When the textarea gets a new frame, we add a script runner for PrepareEditorEvent, and *before* that script runner is called, the textarea loses its frame again, which makes the PrepareEditorEvent::Run method called later a no-op, so we lose the editor's current value along the run.

I think I have a fix for this at hand, but I really want to get a minimized testcase for this, but I really don't know how to create reframes like that (i.e., reframing the creating a frame for the textarea, destroying it and creating it once again while under the same script blocker).
Comment 8 User image :Ehsan Akhgari 2011-07-18 13:16:12 PDT
Created attachment 546614 [details] [diff] [review]
Patch (v1)

This is the fix.  Ideas about how to create a minimized testcase for this are appreciated!
Comment 9 User image Boris Zbarsky [:bz] (still a bit busy) 2011-07-19 11:28:29 PDT
Comment on attachment 546614 [details] [diff] [review]
Patch (v1)

Comment 10 User image Marco Bonardo [::mak] 2011-07-20 06:53:25 PDT

Note You need to log in before you can comment on or make changes to this bug.