зеркало из https://github.com/mozilla/gecko-dev.git
Bugzilla: 51655.
This commit is contained in:
Родитель
25b8e29ff2
Коммит
a7c8f86bad
|
@ -796,17 +796,74 @@ pr_LoadLibraryByPathname(const char *name, PRIntn flags)
|
|||
image_info info;
|
||||
int32 cookie = 0;
|
||||
image_id h = B_ERROR;
|
||||
PRLibrary *p;
|
||||
|
||||
while(get_next_image_info(0, &cookie, &info) == B_OK)
|
||||
if(strcmp(name, info.name + strlen(info.name) - strlen(name)) == 0) {
|
||||
for (p = pr_loadmap; p != NULL; p = p->next) {
|
||||
/* hopefully, our caller will always use the same string
|
||||
to refer to the same library */
|
||||
if (strcmp(name, p->name) == 0) {
|
||||
/* we've already loaded this library */
|
||||
h = info.id;
|
||||
lm->refCount++; /* it has been already loaded implcitly, so pretend it already had a control structure and ref */
|
||||
lm->refCount++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(h == B_ERROR)
|
||||
h = load_add_on( name );
|
||||
if(h == B_ERROR) {
|
||||
/* it appears the library isn't yet loaded - load it now */
|
||||
char stubName [B_PATH_NAME_LENGTH + 1];
|
||||
|
||||
if( h == B_ERROR || h <= 0 ) {
|
||||
/* the following is a work-around to a "bug" in the beos -
|
||||
the beos system loader allows only 32M (system-wide)
|
||||
to be used by code loaded as "add-ons" (code loaded
|
||||
through the 'load_add_on()' system call, which includes
|
||||
mozilla components), but allows 256M to be used by
|
||||
shared libraries.
|
||||
|
||||
unfortunately, mozilla is too large to fit into the
|
||||
"add-on" space, so we must trick the loader into
|
||||
loading some of the components as shared libraries. this
|
||||
is accomplished by creating a "stub" add-on (an empty
|
||||
shared object), and linking it with the component
|
||||
(the actual .so file generated by the build process,
|
||||
without any modifications). when this stub is loaded
|
||||
by load_add_on(), the loader will automatically load the
|
||||
component into the shared library space.
|
||||
*/
|
||||
|
||||
strcpy(stubName, name);
|
||||
strcat(stubName, ".stub");
|
||||
|
||||
/* first, attempt to load the stub (thereby loading the
|
||||
component as a shared library */
|
||||
if ((h = load_add_on(stubName)) > B_ERROR) {
|
||||
/* the stub was loaded successfully. however, the stub
|
||||
itself is useless (so useless, in fact, that we will
|
||||
simply unload it) */
|
||||
unload_add_on(h);
|
||||
h = B_FILE_NOT_FOUND;
|
||||
|
||||
cookie = 0;
|
||||
while (get_next_image_info(0, &cookie, &info) == B_OK) {
|
||||
char *endOfName = info.name + strlen(info.name) - strlen(name);
|
||||
if (endOfName < info.name)
|
||||
continue;
|
||||
|
||||
if (strcmp(name, endOfName) == 0) {
|
||||
/* this is the actual component - remember it */
|
||||
h = info.id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
/* we failed to load the "stub" - try to load the
|
||||
component directly as an add-on */
|
||||
h = load_add_on(name);
|
||||
}
|
||||
}
|
||||
|
||||
if (h <= B_ERROR) {
|
||||
oserr = h;
|
||||
PR_DELETE( lm );
|
||||
goto unlock;
|
||||
|
|
Загрузка…
Ссылка в новой задаче