<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<title>[23947] trunk/WebCore</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/23947">23947</a></dd>
<dt>Author</dt> <dd>andersca</dd>
<dt>Date</dt> <dd>2007-07-03 10:55:59 -0700 (Tue, 03 Jul 2007)</dd>
</dl>
<h3>Log Message</h3>
<pre> Reviewed by Adam.
<rdar://problem/5261523>
Crash playing MP11 on cnbc.com
The WMP Netscape plugin still creates a window even when windowless mode is turned on. Work around this by
always removing the "windowlessvideo" parameter before passing it to the plugin.
According to http://msdn2.microsoft.com/en-us/library/bb249373.aspx, "The windowlessVideo property is not
supported for Netscape Navigator. Setting a value for this property in Navigator may yield unexpected results."
* plugins/win/PluginViewWin.cpp:
(WebCore::PluginViewWndProc):
(WebCore::PluginViewWin::paint):
(WebCore::PluginViewWin::invalidateRect):
(WebCore::PluginViewWin::determineQuirks):
(WebCore::PluginViewWin::setParameters):
(WebCore::PluginViewWin::PluginViewWin):
(WebCore::PluginViewWin::init):
* plugins/win/PluginViewWin.h:
(WebCore::):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkWebCoreChangeLog">trunk/WebCore/ChangeLog</a></li>
<li><a href="#trunkWebCorepluginswinPluginViewWincpp">trunk/WebCore/plugins/win/PluginViewWin.cpp</a></li>
<li><a href="#trunkWebCorepluginswinPluginViewWinh">trunk/WebCore/plugins/win/PluginViewWin.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/ChangeLog (23946 => 23947)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/ChangeLog        2007-07-03 16:21:01 UTC (rev 23946)
+++ trunk/WebCore/ChangeLog        2007-07-03 17:55:59 UTC (rev 23947)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2007-07-03 Anders Carlsson <andersca@apple.com>
+
+ Reviewed by Adam.
+
+ <rdar://problem/5261523>
+ Crash playing MP11 on cnbc.com
+
+ The WMP Netscape plugin still creates a window even when windowless mode is turned on. Work around this by
+ always removing the "windowlessvideo" parameter before passing it to the plugin.
+ According to http://msdn2.microsoft.com/en-us/library/bb249373.aspx, "The windowlessVideo property is not
+ supported for Netscape Navigator. Setting a value for this property in Navigator may yield unexpected results."
+
+ * plugins/win/PluginViewWin.cpp:
+ (WebCore::PluginViewWndProc):
+ (WebCore::PluginViewWin::paint):
+ (WebCore::PluginViewWin::invalidateRect):
+ (WebCore::PluginViewWin::determineQuirks):
+ (WebCore::PluginViewWin::setParameters):
+ (WebCore::PluginViewWin::PluginViewWin):
+ (WebCore::PluginViewWin::init):
+ * plugins/win/PluginViewWin.h:
+ (WebCore::):
+
</ins><span class="cx"> 2007-07-03 Qing Zhao <qing@staikos.net>
</span><span class="cx">
</span><span class="cx"> Reviewed by George Staikos.
</span></span></pre></div>
<a id="trunkWebCorepluginswinPluginViewWincpp"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/plugins/win/PluginViewWin.cpp (23946 => 23947)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/plugins/win/PluginViewWin.cpp        2007-07-03 16:21:01 UTC (rev 23946)
+++ trunk/WebCore/plugins/win/PluginViewWin.cpp        2007-07-03 17:55:59 UTC (rev 23947)
</span><span class="lines">@@ -137,7 +137,7 @@
</span><span class="cx"> {
</span><span class="cx"> PluginViewWin* pluginView = reinterpret_cast<PluginViewWin*>(GetProp(hWnd, kWebPluginViewProperty));
</span><span class="cx">
</span><del>- if (pluginView && (pluginView->quirks() & PluginQuirksWantsAsciiWindowProc))
</del><ins>+ if (pluginView && (pluginView->quirks() & PluginQuirkWantsAsciiWindowProc))
</ins><span class="cx"> return DefWindowProcA(hWnd, message, wParam, lParam);
</span><span class="cx"> else
</span><span class="cx"> return DefWindowProcW(hWnd, message, wParam, lParam);
</span><span class="lines">@@ -312,7 +312,7 @@
</span><span class="cx"> npEvent.event = WM_PAINT;
</span><span class="cx"> npEvent.wParam = reinterpret_cast<uint32>(hdc);
</span><span class="cx">
</span><del>- // This is supposed to be a pointer to the dirty rect, but it seems that the Flash plugin
</del><ins>+ // This is supposed to be a pointer to the dirty rect, but it seems that the Flash plugin
</ins><span class="cx"> // ignores it so we just pass null.
</span><span class="cx"> npEvent.lParam = 0;
</span><span class="cx">
</span><span class="lines">@@ -539,16 +539,6 @@
</span><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-static char** createUTF8StringArray(const Vector<String>& vector)
-{
- char** result = reinterpret_cast<char**>(fastMalloc(sizeof(char*) * vector.size()));
-
- for (unsigned i = 0; i < vector.size(); i++)
- result[i] = createUTF8String(vector[i]);
-
- return result;
-}
-
</del><span class="cx"> static void freeStringArray(char** stringArray, int length)
</span><span class="cx"> {
</span><span class="cx"> if (!stringArray)
</span><span class="lines">@@ -1088,7 +1078,7 @@
</span><span class="cx"> RECT invalidRect(r);
</span><span class="cx"> InvalidateRect(m_window, &invalidRect, FALSE);
</span><span class="cx"> } else {
</span><del>- if (m_quirks & PluginQuirksThrottleInvalidate) {
</del><ins>+ if (m_quirks & PluginQuirkThrottleInvalidate) {
</ins><span class="cx"> m_invalidRects.append(r);
</span><span class="cx"> if (!m_invalidateTimer.isActive())
</span><span class="cx"> m_invalidateTimer.startOneShot(0.0);
</span><span class="lines">@@ -1174,14 +1164,19 @@
</span><span class="cx"> // The flash plugin only requests windowless plugins if we return a mozilla user agent
</span><span class="cx"> if (mimeType == "application/x-shockwave-flash") {
</span><span class="cx"> m_quirks |= PluginQuirkWantsMozillaUserAgent;
</span><del>- m_quirks |= PluginQuirksThrottleInvalidate;
</del><ins>+ m_quirks |= PluginQuirkThrottleInvalidate;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> // The WMP plugin sets its size on the first NPP_SetWindow call and never updates its size, so
</span><span class="cx"> // call SetWindow when the plugin view has a correct size
</span><del>- if (m_plugin->name().contains("Microsoft") && m_plugin->name().contains("Windows Media"))
</del><ins>+ if (m_plugin->name().contains("Microsoft") && m_plugin->name().contains("Windows Media")) {
</ins><span class="cx"> m_quirks |= PluginQuirkDeferFirstSetWindowCall;
</span><span class="cx">
</span><ins>+ // Windowless mode does not work at all with the WMP plugin so just remove that parameter
+ // and don't pass it to the plug-in.
+ m_quirks |= PluginQuirkRemoveWindowlessVideoParam;
+ }
+
</ins><span class="cx"> // Shockwave calls SetWindowLongA to set a new WNDPROC on its plugin window. The value returned from SetWindowLongA is the old WNDPROC.
</span><span class="cx"> // If the previous WNDPROC was an Unicode WNDPROC, the address of the WNDPROC will not be returned. Instead, a special
</span><span class="cx"> // value that indicates that the messages coming to the WNDPROC need to be translated to Unicode. If CallWndProc is used to
</span><span class="lines">@@ -1190,9 +1185,32 @@
</span><span class="cx"> // WNDPROC on the plugin window so that the value returned to Shockwave will be a real function pointer.
</span><span class="cx"> // For more info on this, see http://blogs.msdn.com/oldnewthing/archive/2003/12/01/55900.aspx
</span><span class="cx"> if (mimeType == "application/x-director")
</span><del>- m_quirks |= PluginQuirksWantsAsciiWindowProc;
</del><ins>+ m_quirks |= PluginQuirkWantsAsciiWindowProc;
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+void PluginViewWin::setParameters(const Vector<String>& paramNames, const Vector<String>& paramValues)
+{
+ ASSERT(paramNames.size() == paramValues.size());
+
+ unsigned size = paramNames.size();
+ unsigned paramCount = 0;
+
+ m_paramNames = reinterpret_cast<char**>(fastMalloc(sizeof(char*) * size));
+ m_paramValues = reinterpret_cast<char**>(fastMalloc(sizeof(char*) * size));
+
+ for (unsigned i = 0; i < size; i++) {
+ if ((m_quirks & PluginQuirkRemoveWindowlessVideoParam) && equalIgnoringCase(paramNames[i], "windowlessvideo"))
+ continue;
+
+ m_paramNames[paramCount] = createUTF8String(paramNames[i]);
+ m_paramValues[paramCount] = createUTF8String(paramValues[i]);
+
+ paramCount++;
+ }
+
+ m_paramCount = paramCount;
+}
+
</ins><span class="cx"> PluginViewWin::PluginViewWin(Frame* parentFrame, PluginPackageWin* plugin, Element* element, const KURL& url, const Vector<String>& paramNames, const Vector<String>& paramValues, const String& mimeType)
</span><span class="cx"> : m_parentFrame(parentFrame)
</span><span class="cx"> , m_plugin(plugin)
</span><span class="lines">@@ -1221,14 +1239,12 @@
</span><span class="cx"> m_instance->ndata = this;
</span><span class="cx">
</span><span class="cx"> m_mimeType = mimeType.utf8();
</span><ins>+ determineQuirks(mimeType);
</ins><span class="cx">
</span><del>- m_paramCount = paramNames.size();
- m_paramNames = createUTF8StringArray(paramNames);
- m_paramValues = createUTF8StringArray(paramValues);
</del><ins>+ setParameters(paramNames, paramValues);
</ins><span class="cx">
</span><span class="cx"> m_mode = element->document()->isPluginDocument() ? NP_FULL : NP_EMBED;
</span><span class="cx">
</span><del>- determineQuirks(mimeType);
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void PluginViewWin::init()
</span><span class="lines">@@ -1263,7 +1279,7 @@
</span><span class="cx"> m_window = CreateWindowEx(0, kWebPluginViewWindowClassName, 0, flags,
</span><span class="cx"> 0, 0, 0, 0, m_parentFrame->view()->containingWindow(), 0, Page::instanceHandle(), 0);
</span><span class="cx">
</span><del>- if (m_quirks & PluginQuirksWantsAsciiWindowProc)
</del><ins>+ if (m_quirks & PluginQuirkWantsAsciiWindowProc)
</ins><span class="cx"> ::SetWindowLongPtrA(m_window, GWL_WNDPROC, (LONG)PluginViewWndProc);
</span><span class="cx">
</span><span class="cx"> SetProp(m_window, kWebPluginViewProperty, this);
</span></span></pre></div>
<a id="trunkWebCorepluginswinPluginViewWinh"></a>
<div class="modfile"><h4>Modified: trunk/WebCore/plugins/win/PluginViewWin.h (23946 => 23947)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/WebCore/plugins/win/PluginViewWin.h        2007-07-03 16:21:01 UTC (rev 23946)
+++ trunk/WebCore/plugins/win/PluginViewWin.h        2007-07-03 17:55:59 UTC (rev 23947)
</span><span class="lines">@@ -62,8 +62,9 @@
</span><span class="cx"> enum PluginQuirks {
</span><span class="cx"> PluginQuirkWantsMozillaUserAgent = 1 << 0,
</span><span class="cx"> PluginQuirkDeferFirstSetWindowCall = 1 << 1,
</span><del>- PluginQuirksThrottleInvalidate = 1 << 2,
- PluginQuirksWantsAsciiWindowProc = 1 << 3
</del><ins>+ PluginQuirkThrottleInvalidate = 1 << 2,
+ PluginQuirkWantsAsciiWindowProc = 1 << 3,
+ PluginQuirkRemoveWindowlessVideoParam = 1 << 4,
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> enum PluginStatus {
</span><span class="lines">@@ -126,6 +127,7 @@
</span><span class="cx">
</span><span class="cx"> int quirks() const { return m_quirks; }
</span><span class="cx"> private:
</span><ins>+ void setParameters(const Vector<String>& paramNames, const Vector<String>& paramValues);
</ins><span class="cx"> void init();
</span><span class="cx"> bool start();
</span><span class="cx"> void stop();
</span></span></pre>
</div>
</div>
</body>
</html>