Closed Bug 400093 Opened 17 years ago Closed 9 years ago

In <certManager.js>, "Error/Exception/NS_ERROR_FAILURE / nsICertTree.getTreeItem / getSelectedTreeItems :: line 209", trying to delete a root/Organization tree item

Categories

(Core Graveyard :: Security: UI, defect, P3)

x86
Windows 2000
defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 78808

People

(Reporter: sgautherie, Unassigned)

References

(Blocks 1 open bug)

Details

(Keywords: polish, Whiteboard: [psm-cert-manager])

[Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9a9pre) Gecko/2007101611 SeaMonkey/2.0a1pre] (nightly) (W2Ksp4)

After adding some exceptions (as in bug 398534 / bug 399043),
try to delete the root line named "(Unknown)":
{{
Error: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsICertTree.getTreeItem]"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame :: chrome://pippki/content/certManager.js :: getSelectedTreeItems :: line 209"  data: no]
}}

I guess the "Delete..." button should not be active for that line ?

Blame says
"1.50	kaie%kuix.de	2007-10-03 04:49	 	Bug 327181"
Component: Security: PSM → Security: UI
QA Contact: psm → ui
confirmed also for Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.9b2pre) Gecko/2007112005 Minefield/3.0b2pre

happen also when i delete a known certificate name.

Steps to reproduce.
Go to https://mozilla.com 
Add a exception
Go into the Cert Manager and try to delete the Certificate from the Root line -> JS Error
Flags: blocking1.9?
Flags: blocking1.9? → blocking1.9+
Priority: -- → P3
I get a slightly different error when I click the Add Exception... button on an SSL error page on my current profile. Strangely, I can't reproduce it on a new profile:

Error: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIXMLHttpRequest.send]"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame :: chrome://pippki/content/exceptionDialog.js :: checkCert :: line 146"  data: no]
Source File: chrome://pippki/content/exceptionDialog.js
Line: 152

Is this part of the same bug, or if not, has a bug already been filed on it? (I couldn't find one; the closest I found was bug 404428, but that's rather different.)
(In reply to comment #2)
> I get a slightly different error when I click the Add Exception... button on an
> SSL error page on my current profile. Strangely, I can't reproduce it on a new
> profile:
> 
> Error: [Exception... "Component returned failure code: 0x80004005
> (NS_ERROR_FAILURE) [nsIXMLHttpRequest.send]"  nsresult: "0x80004005
> (NS_ERROR_FAILURE)"  location: "JS frame ::
> chrome://pippki/content/exceptionDialog.js :: checkCert :: line 146"  data: no]
> Source File: chrome://pippki/content/exceptionDialog.js
> Line: 152
> 
> Is this part of the same bug, or if not, has a bug already been filed on it? (I
> couldn't find one; the closest I found was bug 404428, but that's rather
> different.)

Hey Andrew,

See the code comment here:

http://mxr.mozilla.org/mozilla/source/security/manager/pki/resources/content/exceptionDialog.js#154

What you're seeing (which is not the same problem as Serge describes) is the expected exception we get for trying to XMLHttpRequest to a broken site.  :)  We log it rather than dropping it on the floor because it's possible something strange would happen there and an exception *other than* the expected one would get thrown, at which point diagnostic information would be helpful, but in your case this is normal.

As you mention, bug 404428 tracked some other exceptions being produced when that dialog attempted to access non-existent window parameters, but that was fixed as a by-product of bug 402207.

Serge's exception, however, is not normal, and still needs to be tracked down.  :)
Flags: tracking1.9+ → wanted-next+
[Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9pre) Gecko/2008041102 SeaMonkey/2.0a1pre] (nightly) (W2Ksp4)

(In reply to comment #0)
> After adding some exceptions (as in bug 398534 / bug 399043),

Same with bug 408432 URL/exception, which (now) has a known Issuer Organization.

> I guess the "Delete..." button should not be active for that line ?

Or it could delete the whole associated subtree !

***

(In reply to comment #3)
> (In reply to comment #2)
> > Source File: chrome://pippki/content/exceptionDialog.js
> > Line: 152
> 
> What you're seeing (which is not the same problem as Serge describes) is the
> expected exception we get for trying to XMLHttpRequest to a broken site.  :) 

I filed bug 408697 about this expected exception.
Keywords: polish
Summary: In <certManager.js>, "Error/Exception/NS_ERROR_FAILURE / nsICertTree.getTreeItem / getSelectedTreeItems :: line 209", deleting "(Unknown)" root → In <certManager.js>, "Error/Exception/NS_ERROR_FAILURE / nsICertTree.getTreeItem / getSelectedTreeItems :: line 209", trying to delete a root/Organization tree item
(In reply to comment #3)
> Serge's exception, however, is not normal, and still needs to be tracked down. 
> :)

I gave it a try with JS.D:

1. Selecting the item: (this one is catched)
{{
Exception ``[Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsICertTree.getTreeItem]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: chrome://pippki/content/certManager.js :: websites_enableButtons :: line 298" data: no]'' thrown from function websites_enableButtons() in <chrome://pippki/content/certManager.js> line 298.
}}

2. Trying to delete the item: (this one is not catched)
[[
Exception ``[Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsICertTree.getTreeItem]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: chrome://pippki/content/certManager.js :: getSelectedTreeItems :: line 209" data: no]'' thrown from function getSelectedTreeItems() in <chrome://pippki/content/certManager.js> line 209.

Exception ``[Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsICertTree.getTreeItem]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: chrome://pippki/content/certManager.js :: getSelectedTreeItems :: line 209" data: no]'' thrown from function deleteCerts() in <chrome://pippki/content/certManager.js> line 448.

Exception ``[Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsICertTree.getTreeItem]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: chrome://pippki/content/certManager.js :: getSelectedTreeItems :: line 209" data: no]'' thrown from function oncommand(event=XULCommandEvent:{0}) in <chrome://pippki/content/certManager.xul> line 1.
}}

See
<http://bonsai.mozilla.org/cvsblame.cgi?file=/mozilla/security/manager/pki/resources/content/certManager.js&rev=1.53&mark=209,298#277>

The error comes from
<http://bonsai.mozilla.org/cvsblame.cgi?file=/mozilla/security/manager/ssl/src/nsCertTree.cpp&rev=1.64&mark=885#876>

It seems that there is an inconsistency at handling "non cert" tree items.

(That's all the tracking down I can do.)
As mentioned by Serge we are not handling an exception. This exception arises because of we returning "nsnull" for non-cert rows here: http://mxr.mozilla.org/mozilla-central/source/security/manager/ssl/src/nsCertTree.cpp#325

To avoid the exception we just need to put all our getTreeItem() calls in a try/catch block. The ones causing the exception are here: http://mxr.mozilla.org/mozilla-central/source/security/manager/pki/resources/content/certManager.js#203 

If we just swallow the exception, it will however result in no action. The user will keep pressing "Delete" button and nothing will happen.

OTOH, I think, we should delete all the certs under the selected organization. So if a user wants to delete all the cert exceptions related to one particular organization he just selects that org and clicks "Delete". In the confirmation dialog we can either shown him all the certs that will be deleted or put in something like "This will delete all the certificates for the organization: org-name. Do you want to proceed?" -- Or if need be both.

UI people, kindly give your review about this.

Regards,
Brahmana.
(In reply to comment #7)

Don't want to wallpaper the exception !
Want to either disable the button or make it work.
Assignee: kaie → nobody
Whiteboard: [psm-cert-manager]
I believe this was fixed by bug 78808 disabling the delete button if a root tree item is selected.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.