Changeset 20151 in webkit
- Timestamp:
- Mar 13, 2007 9:53:26 AM (17 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r20148 r20151 1 2007-03-13 Nikolas Zimmermann <zimmermann@kde.org> 2 3 Reviewed by Maciej. 4 5 Fixes: http://bugs.webkit.org/show_bug.cgi?id=12974 6 7 Call forgetGenericContext in JSSVGPathSeg destructor, otherwhise 8 we'll hit an ASSERT in a debug build, when running svg/custom/js-update-path-changes.svg 9 a few dozen times in a single WebKit instance. The ASSERT is good and just warns that 10 there was already a generic context pointer registered, and the new "to be registered" 11 object already exists, but pointing to a different object. That's because garbage collection 12 calls the JSSVGPathSeg destructor, but that didn't cleanup the generic context map. 13 14 Only JSSVGPathSeg is hit by this problem, as it's the only non SVGAnimated* type 15 using the generic context system while using a custom JSSVGPathSegList implementation. 16 17 Also cleanup JSSVGPathSegListCustom code to call the static forgetGenericContext 18 method instead of doing the same using custom code. 19 20 * bindings/js/JSSVGPathSegListCustom.cpp: 21 (WebCore::removeFromPathSegContextMap): 22 (WebCore::JSSVGPathSegList::clear): 23 (WebCore::JSSVGPathSegList::removeItem): 24 * bindings/scripts/CodeGeneratorJS.pm: 25 1 26 2007-03-13 Darin Adler <darin@apple.com> 2 27 -
trunk/WebCore/bindings/js/JSSVGPathSegListCustom.cpp
r19855 r20151 58 58 } 59 59 60 static void removeFromPathSegContextMap( ExecState* exec,SVGPathSegList* list, SVGPathSeg* obj)60 static void removeFromPathSegContextMap(SVGPathSegList* list, SVGPathSeg* obj) 61 61 { 62 ASSERT(exec && exec->dynamicInterpreter());63 Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();64 if (!activeFrame)65 return;66 67 62 const SVGElement* context = list->context(); 68 63 ASSERT(context); 69 64 70 SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0); 71 if (extensions) { 72 if (extensions->hasGenericContext<SVGPathSeg>(obj)) 73 extensions->removeGenericContext<SVGPathSeg>(obj); 74 } 75 65 SVGDocumentExtensions::forgetGenericContext(obj); 76 66 context->notifyAttributeChange(); 77 67 } … … 85 75 unsigned int nr = imp->numberOfItems(); 86 76 for (unsigned int i = 0; i < nr; i++) 87 removeFromPathSegContextMap( exec,imp, imp->getItem(i, ec).get());77 removeFromPathSegContextMap(imp, imp->getItem(i, ec).get()); 88 78 89 79 imp->clear(ec); … … 182 172 183 173 RefPtr<SVGPathSeg> obj(imp->removeItem(index, ec)); 184 removeFromPathSegContextMap( exec,imp, obj.get());174 removeFromPathSegContextMap(imp, obj.get()); 185 175 186 176 KJS::JSValue* result = toJS(exec, obj.get()); -
trunk/WebCore/bindings/scripts/CodeGeneratorJS.pm
r19993 r20151 1 1 # 2 # Copyright (C) 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>2 # Copyright (C) 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 3 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com> 4 4 # Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> … … 167 167 } 168 168 169 sub CreateSVGContextInterfaceName 170 { 171 my $type = shift; 172 173 return $type if $codeGenerator->IsSVGAnimatedType($type); 174 return "SVGPathSeg" if $type =~ /^SVGPathSeg/ and $type ne "SVGPathSegList"; 175 176 return ""; 177 } 178 169 179 sub AddIncludesForType 170 180 { … … 730 740 push(@implContent, "${className}::~$className()\n"); 731 741 732 if ($codeGenerator->IsSVGAnimatedType($interfaceName)) { 733 push(@implContent, "{\n SVGDocumentExtensions::forgetGenericContext<$interfaceName>(m_impl.get());\n"); 742 my $contextInterfaceName = CreateSVGContextInterfaceName($interfaceName); 743 if ($contextInterfaceName ne "") { 744 push(@implContent, "{\n SVGDocumentExtensions::forgetGenericContext<$contextInterfaceName>(m_impl.get());\n"); 734 745 push(@implContent, " ScriptInterpreter::forgetDOMObject(m_impl.get());\n}\n\n"); 735 746 } else { … … 949 960 push(@implContent, " }\n"); # end switch 950 961 962 my $contextInterfaceName = CreateSVGContextInterfaceName($interfaceName); 951 963 if ($interfaceName eq "DOMWindow") { 952 964 push(@implContent, " // FIXME: Hack to prevent unused variable warning -- remove once DOMWindow includes a settable property\n"); 953 965 push(@implContent, " (void)imp;\n"); 954 } elsif ($ interfaceName =~ /^SVGPathSeg/ or $codeGenerator->IsSVGAnimatedType($interfaceName)) {966 } elsif ($contextInterfaceName ne "") { 955 967 push(@implContent, " ASSERT(exec && exec->dynamicInterpreter());\n"); 956 968 push(@implContent, " Frame* activeFrame = static_cast<ScriptInterpreter*>(exec->dynamicInterpreter())->frame();\n"); 957 969 push(@implContent, " if (!activeFrame)\n return;\n\n"); 958 970 push(@implContent, " SVGDocumentExtensions* extensions = (activeFrame->document() ? activeFrame->document()->accessSVGExtensions() : 0);\n"); 959 push(@implContent, " if (extensions && extensions->hasGenericContext<$ interfaceName>(imp)) {\n");960 push(@implContent, " const SVGElement* context = extensions->genericContext<$ interfaceName>(imp);\n");971 push(@implContent, " if (extensions && extensions->hasGenericContext<$contextInterfaceName>(imp)) {\n"); 972 push(@implContent, " const SVGElement* context = extensions->genericContext<$contextInterfaceName>(imp);\n"); 961 973 push(@implContent, " ASSERT(context);\n\n"); 962 974 push(@implContent, " context->notifyAttributeChange();\n");
Note: See TracChangeset
for help on using the changeset viewer.