Skip to content

Commit 981a8b5

Browse files
committed
Rework Section 3.
1 parent 0fb92aa commit 981a8b5

File tree

3 files changed

+87
-52
lines changed

3 files changed

+87
-52
lines changed

bibliography.bib

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,16 @@ @misc{davis2017safari
355355
Howpublished = {\url{https://webkit.org/blog/8042/release-notes-for-safari-technology-preview-46/}},
356356
Journal = {WebKit},
357357
Number = {Dec 2017},
358-
Title = {Release Notes for Safari Technology Preview 46},
358+
Title = {Release Notes for Safari Technology Preview~46},
359359
Type = {Blog},
360360
Year = {2017}}
361+
362+
@misc{chrome2018useragent,
363+
Author = {{Google Chrome}},
364+
Howpublished = {\url{https://developer.chrome.com/multidevice/user-agent}},
365+
Journal = {Google Chrome},
366+
Number = {Jan 2018},
367+
Title = {User Agent Strings},
368+
Type = {Blog},
369+
Year = {2018}}
361370

whats-in-a-webview.pdf

2.89 KB
Binary file not shown.

whats-in-a-webview.tex

Lines changed: 77 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
numberstyle=\footnotesize,
4444
numbersep=9pt,
4545
tabsize=2,
46+
frame = single,
4647
breaklines=true,
4748
showtabs=false,
4849
captionpos=b
@@ -433,13 +434,13 @@ \section{Detecting \textsc{pwa} Features}
433434
that in some way or the other use Service Worker \textsc{api}s,
434435
feel (native) ``app-like,'' use latest browser features if they are available
435436
(Progressive Enhancement~\cite{champeon2003progressiveenhancement}),
436-
or that can be installed (added) to the home screen.
437+
or that can be installed to the home screen.
437438
Russell~\cite{russell2016pwa} lists a~number of requirements
438439
for what he calls ``baseline appyness'':
439440
``A~Progressive Web App is functionally defined by the technical properties
440441
that allow the browser to detect that the site meets certain criteria
441442
and is worthy of being added to the homescreen.
442-
These criteria are motivated by user-experience concerns.
443+
[\ldots]
443444
Apps on the homescreen:
444445
445446
\begin{itemize}
@@ -454,27 +455,27 @@ \section{Detecting \textsc{pwa} Features}
454455
\end{itemize}
455456
456457
In continuation, Russell translates these requirements into more technical terms,
457-
writing that \textsc{pwa}s must:
458+
writing that \textsc{pwa}s must (emphasis ours):
458459
459460
\begin{itemize}
460461
\item ``Originate from a Secure Origin.
461462
Served over \textsc{tls} and green padlock displays (no active mixed content).
462463
\item Load while offline (even if only a custom offline page).
463-
By implication, this means that Progressive Web Apps require Service Workers.
464+
By implication, this means that \emph{Progressive Web Apps require Service Workers}.
464465
\item Reference a~Web App Manifest [\ldots]''
465466
\end{itemize}
466467
467-
For our study, we consider a~``\textsc{pwa} feature'' any feature that requires
468-
one or more of the Service Worker \textsc{api}s.
469-
Additionally, if (if and only if) the Web View implements Service Workers,
470-
we consider some more recent browser \textsc{api}s,
468+
In consequence, we consider a~``\textsc{pwa} feature''
469+
any feature that requires one or more of the Service Worker \textsc{api}s.
470+
Additionally, \emph{iff} (if and only if) the Web View implements Service Workers,
471+
we further consider additional recent browser \textsc{api}s,
471472
detailed in the following.
472473
473-
\subsection{Progressive Web App Features}
474+
\subsection{Detecting Service Worker Support}
474475
475-
A~\texttt{ServiceWorker} is installed by calling the registration method
476-
on the \texttt{navigator} object, the first parameter is obligatory
477-
and contains a~\textsc{url} that points to a~JavaScript file with the Service Worker logic.
476+
A~\texttt{ServiceWorker} is installed by calling the \texttt{register} method
477+
on the \texttt{navigator} object, whose first parameter is obligatory
478+
and contains a~\textsc{url} that points to a~JavaScript file with the Service Worker code.
478479
The result of this promise-based \textsc{api} in the success case is then
479480
a~\texttt{ServiceWorkerRegistration} object,
480481
which is either newly created if there was no previous \texttt{ServiceWorker},
@@ -483,50 +484,39 @@ \subsection{Progressive Web App Features}
483484
In order to detect if a~given Web View supports \textsc{pwa} features at all,
484485
we can thus make a simple existence check for the \textsc{api},
485486
and then try to register a~Service Worker, as outlined in \autoref{code:sw-supported}.
486-
If the Web View supports Service Workers, we look at the following \textsc{pwa} features.
487487
488-
\begin{lstlisting}[caption={Checking for Service Worker support.},
489-
label=code:sw-supported, language=JavaScript, float=htb]
490-
if ('serviceWorker' in navigator) {
491-
navigator.serviceWorker.register(scriptURL, options)
492-
.then(registration => {
493-
console.log(registration);
494-
})
495-
.catch(error => {
496-
console.log(error);
497-
});
498-
} else {
499-
console.log('Service Workers not supported');
500-
}
501-
\end{lstlisting}
488+
\subsection{Considered Progressive Web App Features}
502489
503490
\begin{description}
504491
\itemsep0em
505492
\item[Offline Capabilities] The ability to still load and work
506-
at least to some extent, even when the device is offline, for example,
507-
when it is in airplane mode or currently has no network~\cite{russell2017serviceworkers}.
493+
at least to some extent, even when the device is offline~\cite{russell2017serviceworkers},
494+
for example, when airplane mode is on or when the device temporarily has no network coverage.
508495
\item[Push Notifications] The capability to display push notifications as defined in
509496
the Push \textsc{api}~\cite{beverloo2017pushapi}, for example,
510497
to point users to fresh content, even when the app is not running.
511498
\item[Add to Home Screen] The capability to be installed (added) to a~device's home screen
512499
for easy access as outlined in~\cite{kinlan2017a2hs}.
513-
\item[Background Sync] The capability to synchronize data in the background,
500+
\item[Background Sync] The capability to synchronize data
501+
in the background~\cite{russell2017serviceworkers},
514502
for example, to send messages in a~deferred way
515-
after an offline situation in a~chat app~\cite{russell2017serviceworkers}.
503+
after a~temporary offline situation in a~chat app.
516504
\item[Navigation Preload] The capability to start network navigation requests
517505
even while the Service Worker has not booted yet~\cite{archibald2017navigationpreload},
518506
which would else be a~blocking operation.
519-
\item[Silent Push] The capability to use the Web Budget \cite{beverloo2017budgetapi}
520-
in order to determine if potentially expensive operations should be started
521-
following a~silent push notification.
507+
\item[Silent Push] The capability to use the Web Budget
508+
\textsc{api}~\cite{beverloo2017budgetapi}
509+
to determine if potentially expensive operations
510+
like background refresh may be started
511+
upon a~silent push notification.
522512
\item[Storage Estimation] The capability to estimate the available storage
523-
an application already uses and the available quota enforced by the
513+
that an application already uses and to know the available quota enforced by the
524514
browser~\cite{vankesteren2018storage}.
525515
\item[Persistent Storage] The capability to persistently store data
526516
that is guaranteed not to be purged by the browser without user consent,
527517
even if memory is running out~\cite{vankesteren2018storage}.
528-
\item[Web Share] The capability to invoke the native sharing widgets
529-
of the browser, as defined in the Web Share \textsc{api}~\cite{giuca2017webshare}.
518+
\item[Web Share] The capability to invoke the native sharing widget
519+
of the operating system, as defined in the Web Share \textsc{api}~\cite{giuca2017webshare}.
530520
\item[Media Session] The capability to show customized media metadata
531521
on the platform user interface, customize available platform media controls,
532522
and access platform media keys found in notification areas
@@ -536,20 +526,20 @@ \subsection{Progressive Web App Features}
536526
when picking media content for the user by exposing information
537527
about the decoding and encoding capabilities for a given format,
538528
but also output capabilities to find the best match based on the device's display
539-
as defined in Media Capabilities standard~\cite{lamouri2017mediacapabilities}.
529+
as defined in the Media Capabilities standard~\cite{lamouri2017mediacapabilities}.
540530
\item[Device Memory] The capability to read the amount of available
541531
Random Access Memory (\textsc{ram}) in Gigabyte
542532
of a~device in order to allow servers to customize the app experience
543-
based on the available memory~\cite{panicker2017devicememory}.
533+
based on the built-in memory~\cite{panicker2017devicememory}.
544534
\item[Getting Installed Related Apps] The capability to detect if a~corresponding
545535
native application is installed alongside the \textsc{pwa} in order to,
546536
for example, not show push notifications twice on both apps~\cite{kinlan2017relatedapps}.
547537
\item[Payment Request] The capability to act as intermediary among merchants,
548538
users, and payment methods by means of a~standardized payment communication flow
549539
that supports different secure payment methods~\cite{bateman2017paymentrequest}.
550540
\item[Credential Management] The capability to request a user's credentials
551-
from the browser, and to help the browser correctly store user credentials
552-
for future use~\cite{west2017credentialmanagement}.
541+
from the browser, and to help the browser correctly store credentials
542+
for future use to facilitate logins~\cite{west2017credentialmanagement}.
553543
\end{description}
554544
555545
\subsection{Feature-Detecting Various \textsc{pwa} Features}
@@ -559,7 +549,7 @@ \subsection{Feature-Detecting Various \textsc{pwa} Features}
559549
The idea behind feature detection is to run a~test to determine
560550
whether a~certain feature is supported in the current browser,
561551
and then conditionally run code to provide an acceptable experience
562-
both in browsers that do support the feature, and browser that do not.
552+
both in browsers that do support the feature, and browsers that do not.
563553
It is distinct from \emph{browser sniffing}, where based on the user agent string
564554
assumptions are being made regarding feature support,
565555
which is generally considered problematic and bad practice~\cite{andersen2008useragent}.
@@ -571,8 +561,25 @@ \subsection{Feature-Detecting Various \textsc{pwa} Features}
571561
\texttt{win} for \texttt{window}, and \texttt{doc} for \texttt{document}
572562
purely serve for code minification.
573563
564+
\begin{lstlisting}[caption={Checking for Service Worker support.},
565+
label=code:sw-supported, language=JavaScript, float=t]
566+
// This commonly should happen after `window.onload`
567+
// has fired in order to prioritize content display
568+
if ('serviceWorker' in navigator) {
569+
navigator.serviceWorker.register(scriptURL, options)
570+
.then(registration => {
571+
console.log(registration);
572+
})
573+
.catch(error => {
574+
console.log(error);
575+
});
576+
} else {
577+
console.log('Service Workers not supported');
578+
}
579+
\end{lstlisting}
580+
574581
\begin{lstlisting}[caption={Feature detection of various \textsc{pwa} features.},
575-
label=code:feature-detection, language=JavaScript, float=htb]
582+
label=code:feature-detection, language=JavaScript, float=t]
576583
// nav ==> navigator
577584
// win ==> window
578585
// doc ==> document
@@ -606,30 +613,49 @@ \subsection{Feature-Detecting Various \textsc{pwa} Features}
606613
\subsection{Implementation Details}
607614
608615
We have developed an open-source application called \emph{\textsc{pwa} Feature Detector}
609-
that allows for easily testing in-app browsers (and obviously stand-alone browsers on top)
616+
that allows for easily testing in-app browsers (and naturally stand-alone browsers as well)
610617
and check for the available \textsc{pwa} features.
611618
The code of the application can be found at
612619
\url{https://github.com/tomayac/pwa-feature-detector},
613620
the app itself is deployed at \url{https://tomayac.github.io/pwa-feature-detector/}.
621+
When the \texttt{window.load} event fires,
622+
it tries to register a~no-op Service Worker
623+
that---in the success case---immediately claims its clients
624+
in order to obtain a~\texttt{ServiceWorkerRegistration},
625+
which is required for the then executed feature detection tests
626+
in \autoref{code:feature-detection}.
627+
Finally, it displays the results in tabular form,
628+
and also prints the browser's user agent string.
614629
\autoref{fig:wechat-android-chrome65} shows a~screenshot of \textsc{pwa} Feature Detector
615-
running on Android~8.1.99 in WeChat in a~Web View based on Chrome~65.
616-
617-
\begin{figure}[hbt]
630+
running on Android~8.1.99 in the chat app WeChat in a~\texttt{WebView} based on Chrome~65.
631+
In contrast, \autoref{fig:twitter-android-chrome65} shows
632+
a~screenshot of \textsc{pwa} Feature Detector
633+
running on the \emph{same device}, but this time in the social networking app Twitter,
634+
which, rather than using a~\texttt{WebView},
635+
displays Web content in a~\texttt{CustomTabsIntent}.
636+
Despite the exact same underlying browser engine (Chrome/65.0.3310.3),
637+
the more powerful \texttt{CustomTabsIntent}-based in-app browser
638+
clearly wins the \textsc{pwa} feature competition.
639+
For non-domain experts we note that the \texttt{WebView}
640+
can be easily spotted by looking for the string
641+
``wv'' in the displayed user agent~\cite{chrome2018useragent}.
642+
643+
\begin{figure}[t]
618644
\centering
619645
\includegraphics[width=\columnwidth,frame]{pwa-feature-detector-wechat-android-chrome65}
620646
\caption[\textsc{pwa} Feature Detector running in WeChat.]{
621-
\textsc{pwa} Feature Detector running on Android~8.1.99 in WeChat
647+
\textsc{pwa} Feature Detector running on Android~8.1.99 in the app WeChat
622648
in a~\texttt{WebView} based on Chrome~65.}
623649
\label{fig:wechat-android-chrome65}
624650
\end{figure}
625651
626-
\begin{figure}[hbt]
652+
\begin{figure}[t]
627653
\centering
628654
\includegraphics[width=\columnwidth,frame]{pwa-feature-detector-twitter-android-chrome65}
629655
\caption[\textsc{pwa} Feature Detector running in Twitter.]{
630-
\textsc{pwa} Feature Detector running on Android~8.1.99 in Twitter
656+
\textsc{pwa} Feature Detector running on Android~8.1.99 in the app Twitter
631657
in a~\texttt{CustomTabsIntent} based on Chrome~65.}
632-
\label{fig:wechat-android-chrome65}
658+
\label{fig:twitter-android-chrome65}
633659
\end{figure}
634660
635661
\section{Results and Discussion}

0 commit comments

Comments
 (0)