OLD | NEW |
1 /* | 1 /* |
2 IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Ap
ple") in | 2 IMPORTANT: This Apple software is supplied to you by Apple Computer, Inc. ("Ap
ple") in |
3 consideration of your agreement to the following terms, and your use, installat
ion, | 3 consideration of your agreement to the following terms, and your use, installat
ion, |
4 modification or redistribution of this Apple software constitutes acceptance of
these | 4 modification or redistribution of this Apple software constitutes acceptance of
these |
5 terms. If you do not agree with these terms, please do not use, install, modif
y or | 5 terms. If you do not agree with these terms, please do not use, install, modif
y or |
6 redistribute this Apple software. | 6 redistribute this Apple software. |
7 | 7 |
8 In consideration of your agreement to abide by the following terms, and subject
to these | 8 In consideration of your agreement to abide by the following terms, and subject
to these |
9 terms, Apple grants you a personal, non-exclusive license, under Apple’s copyri
ghts in | 9 terms, Apple grants you a personal, non-exclusive license, under Apple’s copyri
ghts in |
10 this original Apple software (the "Apple Software"), to use, reproduce, modify
and | 10 this original Apple software (the "Apple Software"), to use, reproduce, modify
and |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 pluginFuncs->getvalue = NPP_GetValue; | 136 pluginFuncs->getvalue = NPP_GetValue; |
137 pluginFuncs->setvalue = NPP_SetValue; | 137 pluginFuncs->setvalue = NPP_SetValue; |
138 | 138 |
139 return NPERR_NO_ERROR; | 139 return NPERR_NO_ERROR; |
140 } | 140 } |
141 | 141 |
142 void NPAPI NP_Shutdown(void) | 142 void NPAPI NP_Shutdown(void) |
143 { | 143 { |
144 } | 144 } |
145 | 145 |
| 146 static void executeScript(const PluginObject* obj, const char* script); |
| 147 |
146 NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, ch
ar *argn[], char *argv[], NPSavedData *saved) | 148 NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, ch
ar *argn[], char *argv[], NPSavedData *saved) |
147 { | 149 { |
148 if (browser->version >= 14) { | 150 if (browser->version >= 14) { |
149 PluginObject* obj = (PluginObject*)browser->createobject(instance, getPl
uginClass()); | 151 PluginObject* obj = (PluginObject*)browser->createobject(instance, getPl
uginClass()); |
150 | 152 |
151 for (int i = 0; i < argc; i++) { | 153 for (int i = 0; i < argc; i++) { |
152 if (strcasecmp(argn[i], "onstreamload") == 0 && !obj->onStreamLoad) | 154 if (strcasecmp(argn[i], "onstreamload") == 0 && !obj->onStreamLoad) |
153 obj->onStreamLoad = strdup(argv[i]); | 155 obj->onStreamLoad = strdup(argv[i]); |
154 else if (strcasecmp(argn[i], "onStreamDestroy") == 0 && !obj->onStre
amDestroy) | 156 else if (strcasecmp(argn[i], "onStreamDestroy") == 0 && !obj->onStre
amDestroy) |
155 obj->onStreamDestroy = strdup(argv[i]); | 157 obj->onStreamDestroy = strdup(argv[i]); |
156 else if (strcasecmp(argn[i], "onURLNotify") == 0 && !obj->onURLNotif
y) | 158 else if (strcasecmp(argn[i], "onURLNotify") == 0 && !obj->onURLNotif
y) |
157 obj->onURLNotify = strdup(argv[i]); | 159 obj->onURLNotify = strdup(argv[i]); |
158 else if (strcasecmp(argn[i], "logfirstsetwindow") == 0) | 160 else if (strcasecmp(argn[i], "logfirstsetwindow") == 0) |
159 obj->logSetWindow = TRUE; | 161 obj->logSetWindow = TRUE; |
160 else if (strcasecmp(argn[i], "logSrc") == 0) { | 162 else if (strcasecmp(argn[i], "logSrc") == 0) { |
161 for (int i = 0; i < argc; i++) { | 163 for (int i = 0; i < argc; i++) { |
162 if (strcasecmp(argn[i], "src") == 0) { | 164 if (strcasecmp(argn[i], "src") == 0) { |
163 log(instance, "src: %s", argv[i]); | 165 log(instance, "src: %s", argv[i]); |
164 fflush(stdout); | 166 fflush(stdout); |
165 } | 167 } |
166 } | 168 } |
167 } | 169 } else if (strcasecmp(argn[i], "cleardocumentduringnew") == 0) |
| 170 executeScript(obj, "document.body.innerHTML = ''"); |
168 } | 171 } |
169 | 172 |
170 instance->pdata = obj; | 173 instance->pdata = obj; |
171 } | 174 } |
172 | 175 |
173 // On Windows and Unix, plugins only get events if they are windowless. | 176 // On Windows and Unix, plugins only get events if they are windowless. |
174 return browser->setvalue(instance, NPPVpluginWindowBool, NULL); | 177 return browser->setvalue(instance, NPPVpluginWindowBool, NULL); |
175 } | 178 } |
176 | 179 |
177 NPError NPP_Destroy(NPP instance, NPSavedData **save) | 180 NPError NPP_Destroy(NPP instance, NPSavedData **save) |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 const char* NP_GetMIMEDescription(void) { | 504 const char* NP_GetMIMEDescription(void) { |
502 // The layout test LayoutTests/fast/js/navigator-mimeTypes-length.html | 505 // The layout test LayoutTests/fast/js/navigator-mimeTypes-length.html |
503 // asserts that the number of mimetypes handled by plugins should be | 506 // asserts that the number of mimetypes handled by plugins should be |
504 // greater than the number of plugins. This isn't true if we're | 507 // greater than the number of plugins. This isn't true if we're |
505 // the only plugin and we only handle one mimetype, so specify | 508 // the only plugin and we only handle one mimetype, so specify |
506 // multiple mimetypes here. | 509 // multiple mimetypes here. |
507 return "application/x-webkit-test-netscape:testnetscape:test netscape conten
t;" | 510 return "application/x-webkit-test-netscape:testnetscape:test netscape conten
t;" |
508 "application/x-webkit-test-netscape2:testnetscape2:test netscape cont
ent2"; | 511 "application/x-webkit-test-netscape2:testnetscape2:test netscape cont
ent2"; |
509 } | 512 } |
510 #endif | 513 #endif |
OLD | NEW |