Closed Bug 143326 Opened 22 years ago Closed 22 years ago

clarify nsIWebBrowserSetup documentation

Categories

(Core Graveyard :: Embedding: APIs, defect)

x86
Windows NT
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED
mozilla1.1alpha

People

(Reporter: depman1, Assigned: adamlock)

References

()

Details

Attachments

(1 file)

Mozilla 1.0.0 Gecko/20020507.
1. Launch testEmbed from /bin directory (compile nmake -f makefile.win from
/embedding/qa/testembed folder).
2. Select Tools > TestYourMethod. Currently, the test code is there. Will be
moved later on and will indicate new location.
3. Blast through the modal OKs.
4. Notice that SetProperty() returns rv passed for all cases (2nd parameter is
PR_TRUE or PR_FALSE).
5. Now enter some other values for the 2nd aValue parameter. Try "1.5" and
"2.0". Recompile and relaunch.

source:
	nsCOMPtr <nsIWebBrowserSetup> qaWBSetup(do_QueryInterface(qaWebBrowser, &rv));
	RvTestResult(rv, "nsIWebBrowserSetup object test", 2);

	rv = qaWBSetup->SetProperty(nsIWebBrowserSetup::SETUP_ALLOW_PLUGINS, 2);
	RvTestResult(rv, "nsIWBSetup:SetProperty(SETUP_ALLOW_PLUGINS,2)", 2);

Result: ANY value less than 2.0 works. (e.g. 1.99).
Expected: Either consistent boolean usage screening out all other values, or
some explained functional associated values for 2nd parameter.
change qa contact to depstein
QA Contact: mdunn → depstein
The method nsIWebBrowserSetup::setProperty is defined like this:

void setProperty(in unsigned long aId, in unsigned long aValue);

The property id is a long, and the value is a longs. Longs are integers so
supplying reals such as 1.5 will automatically be cast into a long by the
compiler. The permissible values are property specific but most of our
properties are booleans and should reject values other than PR_TRUE(1) and
PR_FALSE(0).

A glance at the impl of this interface suggests that we are doing the property
checking to ensure bad values are caught.

http://lxr.mozilla.org/seamonkey/source/embedding/browser/webBrowser/nsWebBrowser.cpp#690
OK, so it appears the properties are recasting to 0 or 1 depending on the value
between 0 and 2. All the property IDs, with the exception of
SETUP_FOCUS_DOC_BEFORE_CONTENT (which the idl file says is obsolete) return rv
false for values >= 2. So if this is intended behavior, I'd take it to mean that
all the properties accept only boolean on/off switching. Otherwise, an
individual property might accept values >= 2 as well, which doesn't appear to be
the case wrt the enabling/disabling descriptions in the idl.
Documentation for nsIWebBrowserSetup should make clear which of these properties
are actually booleans.
Summary: some inconsistencies with nsIWebBrowserSetup->SetProperty aValues → clarify nsIWebBrowserSetup documentation
Target Milestone: --- → mozilla1.1alpha
Attached patch Updated commentsSplinter Review
Looking for a quick r/sr on these documentation only changes
Comment on attachment 85786 [details] [diff] [review]
Updated comments

sr=rpotts@netscape.com
Attachment #85786 - Flags: superreview+
Ellen or David, can you review the changes please?
Attachment #85786 - Flags: review+
Fix checked in
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Changes now reflected in API ref
verified. Mozilla 1.1a Gecko/20020607 build.
Status: RESOLVED → VERIFIED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: