Closed Bug 522400 Opened 13 years ago Closed 13 years ago

Calling invokedefault on scriptable plugin object yields NS_ERROR_NOT_AVAILABLE

Categories

(Core Graveyard :: Plug-ins, defect)

defect
Not set
normal

Tracking

(status1.9.2 .4-fixed)

RESOLVED FIXED
Tracking Status
status1.9.2 --- .4-fixed

People

(Reporter: jgriffin, Assigned: jgriffin)

References

Details

(Whiteboard: [fixed-lorentz])

Attachments

(2 files)

If a scriptable plugin object implements the invokedefault method, attempting to call it from script will cause an NS_ERROR_NOT_AVAILABLE exception to be thrown.

This appears to be due to a typo in nsHTMLPluginObjElementSH::Call:

  // If obj is a native wrapper, or if there's no plugin around for
  // this object, throw.
  if (!ObjectIsNativeWrapper(cx, obj) || !pi) {
    return NS_ERROR_NOT_AVAILABLE;
  }

Note that the comment and the code are opposite...the code actually checks that obj is NOT a native wrapper.  Fixing this (per the attached patch), allows invokedefault to work properly.
Attached patch patchSplinter Review
Attachment #406366 - Flags: review?(joshmoz)
Attached patch mochitestSplinter Review
This is a mochitest and related changes to the test plugin which reproduce the problem, and which passes with the patch.
Make sure to update the README when you add features to the test plugin. Also, great catch, testing FTW!
Attachment #406366 - Flags: review?(joshmoz) → review?(jst)
Comment on attachment 406366 [details] [diff] [review]
patch

Duh! :)

Nice catch!
Attachment #406366 - Flags: superreview+
Attachment #406366 - Flags: review?(jst)
Attachment #406366 - Flags: review+
Assignee: nobody → jgriffin
Status: NEW → ASSIGNED
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Blanket approval for Lorentz merge to mozilla-1.9.2
a=beltzner for 1.9.2.4 - please make sure to mark status1.9.2:.4-fixed
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.