Bug 574095 - crash loading test plugin on 64-bit win7 tests in /layout/generic/crashtests/505912-1.html , /tests/layout/generic/test/test_plugin_clipping.xhtml [@ _SetWindowLongPtr() | nsPluginNativeWindowWin::SubclassAndAssociateWindow]. r=joshmoz
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Mon, 12 Jul 2010 13:49:12 +0900
changeset 47318 a4fea9526b7b01880eb24b8af41c22df748b50ba
parent 47317 97b8d1dd4c654ec45a51e1a9d57af665851c66e1
child 47319 77667930fda55a0883e09c8a5c00b159df760262
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjoshmoz
bugs574095, 505912
milestone2.0b2pre
first release with
nightly linux32
a4fea9526b7b / 4.0b2pre / 20100712025848 / files
nightly linux64
a4fea9526b7b / 4.0b2pre / 20100712030648 / files
nightly mac
a4fea9526b7b / 4.0b2pre / 20100712030728 / files
nightly win32
a4fea9526b7b / 4.0b2pre / 20100712040843 / files
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
Bug 574095 - crash loading test plugin on 64-bit win7 tests in /layout/generic/crashtests/505912-1.html , /tests/layout/generic/test/test_plugin_clipping.xhtml [@ _SetWindowLongPtr() | nsPluginNativeWindowWin::SubclassAndAssociateWindow]. r=joshmoz
dom/plugins/PluginInstanceChild.cpp
dom/plugins/PluginInstanceParent.cpp
modules/plugin/base/src/nsPluginNativeWindowWin.cpp
--- a/dom/plugins/PluginInstanceChild.cpp
+++ b/dom/plugins/PluginInstanceChild.cpp
@@ -867,17 +867,17 @@ PluginInstanceChild::AnswerNPP_SetWindow
 
           if (mPluginIface->setwindow) {
               (void) mPluginIface->setwindow(&mData, &mWindow);
               WNDPROC wndProc = reinterpret_cast<WNDPROC>(
                   GetWindowLongPtr(mPluginWindowHWND, GWLP_WNDPROC));
               if (wndProc != PluginWindowProc) {
                   mPluginWndProc = reinterpret_cast<WNDPROC>(
                       SetWindowLongPtr(mPluginWindowHWND, GWLP_WNDPROC,
-                                       reinterpret_cast<LONG>(PluginWindowProc)));
+                                       reinterpret_cast<LONG_PTR>(PluginWindowProc)));
               }
           }
       }
       break;
 
       case NPWindowTypeDrawable:
           mWindow.type = aWindow.type;
           if (mQuirks & QUIRK_WINLESS_TRACKPOPUP_HOOK)
@@ -978,47 +978,47 @@ PluginInstanceChild::CreatePluginWindow(
                        0, 0, NULL, 0, GetModuleHandle(NULL), 0);
     if (!mPluginWindowHWND)
         return false;
     if (!SetProp(mPluginWindowHWND, kPluginInstanceChildProperty, this))
         return false;
 
     // Apparently some plugins require an ASCII WndProc.
     SetWindowLongPtrA(mPluginWindowHWND, GWLP_WNDPROC,
-                      reinterpret_cast<LONG>(DefWindowProcA));
+                      reinterpret_cast<LONG_PTR>(DefWindowProcA));
 
     return true;
 }
 
 void
 PluginInstanceChild::DestroyPluginWindow()
 {
     if (mPluginWindowHWND) {
         // Unsubclass the window.
         WNDPROC wndProc = reinterpret_cast<WNDPROC>(
             GetWindowLongPtr(mPluginWindowHWND, GWLP_WNDPROC));
         if (wndProc == PluginWindowProc) {
             NS_ASSERTION(mPluginWndProc, "Should have old proc here!");
             SetWindowLongPtr(mPluginWindowHWND, GWLP_WNDPROC,
-                             reinterpret_cast<LONG>(mPluginWndProc));
+                             reinterpret_cast<LONG_PTR>(mPluginWndProc));
             mPluginWndProc = 0;
         }
 
         RemoveProp(mPluginWindowHWND, kPluginInstanceChildProperty);
         DestroyWindow(mPluginWindowHWND);
         mPluginWindowHWND = 0;
     }
 }
 
 void
 PluginInstanceChild::ReparentPluginWindow(HWND hWndParent)
 {
     if (hWndParent != mPluginParentHWND && IsWindow(hWndParent)) {
         // Fix the child window's style to be a child window.
-        LONG style = GetWindowLongPtr(mPluginWindowHWND, GWL_STYLE);
+        LONG_PTR style = GetWindowLongPtr(mPluginWindowHWND, GWL_STYLE);
         style |= WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
         style &= ~WS_POPUP;
         SetWindowLongPtr(mPluginWindowHWND, GWL_STYLE, style);
 
         // Do the reparenting.
         SetParent(mPluginWindowHWND, hWndParent);
 
         // Make sure we're visible.
@@ -1526,17 +1526,17 @@ PluginInstanceChild::UnhookWinlessFlashT
   WNDPROC tmpProc = mWinlessThrottleOldWndProc;
   mWinlessThrottleOldWndProc = nsnull;
 
   NS_ASSERTION(mWinlessHiddenMsgHWND,
                "Missing mWinlessHiddenMsgHWND w/subclass set??");
 
   // reset the subclass
   SetWindowLongPtr(mWinlessHiddenMsgHWND, GWLP_WNDPROC,
-                   reinterpret_cast<LONG>(tmpProc));
+                   reinterpret_cast<LONG_PTR>(tmpProc));
 
   // Remove our instance prop
   RemoveProp(mWinlessHiddenMsgHWND, kPluginInstanceChildProperty);
   mWinlessHiddenMsgHWND = nsnull;
 }
 
 // static
 LRESULT CALLBACK
@@ -1598,17 +1598,17 @@ PluginInstanceChild::EnumThreadWindowsCa
             if (self->mWinlessThrottleOldWndProc) {
                 NS_WARNING("mWinlessThrottleWndProc already set???");
                 return FALSE;
             }
             // Subsclass and store self as a property
             self->mWinlessHiddenMsgHWND = hWnd;
             self->mWinlessThrottleOldWndProc =
                 reinterpret_cast<WNDPROC>(SetWindowLongPtr(hWnd, GWLP_WNDPROC,
-                reinterpret_cast<LONG>(WinlessHiddenFlashWndProc)));
+                reinterpret_cast<LONG_PTR>(WinlessHiddenFlashWndProc)));
             SetProp(hWnd, kPluginInstanceChildProperty, self);
             NS_ASSERTION(self->mWinlessThrottleOldWndProc,
                          "SetWindowLongPtr failed?!");
         }
         // Return no matter what once we find the right window.
         return FALSE;
     }
 
--- a/dom/plugins/PluginInstanceParent.cpp
+++ b/dom/plugins/PluginInstanceParent.cpp
@@ -1145,31 +1145,31 @@ PluginInstanceParent::SubclassPluginWind
 {
     NS_ASSERTION(!(mPluginHWND && aWnd != mPluginHWND),
       "PluginInstanceParent::SubclassPluginWindow hwnd is not our window!");
 
     if (!mPluginHWND) {
         mPluginHWND = aWnd;
         mPluginWndProc = 
             (WNDPROC)::SetWindowLongPtrA(mPluginHWND, GWLP_WNDPROC,
-                         reinterpret_cast<LONG>(PluginWindowHookProc));
+                         reinterpret_cast<LONG_PTR>(PluginWindowHookProc));
         bool bRes = ::SetPropW(mPluginHWND, kPluginInstanceParentProperty, this);
         NS_ASSERTION(mPluginWndProc,
           "PluginInstanceParent::SubclassPluginWindow failed to set subclass!");
         NS_ASSERTION(bRes,
           "PluginInstanceParent::SubclassPluginWindow failed to set prop!");
    }
 }
 
 void
 PluginInstanceParent::UnsubclassPluginWindow()
 {
     if (mPluginHWND && mPluginWndProc) {
         ::SetWindowLongPtrA(mPluginHWND, GWLP_WNDPROC,
-                            reinterpret_cast<LONG>(mPluginWndProc));
+                            reinterpret_cast<LONG_PTR>(mPluginWndProc));
 
         ::RemovePropW(mPluginHWND, kPluginInstanceParentProperty);
 
         mPluginWndProc = NULL;
         mPluginHWND = NULL;
     }
 }
 
--- a/modules/plugin/base/src/nsPluginNativeWindowWin.cpp
+++ b/modules/plugin/base/src/nsPluginNativeWindowWin.cpp
@@ -539,17 +539,17 @@ nsresult nsPluginNativeWindowWin::Subcla
   if (!hWnd)
     return NS_ERROR_FAILURE;
 
   // check if we need to re-subclass
   WNDPROC currentWndProc = (WNDPROC)::GetWindowLongPtr(hWnd, GWLP_WNDPROC);
   if (PluginWndProc == currentWndProc)
     return NS_OK;
 
-  LONG style = GetWindowLongPtr(hWnd, GWL_STYLE);
+  LONG_PTR style = GetWindowLongPtr(hWnd, GWL_STYLE);
 #ifdef MOZ_IPC
   // Out of process plugins must not have the WS_CLIPCHILDREN style set on their
   // parent windows or else synchronous paints (via UpdateWindow() and others)
   // will cause deadlocks.
   if (::GetPropW(hWnd, L"PluginInstanceParentProperty"))
     style &= ~WS_CLIPCHILDREN;
   else
     style |= WS_CLIPCHILDREN;
@@ -583,17 +583,17 @@ nsresult nsPluginNativeWindowWin::UndoSu
 
   // restore the original win proc
   // but only do this if this were us last time
   if (mPluginWinProc) {
     WNDPROC currentWndProc = (WNDPROC)::GetWindowLongPtr(hWnd, GWLP_WNDPROC);
     if (currentWndProc == PluginWndProc)
       SubclassWindow(hWnd, (LONG_PTR)mPluginWinProc);
 
-    LONG style = GetWindowLongPtr(hWnd, GWL_STYLE);
+    LONG_PTR style = GetWindowLongPtr(hWnd, GWL_STYLE);
     style &= ~WS_CLIPCHILDREN;
     SetWindowLongPtr(hWnd, GWL_STYLE, style);
   }
 
   return NS_OK;
 }
 #endif // WINCE