Title: [247873] trunk/Source/WebCore
- Revision
- 247873
- Author
- [email protected]
- Date
- 2019-07-26 13:34:28 -0700 (Fri, 26 Jul 2019)
Log Message
slides.google.com: opening speaker notes while presenting causes a fatal error in the web app on iPad
https://bugs.webkit.org/show_bug.cgi?id=199933
<rdar://problem/53034345>
Reviewed by Darin Adler.
docs.google.com might sometimes try to window.open an about URL that not about:blank or about:srcdoc.
In that case, WebKit is opening a window but is considering that the window is cross origin with its opener.
This breaks docs.google.com as they want to access the website.
Add a site-specific hack so as to treat all about URLs being opened through window.open as about:blank.
Manually tested on docs.google.com website.
* page/DOMWindow.cpp:
(WebCore::DOMWindow::createWindow):
(WebCore::DOMWindow::open):
* page/Quirks.cpp:
(WebCore::Quirks::needsYouTubeOverflowScrollQuirk const):
(WebCore::Quirks::shouldOpenAsAboutBlank const):
* page/Quirks.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (247872 => 247873)
--- trunk/Source/WebCore/ChangeLog 2019-07-26 19:34:13 UTC (rev 247872)
+++ trunk/Source/WebCore/ChangeLog 2019-07-26 20:34:28 UTC (rev 247873)
@@ -1,3 +1,26 @@
+2019-07-26 Youenn Fablet <[email protected]>
+
+ slides.google.com: opening speaker notes while presenting causes a fatal error in the web app on iPad
+ https://bugs.webkit.org/show_bug.cgi?id=199933
+ <rdar://problem/53034345>
+
+ Reviewed by Darin Adler.
+
+ docs.google.com might sometimes try to window.open an about URL that not about:blank or about:srcdoc.
+ In that case, WebKit is opening a window but is considering that the window is cross origin with its opener.
+ This breaks docs.google.com as they want to access the website.
+ Add a site-specific hack so as to treat all about URLs being opened through window.open as about:blank.
+
+ Manually tested on docs.google.com website.
+
+ * page/DOMWindow.cpp:
+ (WebCore::DOMWindow::createWindow):
+ (WebCore::DOMWindow::open):
+ * page/Quirks.cpp:
+ (WebCore::Quirks::needsYouTubeOverflowScrollQuirk const):
+ (WebCore::Quirks::shouldOpenAsAboutBlank const):
+ * page/Quirks.h:
+
2019-07-26 Alexander Mikhaylenko <[email protected]>
REGRESSION(r246496): [GTK] Tapping the web view scrolls up a bit
Modified: trunk/Source/WebCore/page/DOMWindow.cpp (247872 => 247873)
--- trunk/Source/WebCore/page/DOMWindow.cpp 2019-07-26 19:34:13 UTC (rev 247872)
+++ trunk/Source/WebCore/page/DOMWindow.cpp 2019-07-26 20:34:28 UTC (rev 247873)
@@ -2395,7 +2395,7 @@
return noopener ? RefPtr<Frame> { nullptr } : newFrame;
}
-ExceptionOr<RefPtr<WindowProxy>> DOMWindow::open(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& urlString, const AtomString& frameName, const String& windowFeaturesString)
+ExceptionOr<RefPtr<WindowProxy>> DOMWindow::open(DOMWindow& activeWindow, DOMWindow& firstWindow, const String& urlStringToOpen, const AtomString& frameName, const String& windowFeaturesString)
{
if (!isCurrentlyDisplayedInFrame())
return RefPtr<WindowProxy> { nullptr };
@@ -2408,6 +2408,10 @@
if (!firstFrame)
return RefPtr<WindowProxy> { nullptr };
+ auto urlString = urlStringToOpen;
+ if (activeDocument->quirks().shouldOpenAsAboutBlank(urlStringToOpen))
+ urlString = "about:blank"_s;
+
#if ENABLE(CONTENT_EXTENSIONS)
if (firstFrame->document()
&& firstFrame->page()
Modified: trunk/Source/WebCore/page/Quirks.cpp (247872 => 247873)
--- trunk/Source/WebCore/page/Quirks.cpp 2019-07-26 19:34:13 UTC (rev 247872)
+++ trunk/Source/WebCore/page/Quirks.cpp 2019-07-26 20:34:28 UTC (rev 247873)
@@ -30,6 +30,7 @@
#include "DOMTokenList.h"
#include "Document.h"
#include "DocumentLoader.h"
+#include "FrameLoader.h"
#include "HTMLMetaElement.h"
#include "HTMLObjectElement.h"
#include "LayoutUnit.h"
@@ -455,4 +456,28 @@
return equalLettersIgnoringASCIICase(m_document->url().host(), "www.zillow.com");
}
+bool Quirks::shouldOpenAsAboutBlank(const String& stringToOpen) const
+{
+#if PLATFORM(IOS_FAMILY)
+ if (!needsQuirks())
+ return false;
+
+ auto openerURL = m_document->url();
+ if (!equalLettersIgnoringASCIICase(openerURL.host(), "docs.google.com"))
+ return false;
+
+ if (!m_document->frame() || !m_document->frame()->loader().userAgentForJavaScript(openerURL).contains("Macintosh"))
+ return false;
+
+ URL urlToOpen { URL { }, stringToOpen };
+ if (!urlToOpen.protocolIsAbout())
+ return false;
+
+ return !equalLettersIgnoringASCIICase(urlToOpen.host(), "blank") && !equalLettersIgnoringASCIICase(urlToOpen.host(), "srcdoc");
+#else
+ UNUSED_PARAM(stringToOpen);
+ return false;
+#endif
}
+
+}
Modified: trunk/Source/WebCore/page/Quirks.h (247872 => 247873)
--- trunk/Source/WebCore/page/Quirks.h 2019-07-26 19:34:13 UTC (rev 247872)
+++ trunk/Source/WebCore/page/Quirks.h 2019-07-26 20:34:28 UTC (rev 247873)
@@ -70,6 +70,8 @@
bool needsGMailOverflowScrollQuirk() const;
bool needsYouTubeOverflowScrollQuirk() const;
+ bool shouldOpenAsAboutBlank(const String&) const;
+
private:
bool needsQuirks() const;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes