Closed
Bug 309232
Opened 20 years ago
Closed 19 years ago
[FIX]nsWebBrowser::AddWebBrowserListener always returns NS_ERROR_INVALID_ARG if called before window is created
Categories
(Core Graveyard :: Embedding: APIs, defect, P3)
Core Graveyard
Embedding: APIs
Tracking
(Not tracked)
RESOLVED
FIXED
mozilla1.9alpha1
People
(Reporter: gschmidt, Assigned: bzbarsky)
Details
(Keywords: fixed1.8.1)
Attachments
(1 file, 1 obsolete file)
|
2.98 KB,
patch
|
benjamin
:
approval-branch-1.8.1+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.10) Gecko/20050716 Firefox/1.0.6
Build Identifier: GRE release 1.7.8 (unchanged in CVS)
In nsWebBrowser::AddWebBrowserListener in nswebbrowser.cpp, rv is initialized to
NS_ERROR_INVALID_ARG. Then there are two branches of control, after which rv is
returned to the caller. One branch handles the case where the window has already
been created; it sets rv to the return value of BindListener. The other branch
handles the case where the window hasn't been created. It queues the listener
object until window creation. However, it does not set rv, so even if everything
goes fine NS_ERROR_INVALID_ARG is returned.
If this is the correct behavior (it is supposed to be an error to add a listener
before calling InitWindow) this should be documented.
Reproducible: Always
Steps to Reproduce:
1. Instantiate NS_WEBBROWSER_CONTRACTID; get the nsIWebBrowser interface.
2. Call AddWebBrowserListener on it, passing NS_GET_IID(nsIWebProgressListener)
and a weak reference to an object that implements nsIWebProgressListener.
Actual Results:
AddWebBrowserListener returns NS_ERROR_INVALID_ARG. Haven't checked to see if
notifications are delivered anyway.
Expected Results:
Expected return value is NS_OK.
| Assignee | ||
Comment 1•19 years ago
|
||
Assignee: adamlock → bzbarsky
Status: UNCONFIRMED → ASSIGNED
Attachment #207796 -
Flags: superreview?(darin)
Attachment #207796 -
Flags: review?(darin)
| Assignee | ||
Updated•19 years ago
|
OS: Windows XP → All
Priority: -- → P3
Hardware: PC → All
Summary: nsWebBrowser::AddWebBrowserListener always returns NS_ERROR_INVALID_ARG if called before window is created → [FIX]nsWebBrowser::AddWebBrowserListener always returns NS_ERROR_INVALID_ARG if called before window is created
Target Milestone: --- → mozilla1.8.1
Comment 2•19 years ago
|
||
Comment on attachment 207796 [details] [diff] [review]
This should fix it
Perhaps it would be better to use nsAutoPtr<nsWebBrowserListenerState> to avoid having to insert all of those NS_DELETEXPCOM(state) calls. You could just do a .forget() if AppendElement succeeds.
Attachment #207796 -
Flags: superreview?(darin)
Attachment #207796 -
Flags: superreview+
Attachment #207796 -
Flags: review?(darin)
Attachment #207796 -
Flags: review+
| Assignee | ||
Comment 3•19 years ago
|
||
Attachment #207796 -
Attachment is obsolete: true
| Assignee | ||
Comment 4•19 years ago
|
||
Fixed on trunk.
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
| Assignee | ||
Comment 5•19 years ago
|
||
Comment on attachment 208019 [details] [diff] [review]
Updated to review comments
I think it's worth taking this on the 1.8 branch. This just makes us not throw in a non-error case in our embedding API...
Attachment #208019 -
Flags: approval1.8.1?
Updated•19 years ago
|
Attachment #208019 -
Flags: approval1.8.1? → branch-1.8.1+
| Assignee | ||
Updated•19 years ago
|
Target Milestone: mozilla1.8.1 → mozilla1.9alpha
Updated•6 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•