Closed Bug 273056 Opened 21 years ago Closed 20 years ago

PluginArrayImpl::GetLength should not throw if there's no plugin host, and PluginArrayImpl::GetPlugins should handle no plugin host and failure from mPluginHost->GetPlugins

Categories

(Core Graveyard :: Plug-ins, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: timeless, Assigned: timeless)

References

()

Details

Attachments

(1 file)

Error: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMPluginArray.length]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: javascript: navigator.plugins.length :: <TOP_LEVEL> :: line 1" data: no] Error: uncaught exception: [Exception... "Failure" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: javascript: navigator.plugins[0] :: <TOP_LEVEL> :: line 1" data: no] Error: uncaught exception: [Exception... "Failure" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: javascript: navigator.plugins.test :: <TOP_LEVEL> :: line 1" data: no]
Attachment #167783 - Flags: superreview?(jst)
Comment on attachment 167783 [details] [diff] [review] fix PluginArrayImpl. also clean up idl sr=jst
Attachment #167783 - Flags: superreview?(jst) → superreview+
Comment on attachment 167783 [details] [diff] [review] fix PluginArrayImpl. also clean up idl >Index: dom/src/base/nsPluginArray.cpp > mPluginArray = new nsIDOMPlugin*[mPluginCount]; >+ if (!mPluginArray) >+ return NS_ERROR_OUT_OF_MEMORY; >+ >+ if (!mPluginCount) >+ return NS_OK; I'd prefer the mPluginCount check first, so we don't even allocate mPluginArray when the plugin count is 0. All accesses to mPluginArray check mPluginCount, so it should be ok. With that, r=bzbarsky.
Attachment #167783 - Flags: review+
mozilla/modules/plugin/base/src/nsPluginHostImpl.cpp 1.513 mozilla/modules/plugin/base/src/nsPluginHostImpl.h 1.96 mozilla/dom/src/base/nsPluginArray.cpp 1.28 mozilla/modules/plugin/base/public/nsIPluginHost.idl 1.3 i explained to bz why his suggestion doesn't work, and he was fine with it.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
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: