Open Bug 811772 Opened 12 years ago Updated 2 years ago

For a places tree view, hasSelection sometimes returns true when should be false

Categories

(Toolkit :: Places, defect, P3)

2.0 Branch
x86
All
defect

Tracking

()

People

(Reporter: hrand2, Unassigned)

References

Details

User Agent: Mozilla/5.0 (Windows NT 5.1; rv:16.0) Gecko/20100101 Firefox/16.0
Build ID: 20121010144125

Steps to reproduce:

1) Create a new, empty bookmark folder in library.

2) Now create a new bookmark. This is to be the ONLY bookmark.

3) Close everything to flush out the transaction cache; now come back.

4) Have Error Console running.

5) Now, go to the new Folder with the single bookmark. Delete the bookmark. Now, do something else like Undo. Redo. Ctrl+Z. See all the errors in the console.


Actual results:

You will see lots of 'aNode is null' reports. This is because selectedNodes is returning an array where at least one node is null.


Expected results:

That is because, in tree.xml, hasSelection is returning true when it should be false.

The 'hasSelection' property is returning false because the count property of the selection object is returning 1 when it should be 0. currentIndex==-1.

When count is 0, that always seems correct. When count>1, that always seems correct. When count is 1, sometimes, not always, that is incorrect.

Therefore, it would seem the count property of the selection object is unreliable and that affects many other parts of the tree.xml.

What's going on and what to do about it?
Component: Untriaged → Places
OS: Windows XP → All
Product: Firefox → Toolkit
Version: 16 Branch → 2.0 Branch
I can confirm.
And I can also see error in the Error Console when I delete a Bookmark which is only one in a folder since Firefox4.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Timestamp: 2012/11/15 10:54:50
Error: An error occurred updating the cmd_cut command: [Exception... "'[JavaScript Error: "nodes[i] is null" {file: "chrome://browser/content/places/controller.js" line: 136}]' when calling method: [nsIController::isCommandEnabled]"  nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)"  location: "JS frame :: chrome://global/content/globalOverlay.js :: goUpdateCommand :: line 75"  data: yes]
Source File: chrome://global/content/globalOverlay.js
Line: 81

Timestamp: 2012/11/15 10:54:50
Error: An error occurred updating the cmd_paste command: [Exception... "'TypeError: aNode is null' when calling method: [nsIController::isCommandEnabled]"  nsresult: "0x8057001c (NS_ERROR_XPC_JS_THREW_JS_OBJECT)"  location: "JS frame :: chrome://global/content/globalOverlay.js :: goUpdateCommand :: line 75"  data: no]
Source File: chrome://global/content/globalOverlay.js
Line: 81

Timestamp: 2012/11/15 10:55:01
Error: NS_ERROR_XPC_JS_THREW_JS_OBJECT: 'TypeError: aNode is null' when calling method: [nsIController::isCommandEnabled]
Source File: chrome://browser/content/places/controller.js
Line: 1614
Regression window
Good:
http://hg.mozilla.org/mozilla-central/rev/059e9961a122
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.3a2pre) Gecko/20100225 Minefield/3.7a2pre ID:20100225062635
Bad:
http://hg.mozilla.org/mozilla-central/rev/575fe0710b22
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.3a2pre) Gecko/20100225 Minefield/3.7a2pre ID:20100225132211
Pushlog:
http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=059e9961a122&tochange=575fe0710b22

Regressed by Bug 520659
Blocks: 520659
This problem persists into Version 18.0.

Furthermore, the 'getRangeAt' method returns negative values, which is never supposed to occur. The defect appears to be inside 'nsITreeSelection' so the solution would seem to be go in there and solve the problem.
Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.