Closed Bug 310021 Opened 19 years ago Closed 19 years ago

When Java is disabled in preferences, shouldn't claim we support it

Categories

(Core Graveyard :: Plug-ins, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla1.9alpha1

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

Details

Attachments

(1 file, 2 obsolete files)

If Java is disabled in preferences, the plugin host will still claim that
plugins for the relevant types are enabled; it'll get pretty far into
InstantiateEmbeddedPlugin before detecting that we're Java and it's disabled and
bailing out.

I think we should really be checking this much earlier, both earlier in
instantiation and checking in IsPluginEnabledForType.
Blocks: 309237
Depends on: 306417
No longer depends on: 306417
Attached patch Proposed patch (obsolete) — Splinter Review
This tries to keep the java plugin out of our list altogether if it's disabled,
but if we can't take it out (because we've already loaded it this session),
just marks it disabled so it's not used.  The change to nsPluginModule is just
to fix the issue with two nsPluginHostImpls being created that I ran into... :(
Attachment #199015 - Flags: superreview?(jst)
Attachment #199015 - Flags: review?(cbiesinger)
Blocks: 306417
Attached patch Updated to tip (obsolete) — Splinter Review
Attachment #199015 - Attachment is obsolete: true
Attachment #199015 - Flags: superreview?(jst)
Attachment #199015 - Flags: review?(cbiesinger)
Comment on attachment 200417 [details] [diff] [review]
Updated to tip

This is just a merge to jst's changes to IsPluginEnabledForExtension.
Attachment #200417 - Flags: superreview?(jst)
Attachment #200417 - Flags: review?(cbiesinger)
When this lands we should back out the fix for bug 311791 on trunk, probably.
Comment on attachment 200417 [details] [diff] [review]
Updated to tip

- In nsPluginHostImpl.cpp:

+#define NS_PLUGIN_FLAG_ENABLED    0x0001    //is this plugin enabled?
+#define NS_PLUGIN_FLAG_OLDSCHOOL  0x0002    //is this a pre-xpcom plugin?
+#define NS_PLUGIN_FLAG_FROMCACHE  0x0004    // this plugintag info was loaded from ache
+#define NS_PLUGIN_FLAG_UNWANTED   0x0008    // this is an unwanted plugin

Wanna add spaces after the two first //'s here, even if you're just moving this code?

+  PRBool HasFlag(PRUint32 flag) { return (mFlags & flag) != 0; }

Now that we've got this, maybe we should mark mFlags protected to make sure it's not touched directly? Or is there a reason not to do that?

sr=jst
Attachment #200417 - Flags: superreview?(jst) → superreview+
> maybe we should mark mFlags protected to make sure it's not touched directly?

Did that.  I had to add a Flags() accessor to make serialization to the plugin registry file work... That code should really move into a method on nsPluginTag, probably.  :(
Comment on attachment 200417 [details] [diff] [review]
Updated to tip


nsPluginHostImpl.cpp:
+nsPluginHostImpl::GetInst()
+  NS_IF_ADDREF(sInst);
+  return sInst;

sInst is never null at this point...

     Destroy();
     UnloadUnusedLibraries();
+    NS_RELEASE(sInst);

Hmm, this set sInst to nsnull... is that a good idea? wouldn't it be better to
do that in the destructor?

TrySetupPluginInstance:
+  if(!aMimeType || !(pluginTag = FindPluginForType(aMimeType, PR_TRUE))) {

FindPluginForType handles a null type just fine, and I think lines like this one
would be easier readable if you made use of that:

 nsPluginTag* pluginTag = FindPluginForType(aMimeType, PR_TRUE);
 if (!tag) {
  ...
 }

InstantiateEmbeddedPlugin
-    if((!aMimeType || !isJava) && bCanHandleInternally)
+    if(!isJava && bCanHandleInternally)

Hm... why is this change correct?

nsPluginHostImpl.h:
+    // Remove mime types added to the catagory manager only if we were

catagory -> category :) (twice, actually)



+  nsPluginTag();  // Not to be implemented

So er... why declare this at all? If you have a custom constructor, the default
constructor will not be autogenerated (only the copy constructor will)
Attachment #200417 - Flags: review?(cbiesinger) → review+
> sInst is never null at this point...

It could be if AddPrefObserver failed, but I've added an early return in that case now and made the addref not use IF.

> Hmm, this set sInst to nsnull... is that a good idea? wouldn't it be better to
> do that in the destructor?

Hmm... I guess so, sure.

> FindPluginForType handles a null type just fine

Good catch.

> Hm... why is this change correct?

  (!aMimeType || !isJava) == !(aMimeType && isJava).

But isJava is only true if aMimeType is non-null (both before and after my changes).  So 

  (aMimeType && isJava) == isJava

which is what I changed to here.

> catagory -> category :) (twice, actually)

That's what I get for copy/pasting comments.  ;)

> So er... why declare this at all?

Indeed.  Removed.
Attachment #200417 - Attachment is obsolete: true
Related to bug 210724?
Not really.
Assignee: nobody → bzbarsky
Target Milestone: --- → mozilla1.9alpha
Fixed.
Status: NEW → RESOLVED
Closed: 19 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

Created:
Updated:
Size: