Closed Bug 80946 Opened 23 years ago Closed 23 years ago

Cannot dismiss Pref dialog by "OK" after visiting "Advanced -> System" category

Categories

(SeaMonkey :: Preferences, defect, P3)

x86
Windows 98
defect

Tracking

(Not tracked)

VERIFIED FIXED
mozilla0.9.2

People

(Reporter: doctor__j, Assigned: bugzilla)

References

Details

(Keywords: dataloss, platform-parity, regression, Whiteboard: fix in hand)

Attachments

(1 file)

From Bugzilla Helper:
User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9+) Gecko/20010515
BuildID:    2001051504

Reproducible: Always
Steps to Reproduce:
1. Open Pref menu
2. Choose "Advanced -> System" category
3. Press OK button to dismiss Pref menu

Actual Results:  Cannot close Pref menu by OK button.  Pref menu can be closed
by Cancel button.

Expected Results:  Dismiss Pref menu by OK button.

I saw this error msg from the JavaScript Console:

Error: pageData has no properties
Source File: chrome://communicator/content/pref/nsPrefWindow.js
Line: 207
I'm seeing this bug too on 2001051504 on Win2K
Verified on 2001051504 Win32 Talkback, marking as NEW

Moz Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9+) Gecko/20010515
Status: UNCONFIRMED → NEW
Ever confirmed: true
ouch, regression.

ben or blake, would this be yours?
Assignee: mcafee → ben
Keywords: nsbeta1, pp, regression
argh.  so...many...regressions...mcafee or eddyk, could you take a look at this?
Assignee: ben → eddyk
*** Bug 81813 has been marked as a duplicate of this bug. ***
Target Milestone: --- → mozilla0.9.3
So far, I see that we're getting some empty variables back.  But I'm not seeing 
why.  A quick hack (just for illustration, I don't think this is the right 
approach yet) works around the problem.

Ben, any idea why or how wsm might not return pageData?  Or put another way, 
what is required to setup a page so that pageData is properly initialised?

An interesting observation about this panel is that is makes no use of any pref 
attributes.  Everything is setup and saved using js to the registry.  Would not 
using any pref attributes have anything to do with this?

+++ nsPrefWindow.js     2001/05/29 22:15:32
@@ -74,7 +74,7 @@

       init:
         function ()
