Add missing checks needed for AppBound Quirk
authorbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 15 Mar 2020 00:14:33 +0000 (00:14 +0000)
committerbfulgham@apple.com <bfulgham@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 15 Mar 2020 00:14:33 +0000 (00:14 +0000)
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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@258476 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/bindings/js/ScriptController.cpp
Source/WebCore/loader/FrameLoaderClient.h
Source/WebCore/page/Frame.cpp
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.h
Source/WebKit/WebProcess/WebPage/WebPage.h

index 47b6139..58436ef 100644 (file)
@@ -1,3 +1,21 @@
+2020-03-14  Brent Fulgham  <bfulgham@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  <darin@apple.com>
 
         Change all return values in TextIterator header from live ranges to SimpleRange
index dd2bc8d..af368b7 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  Copyright (C) 1999-2001 Harri Porten (porten@kde.org)
  *  Copyright (C) 2001 Peter Kelly (pmk@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 @@ JSC::JSValue ScriptController::executeScriptInWorldIgnoringException(DOMWrapperW
 
 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);
index 2872a4a..b6253e7 100644 (file)
@@ -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 @@ public:
     virtual AllowsContentJavaScript allowsContentJavaScriptFromMostRecentNavigation() const { return AllowsContentJavaScript::Yes; }
 
     virtual bool hasNavigatedAwayFromAppBoundDomain() { return false; }
-
+    virtual bool needsInAppBrowserPrivacyQuirks() const { return false; }
 };
 
 } // namespace WebCore
index 9b5aa40..eca5141 100644 (file)
@@ -5,7 +5,7 @@
  *                     2000 Simon Hausmann <hausmann@kde.org>
  *                     2000 Stefan Schimanski <1Stein@gmx.de>
  *                     2001 George Staikos <staikos@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 <ap@nypop.com>
  * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
  * Copyright (C) 2008 Eric Seidel <eric@webkit.org>
@@ -624,7 +624,7 @@ void Frame::injectUserScripts(UserScriptInjectionTime injectionTime)
 
 void Frame::injectUserScriptImmediately(DOMWrapperWorld& world, const UserScript& script)
 {
-    if (loader().client().hasNavigatedAwayFromAppBoundDomain())
+    if (loader().client().hasNavigatedAwayFromAppBoundDomain() && !loader().client().needsInAppBrowserPrivacyQuirks())
         return;
 
     auto* document = this->document();
index dfcae92..cc2e136 100644 (file)
@@ -1,3 +1,20 @@
+2020-03-14  Brent Fulgham  <bfulgham@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  <darin@apple.com>
 
         Change all return values in TextIterator header from live ranges to SimpleRange
index 74f7389..03a8f49 100644 (file)
@@ -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 @@ bool WebFrameLoaderClient::hasNavigatedAwayFromAppBoundDomain()
     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
index 2194190..db27b77 100644 (file)
@@ -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 @@ private:
 #endif
 
     bool hasNavigatedAwayFromAppBoundDomain() final;
+    bool needsInAppBrowserPrivacyQuirks() const final;
 };
 
 // As long as EmptyFrameLoaderClient exists in WebCore, this can return 0.
index 1d7a2d5..6939c23 100644 (file)
@@ -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 @@ public:
     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: