@@ -57,14 +57,13 @@ private class WebViewRef extends Element {
5757 this .( Variable ) .getType ( ) .( RefType ) .getASourceSupertype * ( ) instanceof TypeWebView
5858 }
5959
60- /** Gets an access to this WebView. */
61- Expr getAnAccess ( ) {
62- exists ( ThisAccess t | t .getType ( ) = this and result = t |
63- t .isOwnInstanceAccess ( ) or
64- t .isEnclosingInstanceAccess ( this )
60+ /** Gets an access to this WebView as a data flow node. */
61+ DataFlow:: Node getAnAccess ( ) {
62+ exists ( DataFlow:: InstanceAccessNode t | t .getType ( ) = this and result = t |
63+ t .isOwnInstanceAccess ( ) or t .getInstanceAccess ( ) .isEnclosingInstanceAccess ( this )
6564 )
6665 or
67- result = this .( Variable ) .getAnAccess ( )
66+ result = DataFlow :: exprNode ( this .( Variable ) .getAnAccess ( ) )
6867 }
6968}
7069
@@ -80,20 +79,25 @@ private Expr getUnderlyingExpr(Expr e) {
8079 * Holds if a `WebViewLoadUrlMethod` is called on `webview`
8180 * with `urlArg` as its first argument.
8281 */
83- private predicate webViewLoadUrl ( Argument urlArg , Expr webview ) {
82+ private predicate webViewLoadUrl ( Argument urlArg , DataFlow :: Node webview ) {
8483 exists ( MethodAccess loadUrl |
8584 loadUrl .getArgument ( 0 ) = urlArg and
8685 loadUrl .getMethod ( ) instanceof WebViewLoadUrlMethod
8786 |
88- getUnderlyingExpr ( loadUrl .getQualifier ( ) ) = webview
87+ webview = DataFlow:: exprNode ( getUnderlyingExpr ( loadUrl .getQualifier ( ) ) )
88+ or
89+ webview = DataFlow:: getInstanceArgument ( loadUrl )
8990 or
9091 // `webview` is received as a parameter of an event method in a custom `WebViewClient`,
9192 // so we need to find WebViews that use that specific `WebViewClient`.
9293 exists ( WebViewClientEventMethod eventMethod , MethodAccess setWebClient |
9394 setWebClient .getMethod ( ) instanceof WebViewSetWebViewClientMethod and
9495 setWebClient .getArgument ( 0 ) .getType ( ) = eventMethod .getDeclaringType ( ) and
95- getUnderlyingExpr ( setWebClient .getQualifier ( ) ) = webview and
9696 getUnderlyingExpr ( loadUrl .getQualifier ( ) ) = eventMethod .getWebViewParameter ( ) .getAnAccess ( )
97+ |
98+ webview = DataFlow:: exprNode ( getUnderlyingExpr ( setWebClient .getQualifier ( ) ) )
99+ or
100+ webview = DataFlow:: getInstanceArgument ( setWebClient )
97101 )
98102 )
99103}
0 commit comments