Closed Bug 748752 Opened 12 years ago Closed 12 years ago

nsNPAPIPlugin check for private browsing value will not work

Categories

(Core Graveyard :: Plug-ins, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla15

People

(Reporter: jdm, Assigned: ehsan.akhgari)

References

Details

Attachments

(1 file, 1 obsolete file)

>::: dom/plugins/base/nsNPAPIPlugin.cpp
>@@ +2136,5 @@
>>    }
>>  
>>    case NPNVprivateModeBool: {
>> +    nsCOMPtr<nsIDocument> doc = GetDocumentFromNPP(npp);
>> +    nsCOMPtr<nsPIDOMWindow> domwindow = do_QueryInterface(doc);
>
>This will always be null.

Looks like this should be |domwindow = doc->GetWindow()| instead.
Attached patch Patch (v1) (obsolete) — Splinter Review
Assignee: nobody → ehsan
Status: NEW → ASSIGNED
Attachment #618300 - Flags: review?(joshmoz)
Every other caller of GetDocumentFromNPP null checks, so we should probably do the same.
Attached patch Patch (v2)Splinter Review
Attachment #618300 - Attachment is obsolete: true
Attachment #618300 - Flags: review?(joshmoz)
Attachment #618516 - Flags: review?(joshmoz)
Comment on attachment 618516 [details] [diff] [review]
Patch (v2)

Review of attachment 618516 [details] [diff] [review]:
-----------------------------------------------------------------

Is this something a test should have caught? We do have an NPAPI private mode test.

dom/plugins/test/mochitest/test_privatemode.xul
Attachment #618516 - Flags: review?(joshmoz) → review+
(In reply to Josh Aas (Mozilla Corporation) from comment #4)
> Comment on attachment 618516 [details] [diff] [review]
> Patch (v2)
> 
> Review of attachment 618516 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> Is this something a test should have caught? We do have an NPAPI private
> mode test.
> 
> dom/plugins/test/mochitest/test_privatemode.xul

I have no idea how to trigger this code in a test...
The problem existed in the NPN_GetValue code, which is tested by queryPrivateModeState (http://mxr.mozilla.org/mozilla-central/source/dom/plugins/test/mochitest/test_privatemode.xul#38). The test as written would pass, since it tests non-PB with qPMS, then tests that entering PB mode triggers an update message for plugin instances via NPN_SetValue (http://mxr.mozilla.org/mozilla-central/source/dom/plugins/test/mochitest/test_privatemode.xul#59). Since it doesn't compare this against the qPMS value, the test doesn't see anything as being wrong. This check should be added to the test, I think.
Flags: in-testsuite?
https://hg.mozilla.org/mozilla-central/rev/bf2eb02383fd
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Depends on: 749795
Josh, you said in bug 749795 that you're working on a test for this, right?
Yes.
Flags: in-testsuite?
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: