Title: [258476] trunk/Source
Revision
258476
Author
bfulg...@apple.com
Date
2020-03-14 17:14:33 -0700 (Sat, 14 Mar 2020)

Log Message

Add missing checks needed for AppBound Quirk
https://bugs.webkit.org/show_bug.cgi?id=209117
<rdar://problem/60460097>

Reviewed by John Wilander.

The checks for the 'NeedsInAppBrowserPrivacyQuirks' flag added in r258101 was incomplete.
Source/WebCore:

Two additional call sites need to check the state of the flag.

* bindings/js/ScriptController.cpp:
(WebCore::ScriptController::executeScriptInWorld): Add missing check for the quirk.
* loader/FrameLoaderClient.h: Add new API for the 'NeedsInAppBrowserPrivacyQuirks'
debug flag.
* page/Frame.cpp:
(WebCore::Frame::injectUserScriptImmediately): Ditto.

Source/WebKit:

These changes let the WebFrameLoaderClient report the quirk state to WebCore code.

* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::needsInAppBrowserPrivacyQuirks): Added.
* WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::needsInAppBrowserPrivacyQuirks const): Added.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (258475 => 258476)


--- trunk/Source/WebCore/ChangeLog	2020-03-14 22:59:34 UTC (rev 258475)
+++ trunk/Source/WebCore/ChangeLog	2020-03-15 00:14:33 UTC (rev 258476)
@@ -1,3 +1,21 @@
+2020-03-14  Brent Fulgham  <bfulg...@apple.com>
+
+        Add missing checks needed for AppBound Quirk
+        https://bugs.webkit.org/show_bug.cgi?id=209117
+        <rdar://problem/60460097>
+
+        Reviewed by John Wilander.
+
+        The checks for the 'NeedsInAppBrowserPrivacyQuirks' flag added in r258101 was incomplete.
+        Two additional call sites need to check the state of the flag.
+
+        * bindings/js/ScriptController.cpp:
+        (WebCore::ScriptController::executeScriptInWorld): Add missing check for the quirk.
+        * loader/FrameLoaderClient.h: Add new API for the 'NeedsInAppBrowserPrivacyQuirks'
+        debug flag.
+        * page/Frame.cpp:
+        (WebCore::Frame::injectUserScriptImmediately): Ditto.
+
 2020-03-10  Darin Adler  <da...@apple.com>
 
         Change all return values in TextIterator header from live ranges to SimpleRange

Modified: trunk/Source/WebCore/bindings/js/ScriptController.cpp (258475 => 258476)


--- trunk/Source/WebCore/bindings/js/ScriptController.cpp	2020-03-14 22:59:34 UTC (rev 258475)
+++ trunk/Source/WebCore/bindings/js/ScriptController.cpp	2020-03-15 00:14:33 UTC (rev 258476)
@@ -1,7 +1,7 @@
 /*
  *  Copyright (C) 1999-2001 Harri Porten (por...@kde.org)
  *  Copyright (C) 2001 Peter Kelly (p...@post.com)
- *  Copyright (C) 2006-2019 Apple Inc. All rights reserved.
+ *  Copyright (C) 2006-2020 Apple Inc. All rights reserved.
  *
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Lesser General Public
@@ -576,7 +576,7 @@
 
 ValueOrException ScriptController::executeScriptInWorld(DOMWrapperWorld& world, RunJavaScriptParameters&& parameters)
 {
-    if (m_frame.loader().client().hasNavigatedAwayFromAppBoundDomain())
+    if (m_frame.loader().client().hasNavigatedAwayFromAppBoundDomain() && !m_frame.loader().client().needsInAppBrowserPrivacyQuirks())
         return jsNull();
 
     UserGestureIndicator gestureIndicator(parameters.forceUserGesture == ForceUserGesture::Yes ? Optional<ProcessingUserGestureState>(ProcessingUserGesture) : WTF::nullopt);

Modified: trunk/Source/WebCore/loader/FrameLoaderClient.h (258475 => 258476)


--- trunk/Source/WebCore/loader/FrameLoaderClient.h	2020-03-14 22:59:34 UTC (rev 258475)
+++ trunk/Source/WebCore/loader/FrameLoaderClient.h	2020-03-15 00:14:33 UTC (rev 258476)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006-2017 Apple Inc. All rights reserved.
+ * Copyright (C) 2006-2020 Apple Inc. All rights reserved.
  * Copyright (C) 2012 Google Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -380,7 +380,7 @@
     virtual AllowsContentJavaScript allowsContentJavaScriptFromMostRecentNavigation() const { return AllowsContentJavaScript::Yes; }
 
     virtual bool hasNavigatedAwayFromAppBoundDomain() { return false; }
-
+    virtual bool needsInAppBrowserPrivacyQuirks() const { return false; }
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/page/Frame.cpp (258475 => 258476)


--- trunk/Source/WebCore/page/Frame.cpp	2020-03-14 22:59:34 UTC (rev 258475)
+++ trunk/Source/WebCore/page/Frame.cpp	2020-03-15 00:14:33 UTC (rev 258476)
@@ -5,7 +5,7 @@
  *                     2000 Simon Hausmann <hausm...@kde.org>
  *                     2000 Stefan Schimanski <1st...@gmx.de>
  *                     2001 George Staikos <stai...@kde.org>
- * Copyright (C) 2004-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2004-2020 Apple Inc. All rights reserved.
  * Copyright (C) 2005 Alexey Proskuryakov <a...@nypop.com>
  * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
  * Copyright (C) 2008 Eric Seidel <e...@webkit.org>
@@ -624,7 +624,7 @@
 
 void Frame::injectUserScriptImmediately(DOMWrapperWorld& world, const UserScript& script)
 {
-    if (loader().client().hasNavigatedAwayFromAppBoundDomain())
+    if (loader().client().hasNavigatedAwayFromAppBoundDomain() && !loader().client().needsInAppBrowserPrivacyQuirks())
         return;
 
     auto* document = this->document();

Modified: trunk/Source/WebKit/ChangeLog (258475 => 258476)


--- trunk/Source/WebKit/ChangeLog	2020-03-14 22:59:34 UTC (rev 258475)
+++ trunk/Source/WebKit/ChangeLog	2020-03-15 00:14:33 UTC (rev 258476)
@@ -1,3 +1,20 @@
+2020-03-14  Brent Fulgham  <bfulg...@apple.com>
+
+        Add missing checks needed for AppBound Quirk
+        https://bugs.webkit.org/show_bug.cgi?id=209117
+        <rdar://problem/60460097>
+
+        Reviewed by John Wilander.
+
+        The checks for the 'NeedsInAppBrowserPrivacyQuirks' flag added in r258101 was incomplete.
+        These changes let the WebFrameLoaderClient report the quirk state to WebCore code. 
+
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::needsInAppBrowserPrivacyQuirks): Added.
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
+        * WebProcess/WebPage/WebPage.h:
+        (WebKit::WebPage::needsInAppBrowserPrivacyQuirks const): Added.
+
 2020-03-10  Darin Adler  <da...@apple.com>
 
         Change all return values in TextIterator header from live ranges to SimpleRange

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (258475 => 258476)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2020-03-14 22:59:34 UTC (rev 258475)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2020-03-15 00:14:33 UTC (rev 258476)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2018 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2020 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -1936,6 +1936,16 @@
     return webPage->hasNavigatedAwayFromAppBoundDomain() == NavigatedAwayFromAppBoundDomain::Yes;
 }
 
+bool WebFrameLoaderClient::needsInAppBrowserPrivacyQuirks() const
+{
+    auto* webPage = m_frame->page();
+    if (!webPage)
+        return false;
+    
+    return webPage->needsInAppBrowserPrivacyQuirks();
+}
+
+
 } // namespace WebKit
 
 #undef PREFIX_PARAMETERS

Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h (258475 => 258476)


--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h	2020-03-14 22:59:34 UTC (rev 258475)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h	2020-03-15 00:14:33 UTC (rev 258476)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2020 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -289,6 +289,7 @@
 #endif
 
     bool hasNavigatedAwayFromAppBoundDomain() final;
+    bool needsInAppBrowserPrivacyQuirks() const final;
 };
 
 // As long as EmptyFrameLoaderClient exists in WebCore, this can return 0.

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (258475 => 258476)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2020-03-14 22:59:34 UTC (rev 258475)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2020-03-15 00:14:33 UTC (rev 258476)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010-2019 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2020 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -1300,7 +1300,8 @@
     NavigatingToAppBoundDomain isNavigatingToAppBoundDomain() const { return m_isNavigatingToAppBoundDomain; }
     NavigatedAwayFromAppBoundDomain hasNavigatedAwayFromAppBoundDomain() const { return m_hasNavigatedAwayFromAppBoundDomain; }
     void setHasNavigatedAwayFromAppBoundDomain(NavigatedAwayFromAppBoundDomain navigatedAwayFromAppBoundDomain) { m_hasNavigatedAwayFromAppBoundDomain = navigatedAwayFromAppBoundDomain; }
-
+    bool needsInAppBrowserPrivacyQuirks() const { return m_needsInAppBrowserPrivacyQuirks; }
+    
     bool shouldUseRemoteRenderingFor(WebCore::RenderingPurpose);
     
 private:
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to