Changeset 30236 in webkit
- Timestamp:
- Feb 14, 2008 4:30:24 PM (16 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r30233 r30236 1 2008-02-14 Alp Toker <alp@atoker.com> 2 3 Reviewed by Darin. 4 5 http://bugs.webkit.org/show_bug.cgi?id=17353 6 XMLTokenizer installs global libxml2 callbacks that can break client applications 7 8 Patch by Mark Rowe (with a few changes). 9 10 The xmlRegisterInputCallbacks/xmlRegisterOutputCallbacks done at 11 init are global so we need to make sure these callbacks only get used 12 by XMLTokenizer and never by libxml2 calls in user applications. 13 14 This patch modifies the match and open functions to only apply when we 15 are certain the caller is XMLTokenizer by checking globalDocLoader and 16 ensuring we're on the correct thread. 17 18 Some possible issues remain. See the bug report for details. 19 20 * dom/XMLTokenizer.cpp: 21 (WebCore::matchFunc): 22 (WebCore::openFunc): 23 (WebCore::createStringParser): 24 1 25 2008-02-14 Timothy Hatcher <timothy@apple.com> 2 26 -
trunk/WebCore/dom/XMLTokenizer.cpp
r30112 r30236 48 48 #include "ResourceRequest.h" 49 49 #include "ResourceResponse.h" 50 #include "Threading.h" 50 51 #ifndef USE_QXMLSTREAM 51 52 #include <libxml/parser.h> … … 341 342 342 343 static int globalDescriptor = 0; 344 static DocLoader* globalDocLoader = 0; 345 static ThreadIdentifier libxmlLoaderThread = 0; 343 346 344 347 static int matchFunc(const char* uri) 345 348 { 346 return 1; // Match everything.347 } 348 349 static DocLoader* globalDocLoader = 0; 349 // Only match loads initiated due to uses of libxml2 from within XMLTokenizer to avoid 350 // interfering with client applications that also use libxml2. http://bugs.webkit.org/show_bug.cgi?id=17353 351 return globalDocLoader && currentThread() == libxmlLoaderThread; 352 } 350 353 351 354 class OffsetBuffer { … … 378 381 static void* openFunc(const char* uri) 379 382 { 380 if (!globalDocLoader || !shouldAllowExternalLoad(uri)) 383 ASSERT(globalDocLoader); 384 ASSERT(currentThread() == libxmlLoaderThread); 385 386 if (!shouldAllowExternalLoad(uri)) 381 387 return &globalDescriptor; 382 388 … … 385 391 Vector<char> data; 386 392 387 if (globalDocLoader->frame()) 388 globalDocLoader->frame()->loader()->loadResourceSynchronously(KURL(uri), error, response, data); 393 DocLoader* docLoader = globalDocLoader; 394 globalDocLoader = 0; 395 // FIXME: We should restore the original global error handler as well. 396 397 if (docLoader->frame()) 398 docLoader->frame()->loader()->loadResourceSynchronously(KURL(uri), error, response, data); 399 400 globalDocLoader = docLoader; 389 401 390 402 return new OffsetBuffer(data); … … 433 445 xmlRegisterInputCallbacks(matchFunc, openFunc, readFunc, closeFunc); 434 446 xmlRegisterOutputCallbacks(matchFunc, openFunc, writeFunc, closeFunc); 447 libxmlLoaderThread = currentThread(); 435 448 didInit = true; 436 449 }
Note: See TracChangeset
for help on using the changeset viewer.