Reviewed by Darin and Geoff.
- <rdar://problem/
5754378> work around missing video on YouTube front page with a site-specific hack
* WebCore.base.exp: Updated.
* bindings/js/kjs_navigator.cpp:
(WebCore::needsYouTubeQuirk): Added. Return true on Windows only when the quirk is needed.
(WebCore::Navigator::getValueProperty): For the appVersion property, if needsYouTubeQuirk
return true, then return the empty string.
* page/Settings.cpp:
(WebCore::Settings::Settings): Set m_needsSiteSpecificQuirks to false.
(WebCore::Settings::setNeedsSiteSpecificQuirks): Added.
* page/Settings.h: Added m_needsSiteSpecificQuirks.
(WebCore::Settings::needsSiteSpecificQuirks): Added.
WebKit/mac:
Reviewed by Darin and Geoff.
- WebKit part of <rdar://problem/
5754378> work around missing video on YouTube front page with a site-specific hack
* WebView/WebView.mm:
(-[WebView _preferencesChangedNotification:]): Added a call to Settings::setNeedsSiteSpecificQuirks.
There are currently no site-specific quirks on Mac, but we will propagate the state
to WebCore to avoid possible mistakes later.
WebKit/win:
Reviewed by Darin and Geoff.
- WebKit part of <rdar://problem/
5754378> work around missing video on YouTube front page with a site-specific hack
* WebView.cpp:
(WebView::notifyPreferencesChanged): Added a call to Settings::setNeedsSiteSpecificQuirks.
(WebView::setAllowSiteSpecificHacks): Added a comment about the problem Darin noticed, where
after you disable the site-specific hacks they persist until you open a new window or tweak
some other preference.
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@30433
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2008-02-20 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Darin and Geoff.
+
+ - <rdar://problem/5754378> work around missing video on YouTube front page with a site-specific hack
+
+ * WebCore.base.exp: Updated.
+
+ * bindings/js/kjs_navigator.cpp:
+ (WebCore::needsYouTubeQuirk): Added. Return true on Windows only when the quirk is needed.
+ (WebCore::Navigator::getValueProperty): For the appVersion property, if needsYouTubeQuirk
+ return true, then return the empty string.
+
+ * page/Settings.cpp:
+ (WebCore::Settings::Settings): Set m_needsSiteSpecificQuirks to false.
+ (WebCore::Settings::setNeedsSiteSpecificQuirks): Added.
+ * page/Settings.h: Added m_needsSiteSpecificQuirks.
+ (WebCore::Settings::needsSiteSpecificQuirks): Added.
+
2008-02-20 David Hyatt <hyatt@apple.com>
Fix for bug 12751, doctype nodes aren't part of the Document (Acid3).
__ZN7WebCore8Settings25setShouldPrintBackgroundsEb
__ZN7WebCore8Settings25setUserStyleSheetLocationERKNS_4KURLE
__ZN7WebCore8Settings26setDefaultTextEncodingNameERKNS_6StringE
+__ZN7WebCore8Settings26setNeedsSiteSpecificQuirksEb
__ZN7WebCore8Settings27setFTPDirectoryTemplatePathERKNS_6StringE
__ZN7WebCore8Settings27setLoadsImagesAutomaticallyEb
__ZN7WebCore8Settings28setForceFTPDirectoryListingsEb
return getStaticPropertySlot<Navigator, JSObject>(exec, &NavigatorTable, this, propertyName, slot);
}
+static bool needsYouTubeQuirk(ExecState*, Frame*);
+
+#if !PLATFORM(WIN)
+
+static inline bool needsYouTubeQuirk(ExecState*, Frame*)
+{
+ return false;
+}
+
+#else
+
+static bool needsYouTubeQuirk(ExecState* exec, Frame* frame)
+{
+ // This quirk works around a mistaken check in an ad at youtube.com.
+ // There's a function called isSafari that returns false if the function
+ // called isWindows returns true; thus the site malfunctions with Windows Safari.
+
+ // Do the quirk only if the function's name is "isWindows".
+ FunctionImp* function = exec->function();
+ if (!function)
+ return false;
+ static const Identifier& isWindowsFunctionName = *new Identifier("isWindows");
+ if (function->functionName() != isWindowsFunctionName)
+ return false;
+
+ // Do the quirk only if the function is called by an "isSafari" function.
+ // However, that function is not itself named -- it is stored in the isSafari
+ // property, though, so that's how recognize it.
+ ExecState* callingExec = exec->callingExecState();
+ if (!callingExec)
+ return false;
+ FunctionImp* callingFunction = callingExec->function();
+ if (!callingFunction)
+ return false;
+ JSObject* thisObject = callingExec->thisValue();
+ if (!thisObject)
+ return false;
+ static const Identifier& isSafariFunctionName = *new Identifier("isSafari");
+ JSValue* isSafariFunction = thisObject->getDirect(isSafariFunctionName);
+ if (isSafariFunction != callingFunction)
+ return false;
+
+ // FIXME: The document is never null, so we should remove this check along with the
+ // other similar ones in this file when we are absolutely sure it's safe.
+ Document* document = frame->document();
+ if (!document)
+ return false;
+
+ // Do the quirk only on the front page of the global version of YouTube.
+ const KURL& url = document->url();
+ if (url.host() != "youtube.com" && url.host() != "www.youtube.com")
+ return false;
+ if (url.path() != "/")
+ return false;
+
+ // As with other site-specific quirks, allow website developers to turn this off.
+ // In theory, this allows website developers to check if their fixes are effective.
+ Settings* settings = frame->settings();
+ if (!settings)
+ return false;
+ if (!settings->needsSiteSpecificQuirks())
+ return false;
+
+ return true;
+}
+
+#endif
+
JSValue* Navigator::getValueProperty(ExecState* exec, int token) const
{
switch (token) {
case AppName:
return jsString("Netscape");
case AppVersion: {
+ if (needsYouTubeQuirk(exec, m_frame))
+ return jsString("");
// Version is everything in the user agent string past the "Mozilla/" prefix.
const String userAgent = m_frame->loader()->userAgent(m_frame->document() ? m_frame->document()->url() : KURL());
return jsString(userAgent.substring(userAgent.find('/') + 1));
, m_forceFTPDirectoryListings(false)
, m_developerExtrasEnabled(false)
, m_authorAndUserStylesEnabled(true)
+ , m_needsSiteSpecificQuirks(false)
, m_fontRenderingMode(0)
{
// A Frame may not have been created yet, so we initialize the AtomicString
return static_cast<FontRenderingMode>(m_fontRenderingMode);
}
+void Settings::setNeedsSiteSpecificQuirks(bool needsQuirks)
+{
+ m_needsSiteSpecificQuirks = needsQuirks;
+}
+
} // namespace WebCore
void setFontRenderingMode(FontRenderingMode mode);
FontRenderingMode fontRenderingMode() const;
+ void setNeedsSiteSpecificQuirks(bool);
+ bool needsSiteSpecificQuirks() const { return m_needsSiteSpecificQuirks; }
+
private:
Page* m_page;
bool m_forceFTPDirectoryListings : 1;
bool m_developerExtrasEnabled : 1;
bool m_authorAndUserStylesEnabled : 1;
+ bool m_needsSiteSpecificQuirks : 1;
unsigned m_fontRenderingMode : 1;
};
+2008-02-20 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Darin and Geoff.
+
+ - WebKit part of <rdar://problem/5754378> work around missing video on YouTube front page with a site-specific hack
+
+ * WebView/WebView.mm:
+ (-[WebView _preferencesChangedNotification:]): Added a call to Settings::setNeedsSiteSpecificQuirks.
+ There are currently no site-specific quirks on Mac, but we will propagate the state
+ to WebCore to avoid possible mistakes later.
+
2008-02-19 Anders Carlsson <andersca@apple.com>
Reviewed by Darin.
settings->setUserStyleSheetLocation([NSURL URLWithString:@""]);
settings->setNeedsAdobeFrameReloadingQuirk([self _needsAdobeFrameReloadingQuirk]);
settings->setNeedsKeyboardEventDisambiguationQuirks([self _needsKeyboardEventDisambiguationQuirks]);
+ settings->setNeedsSiteSpecificQuirks(_private->useSiteSpecificSpoofing);
}
static inline IMP getMethod(id o, SEL s)
+2008-02-20 Sam Weinig <sam@webkit.org>
+
+ Reviewed by Darin and Geoff.
+
+ - WebKit part of <rdar://problem/5754378> work around missing video on YouTube front page with a site-specific hack
+
+ * WebView.cpp:
+ (WebView::notifyPreferencesChanged): Added a call to Settings::setNeedsSiteSpecificQuirks.
+ (WebView::setAllowSiteSpecificHacks): Added a comment about the problem Darin noticed, where
+ after you disable the site-specific hacks they persist until you open a new window or tweak
+ some other preference.
+
2008-02-19 Darin Adler <darin@apple.com>
Reviewed by Sam.
settings->setShowsURLsInToolTips(false);
settings->setForceFTPDirectoryListings(true);
settings->setDeveloperExtrasEnabled(developerExtrasEnabled());
+ settings->setNeedsSiteSpecificQuirks(s_allowSiteSpecificHacks);
FontSmoothingType smoothingType;
hr = preferences->fontSmoothing(&smoothingType);
/* [in] */ BOOL allow)
{
s_allowSiteSpecificHacks = !!allow;
+ // FIXME: This sets a global so it needs to call notifyPreferencesChanged
+ // on all WebView objects (not just itself).
return S_OK;
}