REGRESSION (r207155): Unable to switch sheets when previewing Numbers '09 spreadsheets
authoraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Aug 2017 00:46:31 +0000 (00:46 +0000)
committeraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 3 Aug 2017 00:46:31 +0000 (00:46 +0000)
commit958327371cd3696ab415f88fbc30f78133ceb867
tree88f6404a4e302b16333d232608edddc00ab6c8f2
parentac3848e3bae0aa3e035d8bac6bb4c2e521daef48
REGRESSION (r207155): Unable to switch sheets when previewing Numbers '09 spreadsheets
https://bugs.webkit.org/show_bug.cgi?id=175098
<rdar://problem/31416763>

Reviewed by Daniel Bates.

Source/WebCore:

r207155 enabled sandboxing on the frame displaying a QuickLook preview. This restricted
frames within the sandbox from navigating their sandboxed siblings or ancestors, which
breaks the functionality of multi-sheet Numbers '09 spreadsheet previews. These previews
contain a frameset with a table of contents frame and a content frame, and the table of
contents frame needs to be able to navigate the content frame when the sheet selection
changes.

Fix this by disabling the SandboxNavigation flag in the QuickLook sandbox. Frames within the
sandbox will be able to navigate each other, but will not be able to navigate the top frame
(due to SandboxTopNavigation still being enabled), nor will they be able to navigate any
other ancestor frame outside the sandbox (due to QuickLook previews being in a different
origin than the hosting frame). These two cases are covered by existing tests.

Test: quicklook/multi-sheet-numbers-09.html

* dom/Document.cpp:
(WebCore::Document::applyQuickLookSandbox): Added a call to
disableSandboxFlags(SandboxNavigation) after applying the content security policy.
* dom/SecurityContext.h:
(WebCore::SecurityContext::disableSandboxFlags): Defined disableSandboxFlags().

LayoutTests:

* quicklook/multi-sheet-numbers-09-expected.txt: Added.
* quicklook/multi-sheet-numbers-09.html: Added.
* quicklook/resources/multi-sheet-numbers-09.numbers: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@220163 268f45cc-cd09-0410-ab3c-d52691b4dbfc
LayoutTests/ChangeLog
LayoutTests/quicklook/multi-sheet-numbers-09-expected.txt [new file with mode: 0644]
LayoutTests/quicklook/multi-sheet-numbers-09.html [new file with mode: 0644]
LayoutTests/quicklook/resources/multi-sheet-numbers-09.numbers [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/SecurityContext.h