Changeset 50607 in webkit
- Timestamp:
- Nov 6, 2009 3:00:44 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r50605 r50607 1 2009-11-06 Anantanarayanan G Iyengar <ananta@chromium.org> 2 3 Reviewed by Adam Barth. 4 5 Added layout tests to test document.open and window.open calls issued 6 by NPAPI plugins without a calling javascript context. The associated 7 webkit bug is https://bugs.webkit.org/show_bug.cgi?id=31067, which 8 affects Chromium. 9 10 * plugins/document-open-expected.txt: Added. 11 * plugins/document-open.html: Added. 12 * plugins/window-open-expected.txt: Added. 13 * plugins/window-open.html: Added. 14 1 15 2009-11-06 Steve Block <steveblock@google.com> 2 16 -
trunk/WebCore/ChangeLog
r50605 r50607 1 2009-11-06 Anantanarayanan G Iyengar <ananta@chromium.org> 2 3 Reviewed by Adam Barth. 4 5 The associated webkit bug is https://bugs.webkit.org/show_bug.cgi?id=31067, 6 which affects Chromium only. 7 8 Changes to V8HTMLDocumentCustom.cpp are as below:- 9 1. The HTMLDocumentOpen function would cause a crash in Chromium if 10 there was no calling javascript context. We now check for this case 11 and pass in NULL to the HTMLDocument::open function which can handle 12 a NULL document parameter. 13 2. The other functions like HTMLDocumentWrite, HTMLDocumentWriteln, etc 14 had ASSERTS for a NULL caller frame, which was bogus as it would crash 15 anyway. We now check for this case and return a failure. 16 17 Changes to V8DOMWindowCustom.cpp are as below:- 18 1. Instead of failing the window.open call made by NPAPI for lack of a 19 calling javascript context, we now use the entered context as the calling 20 context. 21 22 Tests: plugins/document-open.html 23 plugins/window-open.html 24 25 * bindings/v8/custom/V8DOMWindowCustom.cpp: 26 (WebCore::CALLBACK_FUNC_DECL): 27 * bindings/v8/custom/V8HTMLDocumentCustom.cpp: 28 (WebCore::CALLBACK_FUNC_DECL): 29 1 30 2009-11-06 Steve Block <steveblock@google.com> 2 31 -
trunk/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
r50603 r50607 703 703 return v8::Undefined(); 704 704 705 Frame* callingFrame = V8Proxy::retrieveFrameForCallingContext();706 if (!callingFrame)707 return v8::Undefined();708 709 705 Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext(); 710 706 if (!enteredFrame) 711 707 return v8::Undefined(); 708 709 Frame* callingFrame = V8Proxy::retrieveFrameForCallingContext(); 710 // We may not have a calling context if we are invoked by a plugin via NPAPI. 711 if (!callingFrame) 712 callingFrame = enteredFrame; 712 713 713 714 Page* page = frame->page(); -
trunk/WebCore/bindings/v8/custom/V8HTMLDocumentCustom.cpp
r50027 r50607 121 121 HTMLDocument* htmlDocument = V8DOMWrapper::convertDOMWrapperToNode<HTMLDocument>(args.Holder()); 122 122 Frame* frame = V8Proxy::retrieveFrameForCallingContext(); 123 ASSERT(frame); 124 htmlDocument->write(writeHelperGetString(args), frame->document()); 123 htmlDocument->write(writeHelperGetString(args), frame ? frame->document() : NULL); 125 124 return v8::Undefined(); 126 125 } … … 131 130 HTMLDocument* htmlDocument = V8DOMWrapper::convertDOMWrapperToNode<HTMLDocument>(args.Holder()); 132 131 Frame* frame = V8Proxy::retrieveFrameForCallingContext(); 133 ASSERT(frame); 134 htmlDocument->writeln(writeHelperGetString(args), frame->document()); 132 htmlDocument->writeln(writeHelperGetString(args), frame ? frame->document() : NULL); 135 133 return v8::Undefined(); 136 134 } … … 171 169 172 170 Frame* frame = V8Proxy::retrieveFrameForCallingContext(); 173 htmlDocument->open(frame ->document());171 htmlDocument->open(frame ? frame->document() : NULL); 174 172 // Return the document. 175 173 return args.Holder(); -
trunk/WebKitTools/ChangeLog
r50602 r50607 1 2009-11-06 Anantanarayanan G Iyengar <ananta@chromium.org> 2 3 Reviewed by Adam Barth. 4 5 Added functionality to the layout test plugin to invoke document.open and 6 window.open with default arguments. The associated webkit bug is 7 https://bugs.webkit.org/show_bug.cgi?id=31067, which affects Chromium. Basically 8 window.open and document.open calls issued by NPAPI plugins via NPN_Invoke don't 9 work in Chromium (V8) if there is no calling javascript context. To achieve this 10 effect we invoke these functions in the layout test plugin in the NPP_SetWindow 11 for the window.open test case and in NPP_DestroyStream for the document.open test case. 12 13 * DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp: 14 (testDocumentOpen): 15 (testWindowOpen): 16 (pluginAllocate): 17 * DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h: 18 * DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp: 19 (NPP_New): 20 (NPP_SetWindow): 21 (NPP_DestroyStream): 22 * DumpRenderTree/win/TestNetscapePlugin/main.cpp: 23 (NPP_New): 24 (NPP_SetWindow): 25 (NPP_NewStream): 26 (NPP_DestroyStream): 27 1 28 2009-11-06 Eric Seidel <eric@webkit.org> 2 29 -
trunk/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.cpp
r50470 r50607 642 642 643 643 return browser->construct(obj->npp, NPVARIANT_TO_OBJECT(args[0]), args + 1, argCount - 1, result); 644 } 645 646 bool testDocumentOpen(NPP npp) { 647 NPIdentifier documentId = browser->getstringidentifier("document"); 648 NPIdentifier openId = browser->getstringidentifier("open"); 649 650 NPObject *windowObject = NULL; 651 browser->getvalue(npp, NPNVWindowNPObject, &windowObject); 652 if (!windowObject) 653 return false; 654 655 NPVariant docVariant; 656 browser->getproperty(npp, windowObject, documentId, &docVariant); 657 if (docVariant.type != NPVariantType_Object) 658 return false; 659 660 NPObject *documentObject = NPVARIANT_TO_OBJECT(docVariant); 661 662 NPVariant openArgs[2]; 663 STRINGZ_TO_NPVARIANT("text/html", openArgs[0]); 664 STRINGZ_TO_NPVARIANT("_blank", openArgs[1]); 665 666 NPVariant result; 667 browser->invoke(npp, documentObject, openId, openArgs, 2, &result); 668 browser->releaseobject(documentObject); 669 670 if (result.type == NPVariantType_Object) { 671 browser->releaseobject(result.value.objectValue); 672 pluginLog(npp, "DOCUMENT OPEN SUCCESS"); 673 return true; 674 } 675 return false; 676 } 677 678 bool testWindowOpen(NPP npp) { 679 NPIdentifier openId = browser->getstringidentifier("open"); 680 681 NPObject *windowObject = NULL; 682 browser->getvalue(npp, NPNVWindowNPObject, &windowObject); 683 if (!windowObject) 684 return false; 685 686 NPVariant openArgs[2]; 687 STRINGZ_TO_NPVARIANT("about:blank", openArgs[0]); 688 STRINGZ_TO_NPVARIANT("_blank", openArgs[1]); 689 690 NPVariant result; 691 browser->invoke(npp, windowObject, openId, openArgs, 2, &result); 692 if (result.type == NPVariantType_Object) { 693 browser->releaseobject(result.value.objectValue); 694 pluginLog(npp, "WINDOW OPEN SUCCESS"); 695 return true; 696 } 697 return false; 644 698 } 645 699 … … 734 788 newInstance->lastHeaders = NULL; 735 789 790 newInstance->testDocumentOpenInDestroyStream = FALSE; 791 newInstance->testWindowOpen = FALSE; 792 736 793 return (NPObject*)newInstance; 737 794 } -
trunk/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/PluginObject.h
r50470 r50607 39 39 NPObject* testObject; 40 40 NPStream* stream; 41 NPBool testDocumentOpenInDestroyStream; 42 NPBool testWindowOpen; 41 43 char* onStreamLoad; 42 44 char* onStreamDestroy; … … 57 59 extern void testNPRuntime(NPP npp); 58 60 extern void pluginLog(NPP instance, const char* format, ...); 61 extern bool testDocumentOpen(NPP npp); 62 extern bool testWindowOpen(NPP npp); -
trunk/WebKitTools/DumpRenderTree/TestNetscapePlugIn.subproj/main.cpp
r50470 r50607 108 108 else if (!strcasecmp(argn[i], "ondestroy")) 109 109 obj->onDestroy = strdup(argv[i]); 110 else if (strcasecmp(argn[i], "testdocumentopenindestroystream") == 0) 111 obj->testDocumentOpenInDestroyStream = TRUE; 112 else if (strcasecmp(argn[i], "testwindowopen") == 0) 113 obj->testWindowOpen = TRUE; 110 114 } 111 115 … … 174 178 obj->logSetWindow = false; 175 179 } 180 181 if (obj->testWindowOpen) { 182 testWindowOpen(instance); 183 obj->testWindowOpen = FALSE; 184 } 176 185 } 177 186 … … 217 226 if (obj->onStreamDestroy) 218 227 executeScript(obj, obj->onStreamDestroy); 228 229 if (obj->testDocumentOpenInDestroyStream) { 230 testDocumentOpen(instance); 231 obj->testDocumentOpenInDestroyStream = FALSE; 232 } 219 233 220 234 return NPERR_NO_ERROR; -
trunk/WebKitTools/DumpRenderTree/win/TestNetscapePlugin/main.cpp
r45324 r50607 89 89 if (_stricmp(argn[i], "src") == 0) 90 90 pluginLog(instance, "src: %s", argv[i]); 91 } 91 } else if (_stricmp(argn[i], "testdocumentopenindestroystream") == 0) 92 obj->testDocumentOpenInDestroyStream = TRUE; 93 else if (_stricmp(argn[i], "testwindowopen") == 0) 94 obj->testWindowOpen = TRUE; 92 95 } 93 96 94 97 instance->pdata = obj; 95 98 } 96 99 97 100 return NPERR_NO_ERROR; 98 101 } … … 121 124 NPError NPP_SetWindow(NPP instance, NPWindow *window) 122 125 { 126 PluginObject* obj = static_cast<PluginObject*>(instance->pdata); 127 128 if (obj) { 129 if (obj->testWindowOpen) { 130 testWindowOpen(instance); 131 obj->testWindowOpen = FALSE; 132 } 133 } 134 123 135 return NPERR_NO_ERROR; 124 136 } … … 150 162 if (obj->onStreamLoad) 151 163 executeScript(obj, obj->onStreamLoad); 152 164 153 165 return NPERR_NO_ERROR; 154 166 } … … 160 172 if (obj->onStreamDestroy) 161 173 executeScript(obj, obj->onStreamDestroy); 174 175 if (obj->testDocumentOpenInDestroyStream) { 176 testDocumentOpen(instance); 177 } 162 178 163 179 return NPERR_NO_ERROR;
Note: See TracChangeset
for help on using the changeset viewer.