Changeset 87361 in webkit
- Timestamp:
- May 25, 2011 11:20:35 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r87360 r87361 1 2011-05-25 James Simonsen <simonjam@chromium.org> 2 3 Reviewed by Adam Barth. 4 5 Add site-specific hack for zipcar.com with old versions of requirejs. 6 https://bugs.webkit.org/show_bug.cgi?id=61321 7 8 Old versions of requirejs (< 0.15.0) try to load scripts in parallel but execute them in 9 order. This used to work in webkit by setting a bogus script type (script/cache), then 10 changing the type to a valid one when they wanted to execute it. This hack translates the 11 behavior into the new API (by disabling forceAsync). 12 13 * html/HTMLScriptElement.cpp: 14 (WebCore::needsOldRequirejsQuirk): Added. 15 (WebCore::HTMLScriptElement::insertedIntoDocument): 16 If hack is needed, set a proper script type so script loads. 17 If script isn't async, disable forceAsync so script executes in order. 18 1 19 2011-05-25 Andreas Kling <kling@webkit.org> 2 20 -
trunk/Source/WebCore/html/HTMLScriptElement.cpp
r84357 r87361 30 30 #include "HTMLNames.h" 31 31 #include "ScriptEventListener.h" 32 #include "Settings.h" 32 33 #include "Text.h" 33 34 … … 82 83 } 83 84 85 static bool needsOldRequirejsQuirk(HTMLScriptElement* element) 86 { 87 if (element->fastGetAttribute(typeAttr) != "script/cache") 88 return false; 89 90 Document* document = element->document(); 91 92 const KURL& url = document->url(); 93 if (!equalIgnoringCase(url.host(), "www.zipcar.com")) 94 return false; 95 96 Settings* settings = document->settings(); 97 if (!settings) 98 return false; 99 if (!settings->needsSiteSpecificQuirks()) 100 return false; 101 102 return true; 103 } 104 84 105 void HTMLScriptElement::insertedIntoDocument() 85 106 { 107 if (needsOldRequirejsQuirk(this)) { 108 if (!asyncAttributeValue()) 109 handleAsyncAttribute(); // Clear forceAsync, so this script loads in parallel, but executes in order. 110 setAttribute(typeAttr, "text/javascript"); 111 } 86 112 HTMLElement::insertedIntoDocument(); 87 113 ScriptElement::insertedIntoDocument();
Note: See TracChangeset
for help on using the changeset viewer.