-          {
+          {
             if( window.queuedTag )
               {
                 this.onpageload( window.queuedTag );
@@ -204,6 +204,9 @@
             for( var pageTag in this.wsm.dataManager.pageData )
               {
                 var pageData = this.wsm.dataManager.getPageData( pageTag );
+if (!pageData) continue;
*** Bug 83861 has been marked as a duplicate of this bug. ***
This causes data loss because any data entered in the dialog on some other panes
is subsequently lost if you can't save it by clicking OK...
Keywords: dataloss
Hixie: If you press "OK" button first, before you press the "Cancel" button, the
modification to other pref items *will* be applied and saved.  It's just the
illusion that you can't commit those pref changes.  Have a try.
I've backed out the changes I made for the pref locking in nsPrefWindow and the 
error still occurs.  Per jpm I'm assigning to vishy.
Assignee: eddyk → vishy
doctor__j: ok, now that's some screwed up stuff right there. ;-)
nav triage team:

marking p3
Priority: -- → P3
nav triage team:

Forgot to add nsbeta1+
Keywords: nsbeta1nsbeta1+
*** Bug 84635 has been marked as a duplicate of this bug. ***
*** Bug 84730 has been marked as a duplicate of this bug. ***
*** Bug 85099 has been marked as a duplicate of this bug. ***
*** Bug 83884 has been marked as a duplicate of this bug. ***
*** Bug 85174 has been marked as a duplicate of this bug. ***
bug 79821 is similar. Might be worth a look.

*** Bug 85337 has been marked as a duplicate of this bug. ***
*** Bug 85004 has been marked as a duplicate of this bug. ***
*** Bug 85392 has been marked as a duplicate of this bug. ***
mostfreq added @ 10 dups
Keywords: mostfreq
vishy, would it be possible to get this re-assigned to an engineer? I'm pretty
sure you weren't planning on fixing it yourself =). Thanks!
*** Bug 85778 has been marked as a duplicate of this bug. ***
Assignee: vishy → pchen
I think mscott is right :-). 
Is this related to bug 66118?  
I'll look into this.
Assignee: pchen → blake
This was indirectly caused by jbetak's 5/14 checkin for bug 57720.  The problem 
was that pref-winhooks.js handles all of the pref retrieval and setting 
internally, but must use a function called GetFields() to save state upon 
switching panels, but GetFields() is also used when OK is pressed:

            hPrefWindow.wsm.savePageData( tag );
            hPrefWindow.savePrefs();

In savePageData:

          if( 'GetFields' in this.contentArea)
            {
              // save page data based on user supplied function in content area
              var dataObject = this.contentArea.GetFields();
              this.dataManager.setPageData( aPageTag, dataObject );
            }

But the GetFields() in pref-winhooks.js doesn't return an object, or anything, 
since we don't want the nsPrefWindow to save the prefs for us; we're doing it 
ourselves.  So we ended up setting the pageData to undefined, which caused this 
error.

I think handling some of the pref setting and retrieval yourself, as this panel 
does, is a valid usage.  So my morning adventures through 
nsWidgetStateManager/nsPrefWindow/pref-winhooks.* are concluded with a null 
check.
Status: NEW → ASSIGNED
Whiteboard: fix in hand
Attached patch patchSplinter Review
cc'ing alec for sr.
r=jbetak, thanks for pointing this out!

I probably should have done a null check in the in nsPrefWindow,
like "if (pageData && pageData.initialized)" or something similar. My 
apologies. The suggested solution is better and saves some cycles instead of 
adding more...
yay!
However, have you figured out which part of the advanced system page causes
this? I'm glad to see this fix because we've hit this before, but I think it
would be useful to have a warning printed to the screen to make future broken
panels easier to debug.
Yeah, we keep hitting this same end result (see bug 40891 for all the fun 
cases), but nearly all of them are separate cases unfortunately.  This one was 
also pretty isolated.  The problem in this file was:

function GetFields() {
    // Get globals.
    var settings = parent.winHooks.settings;
    var winhooks = parent.winHooks.winhooks;
    var prefs    = parent.winHooks.prefs;
    // Transfer data from dialog to prefs object.
    for( var index in settings ) {
        var setting = settings[ index ];
        var checkbox = document.getElementById( setting );
        if ( checkbox ) {
            prefs[ setting ] = checkbox.checked;
        }
    }
}

GetFields() is used in two places -- to temporarily persist state when 
switching between pref panels, and to save prefs (that the function returns 
in an array) when the OK button is pressed.  nsWidgetStateManager assumes that 
every client needs both usages.  In this case, winhooks is doing all of the 
setting, retrieving and saving itself (because it really retrieves the info from 
the registry, not prefs), so there's no need for 
nsPrefWindow/nsWidgetStateManager to save anything upon pressing OK, and thus 
it doesn't return an array.  I don't think we really need a warning for this, 
since future panels that do this should no longer break with this fix.
 
*** Bug 86057 has been marked as a duplicate of this bug. ***
this needs to be checked in for rtm, I don't know why it's triaged out to .9.3.
That's too late! Blake, any chance you can get this checked in b4 midnight
tomorrow? 

sr=mscott on your fix. I applied the patch and it fixes it for me. 
Sorry, forgot to bring this in.  Yeah, I'll get approval and check it in 
tonight.
Target Milestone: mozilla0.9.3 → mozilla0.9.2
a= asa@mozilla.org for checkin to the trunk.
(on behalf of drivers)
Blocks: 83989
Fix checked in.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
*** Bug 86815 has been marked as a duplicate of this bug. ***
verified win2k 2001062004
Status: RESOLVED → VERIFIED
*** Bug 88370 has been marked as a duplicate of this bug. ***
*** Bug 90600 has been marked as a duplicate of this bug. ***
This bug has reapeared in build 2001071214 see the latest dupe (bug 90600)
Not dupe anymore - sorry for spam
Product: Browser → Seamonkey
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: