Bug 1533562 Comment 13 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

There was a bug in the patch titled "Always make the content view of ToolbarWindows cover the entire window.": `-[ToolbarWindow initWithContentRect:styleMask:backing:defer:]` was creating windows whose frame size matched the specified content size, but that's not what the caller wanted. I've fixed that bug and it fixed the test timeout.

Here are more details on what exactly caused the test to time out:

When the window's frame size doesn't match the expected frame size, we hit this code:

```
  // Make sure that the content rect we gave has been honored.
  NSRect wantedFrame = [mWindow frameRectForChildViewRect:contentRect];
  if (!NSEqualRects([mWindow frame], wantedFrame)) {
    // This can happen when the window is not on the primary screen.
    [mWindow setFrame:wantedFrame display:NO];
  }
```

This code runs after we set the window delegate on the window, so the delegate's resize handler fires, and that handler calls RollUpPopups(). This means that opening a browser window would now automatically close context menus.

The test was opening a window from a context menu and then closing the context menu. When closing the context menu, it was expecting a popuphidden event to fire after the manual closeContextMenu() call, and not earlier. With the bad patch, the popuphidden event fired earlier, during the menuItem.click() call.
There was a bug in the patch titled "Always make the content view of ToolbarWindows cover the entire window.": `-[ToolbarWindow initWithContentRect:styleMask:backing:defer:]` was creating windows whose frame size matched the specified content size, but that's not what the caller wanted: the caller wants the aContentSize argument to specify the size of the ChildView of the window, i.e. the titlebar size should be added on the top. I've renamed the argument to aChildViewRect and added the necessary adjustment. This fixed the test timeout.

Here are more details on what exactly caused the test to time out:

When the window's frame size doesn't match the expected frame size, we hit this code:

```
  // Make sure that the content rect we gave has been honored.
  NSRect wantedFrame = [mWindow frameRectForChildViewRect:contentRect];
  if (!NSEqualRects([mWindow frame], wantedFrame)) {
    // This can happen when the window is not on the primary screen.
    [mWindow setFrame:wantedFrame display:NO];
  }
```

This code runs after we set the window delegate on the window, so the delegate's resize handler fires, and that handler calls RollUpPopups(). This means that opening a browser window would now automatically close context menus.

The test was opening a window from a context menu and then closing the context menu. When closing the context menu, it was expecting a popuphidden event to fire after the manual closeContextMenu() call, and not earlier. With the bad patch, the popuphidden event fired earlier, during the menuItem.click() call.

Back to Bug 1533562 Comment 13