Title: [87549] branches/safari-534-branch/Source/WebCore
- Revision
- 87549
- Author
- mr...@apple.com
- Date
- 2011-05-27 13:37:48 -0700 (Fri, 27 May 2011)
Log Message
Merge r87361.
Modified Paths
Diff
Modified: branches/safari-534-branch/Source/WebCore/ChangeLog (87548 => 87549)
--- branches/safari-534-branch/Source/WebCore/ChangeLog 2011-05-27 20:35:09 UTC (rev 87548)
+++ branches/safari-534-branch/Source/WebCore/ChangeLog 2011-05-27 20:37:48 UTC (rev 87549)
@@ -1,5 +1,27 @@
2011-05-27 Mark Rowe <mr...@apple.com>
+ Merge r87361.
+
+ 2011-05-25 James Simonsen <simon...@chromium.org>
+
+ Reviewed by Adam Barth.
+
+ Add site-specific hack for zipcar.com with old versions of requirejs.
+ https://bugs.webkit.org/show_bug.cgi?id=61321
+
+ Old versions of requirejs (< 0.15.0) try to load scripts in parallel but execute them in
+ order. This used to work in webkit by setting a bogus script type (script/cache), then
+ changing the type to a valid one when they wanted to execute it. This hack translates the
+ behavior into the new API (by disabling forceAsync).
+
+ * html/HTMLScriptElement.cpp:
+ (WebCore::needsOldRequirejsQuirk): Added.
+ (WebCore::HTMLScriptElement::insertedIntoDocument):
+ If hack is needed, set a proper script type so script loads.
+ If script isn't async, disable forceAsync so script executes in order.
+
+2011-05-27 Mark Rowe <mr...@apple.com>
+
Merge r87244.
2011-05-24 Andy Estes <aes...@apple.com>
Modified: branches/safari-534-branch/Source/WebCore/html/HTMLScriptElement.cpp (87548 => 87549)
--- branches/safari-534-branch/Source/WebCore/html/HTMLScriptElement.cpp 2011-05-27 20:35:09 UTC (rev 87548)
+++ branches/safari-534-branch/Source/WebCore/html/HTMLScriptElement.cpp 2011-05-27 20:37:48 UTC (rev 87549)
@@ -29,6 +29,7 @@
#include "EventNames.h"
#include "HTMLNames.h"
#include "ScriptEventListener.h"
+#include "Settings.h"
#include "Text.h"
namespace WebCore {
@@ -81,8 +82,33 @@
HTMLElement::parseMappedAttribute(attr);
}
+static bool needsOldRequirejsQuirk(HTMLScriptElement* element)
+{
+ if (element->fastGetAttribute(typeAttr) != "script/cache")
+ return false;
+
+ Document* document = element->document();
+
+ const KURL& url = ""
+ if (!equalIgnoringCase(url.host(), "www.zipcar.com"))
+ return false;
+
+ Settings* settings = document->settings();
+ if (!settings)
+ return false;
+ if (!settings->needsSiteSpecificQuirks())
+ return false;
+
+ return true;
+}
+
void HTMLScriptElement::insertedIntoDocument()
{
+ if (needsOldRequirejsQuirk(this)) {
+ if (!asyncAttributeValue())
+ handleAsyncAttribute(); // Clear forceAsync, so this script loads in parallel, but executes in order.
+ setAttribute(typeAttr, "text/_javascript_");
+ }
HTMLElement::insertedIntoDocument();
ScriptElement::insertedIntoDocument();
}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes