Closed Bug 295247 Opened 19 years ago Closed 19 years ago

Allow extensions to ship plugin DLLs

Categories

(Toolkit :: Startup and Profile System, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla1.8beta3

People

(Reporter: benjamin, Assigned: benjamin)

Details

Attachments

(2 files, 2 obsolete files)

Extension should be able to ship plugin DLLs. This bug will be divided into two
patches: the first is a core patch to the directory service which allows
dirserviceprovider2.getFiles to union its results with those returned by "lower"
providers. The second are the nsXREDirProvider bits necessary to add an
<extension>/plugins location.

Jens.b, I cc'ed you on this so you could see how I add an extra extension location.
This also cleans up and unifies some of the GetFiles code for codesize, and
adds <xulappdir>/chrome.manifest to match extension packaging.
Attachment #184331 - Flags: first-review?(darin)
Whitespace is a little screwy in the XPCOM patch, I have fixed that locally.
Comment on attachment 184327 [details] [diff] [review]
Add NS_SUCCESS_AGGREGATE_RESULT to nsIDirectoryServiceProvider2.getFiles, rev. 1

>Index: xpcom/io/nsDirectoryService.cpp

>+          nsCOMPtr<nsISimpleEnumerator> newFiles;
>+          rv = prov2->GetFiles(fileData->property, getter_AddRefs(newFiles));
>+          if (NS_SUCCEEDED(rv) && newFiles) {
>+              if (fileData->data) {
>+                  NS_NewUnionEnumerator((nsISimpleEnumerator**) &fileData->data,
>+                                        (nsISimpleEnumerator*) fileData->data, newFiles);

shouldn't you check for NS_SUCCESS_AGGREGATE_RESULT?


>+              }
>+                  
>+          	  fileData->persistent = PR_FALSE; // Enumerators can never be persistent
>+              return rv == NS_SUCCESS_AGGREGATE_RESULT;
>           }

indentation is off.  kill tabs.


>Index: xpcom/io/nsIDirectoryService.idl

>+  * @returnCode         NS_SUCCESS_AGGREGATE_RESULT if this result should be
>+  *                     aggregated with other "lower" providers.
>   */
>   nsISimpleEnumerator getFiles(in string prop);
> };

"@returnCode" -- ok.  "@throws" is obviously wrong.  hope people won't
be confused with "@returns"
Attachment #184327 - Flags: first-review?(darin) → first-review-
Attachment #184331 - Flags: first-review?(darin) → first-review+
This patch fixes the whitespace.

I shouldn't check for the NS_SUCCESS_AGGREGATE_RESULT code against a
pre-existing fileData->data because it's the *previous* provider that has
already returned NS_SUCCESS_AGGREGATE_RESULT.
Attachment #184327 - Attachment is obsolete: true
Attachment #184342 - Flags: first-review?(darin)
> I shouldn't check for the NS_SUCCESS_AGGREGATE_RESULT code against a
> pre-existing fileData->data because it's the *previous* provider that has
> already returned NS_SUCCESS_AGGREGATE_RESULT.

OK, I see what you mean.  This is somewhat troubling.  Returning
NS_SUCCESS_AGGREGATE_RESULT is not enough to ensure that your files are
aggregated into the return value from the Directory Service query.  It only
works if you are inspected before other providers.  But, how can a provider
ensure its position relative to other providers?

Perhaps all providers should be inspected, and then merge the results of all
that return NS_SUCCESS_AGGREGATE_RESULT with the topmost one that doesn't.
Well, we don't have a good way to add dirserviceproviders, since most of them
need to be added before XPCOM registration in order to be effective. It happens
that they are registered in the order

[default nsAppDirServiceProvider]
[provider passed to NS_InitXPCOM2]
[provider registered with nsIDirectoryService.registerProvider]
[more providers registered with nsIDirectoryService.registerProvider]

Very few people currently use the registerProvider method, and those do not have
a GetFiles method. In the future I plan to add a category from which providers
are read in order, but this at least meets our current needs.
I was worried not so much about startup, but rather about what happens later on.
 Maybe we can punt on the issue since getFiles being called would mean that the
"aggregate return code" would be honored given the current patch.  OK.
Attachment #184342 - Flags: first-review?(darin) → first-review+
Whoops, my previous patch caused a leak by never releasing fileData->data when
a union enumerator was successfully created.
Attachment #184342 - Attachment is obsolete: true
Attachment #184352 - Flags: first-review?(darin)
Comment on attachment 184352 [details] [diff] [review]
Add NS_SUCCESS_AGGREGATE_RESULT to nsIDirectoryServiceProvider2.getFiles, rev. 2

>Index: xpcom/io/nsDirectoryService.cpp

>+                  if (unionFiles)
>+                      unionFiles.swap(* (nsISimpleEnumerator**) &fileData->data);

FYI, I recall having trouble compiling something like this on Windows
with MS VC6.  I ended up making a temporary variable to get around the
problem.
Attachment #184352 - Flags: first-review?(darin) → first-review+
Attachment #184352 - Flags: approval1.8b3?
Attachment #184352 - Flags: approval-aviary1.1a2?
Attachment #184331 - Flags: approval1.8b3?
Attachment #184331 - Flags: approval-aviary1.1a2?
Priority: -- → P2
Comment on attachment 184352 [details] [diff] [review]
Add NS_SUCCESS_AGGREGATE_RESULT to nsIDirectoryServiceProvider2.getFiles, rev. 2

a=shaver (x2)
Attachment #184352 - Flags: approval1.8b3?
Attachment #184352 - Flags: approval1.8b3+
Attachment #184352 - Flags: approval-aviary1.1a2?
Attachment #184352 - Flags: approval-aviary1.1a2+
Comment on attachment 184331 [details] [diff] [review]
Add <xreapp>/plugins and <extension>/plugins, rev. 1

a=shaver
Attachment #184331 - Flags: approval1.8b3?
Attachment #184331 - Flags: approval1.8b3+
Attachment #184331 - Flags: approval-aviary1.1a2?
Attachment #184331 - Flags: approval-aviary1.1a2+
Fixed on trunk for 1.8b3
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.8beta3
Component: XRE Startup → Startup and Profile System
QA Contact: nobody → startup
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: