Skip to content

Commit

Permalink
spec rename isWKWebView to hasMobileWKWebView
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher J. Brody committed Aug 14, 2018
1 parent 029e9e3 commit 62767f6
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 40 deletions.
4 changes: 1 addition & 3 deletions spec/www/spec/browser-check-startup.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,7 @@ var isAndroid = !isWindows && /Android/.test(navigator.userAgent);
var isMac = /Macintosh/.test(navigator.userAgent);
var isAppleMobileOS = /iPhone/.test(navigator.userAgent) ||
/iPad/.test(navigator.userAgent) || /iPod/.test(navigator.userAgent);
// XXX FUTURE TBD RENAME to hasWKWebView
// (here and in actual test scripts):
var isWKWebView = isAppleMobileOS && !!window.webkit && !!window.webkit.messageHandlers;
var hasMobileWKWebView = isAppleMobileOS && !!window.webkit && !!window.webkit.messageHandlers;

window.hasBrowser = true;
window.hasWebKitWebSQL = isAndroid || (isAppleMobileOS && !isWKWebView);
Expand Down
28 changes: 14 additions & 14 deletions spec/www/spec/db-sql-operations-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var isAndroid = !isWindows && /Android/.test(navigator.userAgent);
var isMac = /Macintosh/.test(navigator.userAgent);
var isAppleMobileOS = /iPhone/.test(navigator.userAgent) ||
/iPad/.test(navigator.userAgent) || /iPod/.test(navigator.userAgent);
var isWKWebView = isAppleMobileOS && !!window.webkit && !!window.webkit.messageHandlers;
var hasMobileWKWebView = isAppleMobileOS && !!window.webkit && !!window.webkit.messageHandlers;

// NOTE: While in certain version branches there is no difference between
// the default Android implementation and implementation #2,
Expand Down Expand Up @@ -108,7 +108,7 @@ var mytests = function() {
expect(rs).toBeDefined();
expect(rs.rows).toBeDefined();
expect(rs.rows.length).toBe(1);
if (isMac || isWKWebView)
if (isMac || hasMobileWKWebView)
expect(rs.rows.item(0).myresult).toBe('real');
else if (isAndroid && isImpl2)
expect(rs.rows.item(0).myresult).toBe('text');
Expand Down Expand Up @@ -152,7 +152,7 @@ var mytests = function() {
expect(rs).toBeDefined();
expect(rs.rows).toBeDefined();
expect(rs.rows.length).toBe(1);
if (isMac || isWKWebView)
if (isMac || hasMobileWKWebView)
expect(rs.rows.item(0).myresult).toBe('real');
else if (isAndroid && isImpl2)
expect(rs.rows.item(0).myresult).toBe('text');
Expand Down Expand Up @@ -280,7 +280,7 @@ var mytests = function() {
expect(rs).toBeDefined();
expect(rs.rows).toBeDefined();
expect(rs.rows.length).toBe(1);
if (isMac || isWKWebView)
if (isMac || hasMobileWKWebView)
expect(rs.rows.item(0).myresult).toBe('real');
else if (isAndroid && isImpl2)
expect(rs.rows.item(0).myresult).toBe('text');
Expand Down Expand Up @@ -498,22 +498,22 @@ var mytests = function() {
expect(rs.rows).toBeDefined();
expect(rs.rows.length).toBe(9);
expect(rs.rows.item(0).d1).toBe(101);
if (isMac || isWKWebView)
if (isMac || hasMobileWKWebView)
expect(rs.rows.item(0).t1).toBe('real');
else
expect(rs.rows.item(0).t1).toBe('integer');
expect(rs.rows.item(0).a1).toBe(101);
if (isMac || isWKWebView)
if (isMac || hasMobileWKWebView)
expect(rs.rows.item(0).u1).toBe('101.0');
else
expect(rs.rows.item(0).u1).toBe('101');
expect(rs.rows.item(1).d1).toBe(-101);
if (isMac || isWKWebView)
if (isMac || hasMobileWKWebView)
expect(rs.rows.item(1).t1).toBe('real');
else
expect(rs.rows.item(1).t1).toBe('integer');
expect(rs.rows.item(1).a1).toBe(101);
if (isMac || isWKWebView)
if (isMac || hasMobileWKWebView)
expect(rs.rows.item(1).u1).toBe('-101.0');
else
expect(rs.rows.item(1).u1).toBe('-101');
Expand All @@ -526,22 +526,22 @@ var mytests = function() {
expect(rs.rows.item(3).a1).toBe(123.456);
expect(rs.rows.item(3).u1).toBe('-123.456');
expect(rs.rows.item(4).d1).toBe(1234567890123);
if (isMac || isWKWebView)
if (isMac || hasMobileWKWebView)
expect(rs.rows.item(4).t1).toBe('real');
else
expect(rs.rows.item(4).t1).toBe('integer');
expect(rs.rows.item(4).a1).toBe(1234567890123);
if (isMac || isWKWebView)
if (isMac || hasMobileWKWebView)
expect(rs.rows.item(4).u1).toBe('1234567890123.0');
else
expect(rs.rows.item(4).u1).toBe('1234567890123');
expect(rs.rows.item(5).d1).toBe(-1234567890123);
if (isMac || isWKWebView)
if (isMac || hasMobileWKWebView)
expect(rs.rows.item(5).t1).toBe('real');
else
expect(rs.rows.item(5).t1).toBe('integer');
expect(rs.rows.item(5).a1).toBe(1234567890123);
if (isMac || isWKWebView)
if (isMac || hasMobileWKWebView)
expect(rs.rows.item(5).u1).toBe('-1234567890123.0');
else
expect(rs.rows.item(5).u1).toBe('-1234567890123');
Expand All @@ -554,12 +554,12 @@ var mytests = function() {
expect(rs.rows.item(7).a1).toBe(1234567890123.4);
expect(rs.rows.item(7).u1).toBe('-1234567890123.4');
expect(rs.rows.item(8).d1).toBe(0);
if (isMac || isWKWebView)
if (isMac || hasMobileWKWebView)
expect(rs.rows.item(8).t1).toBe('real');
else
expect(rs.rows.item(8).t1).toBe('integer');
expect(rs.rows.item(8).a1).toBe(0);
if (isMac || isWKWebView)
if (isMac || hasMobileWKWebView)
expect(rs.rows.item(8).u1).toBe('0.0');
else
expect(rs.rows.item(8).u1).toBe('0');
Expand Down
14 changes: 7 additions & 7 deletions spec/www/spec/db-tx-sql-select-value-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var isAndroid = !isWindows && /Android/.test(navigator.userAgent);
var isMac = /Macintosh/.test(navigator.userAgent);
var isAppleMobileOS = /iPhone/.test(navigator.userAgent) ||
/iPad/.test(navigator.userAgent) || /iPod/.test(navigator.userAgent);
var isWKWebView = isAppleMobileOS && !!window.webkit && !!window.webkit.messageHandlers;
var hasMobileWKWebView = isAppleMobileOS && !!window.webkit && !!window.webkit.messageHandlers;

// The following openDatabase settings are used for Plugin-implementation-2
// on Android:
Expand Down Expand Up @@ -409,7 +409,7 @@ var mytests = function() {
expect(rs).toBeDefined();
expect(rs.rows).toBeDefined();
expect(rs.rows.length).toBe(1);
if (isWebSql || isMac || isWKWebView)
if (isWebSql || isMac || hasMobileWKWebView)
expect(rs.rows.item(0).myresult).toBe('real');
else if (!isWebSql && isAndroid && isImpl2)
expect(rs.rows.item(0).myresult).toBe('text');
Expand Down Expand Up @@ -474,7 +474,7 @@ var mytests = function() {
expect(rs).toBeDefined();
expect(rs.rows).toBeDefined();
expect(rs.rows.length).toBe(1);
if (isWebSql || isMac || isWKWebView)
if (isWebSql || isMac || hasMobileWKWebView)
expect(rs.rows.item(0).myresult).toBe('real');
else if (!isWebSql && isAndroid && isImpl2)
expect(rs.rows.item(0).myresult).toBe('text');
Expand Down Expand Up @@ -665,7 +665,7 @@ var mytests = function() {
expect(rs).toBeDefined();
expect(rs.rows).toBeDefined();
expect(rs.rows.length).toBe(1);
if (isWebSql || isMac || isWKWebView)
if (isWebSql || isMac || hasMobileWKWebView)
expect(rs.rows.item(0).myresult).toBe('real');
else if (!isWebSql && isAndroid && isImpl2)
expect(rs.rows.item(0).myresult).toBe('text');
Expand Down Expand Up @@ -730,7 +730,7 @@ var mytests = function() {
expect(rs).toBeDefined();
expect(rs.rows).toBeDefined();
expect(rs.rows.length).toBe(1);
if (isWebSql || isMac || isWKWebView)
if (isWebSql || isMac || hasMobileWKWebView)
expect(rs.rows.item(0).myresult).toBe('real');
else if (!isWebSql && isAndroid && isImpl2)
expect(rs.rows.item(0).myresult).toBe('text');
Expand Down Expand Up @@ -924,7 +924,7 @@ var mytests = function() {
expect(rs).toBeDefined();
expect(rs.rows).toBeDefined();
expect(rs.rows.length).toBe(1);
if (isWebSql || isMac || isWKWebView)
if (isWebSql || isMac || hasMobileWKWebView)
expect(rs.rows.item(0).myresult).toBe('real');
else if (!isWebSql && isAndroid && isImpl2)
expect(rs.rows.item(0).myresult).toBe('text');
Expand Down Expand Up @@ -989,7 +989,7 @@ var mytests = function() {
expect(rs).toBeDefined();
expect(rs.rows).toBeDefined();
expect(rs.rows.length).toBe(1);
if (isWebSql || isMac || isWKWebView)
if (isWebSql || isMac || hasMobileWKWebView)
expect(rs.rows.item(0).myresult).toBe('real');
else if (!isWebSql && isAndroid && isImpl2)
expect(rs.rows.item(0).myresult).toBe('text');
Expand Down
10 changes: 5 additions & 5 deletions spec/www/spec/db-tx-value-bindings-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var isAndroid = !isWindows && /Android/.test(navigator.userAgent);
var isMac = /Macintosh/.test(navigator.userAgent);
var isAppleMobileOS = /iPhone/.test(navigator.userAgent) ||
/iPad/.test(navigator.userAgent) || /iPod/.test(navigator.userAgent);
var isWKWebView = isAppleMobileOS && !!window.webkit && !!window.webkit.messageHandlers;
var hasMobileWKWebView = isAppleMobileOS && !!window.webkit && !!window.webkit.messageHandlers;

// NOTE: While in certain version branches there is no difference between
// the default Android implementation and implementation #2,
Expand Down Expand Up @@ -330,7 +330,7 @@ var mytests = function() {
expect(row.data3).toBe(42);
expect(row.data4).toBe(42);

if (isWebSql || isMac || isWKWebView)
if (isWebSql || isMac || hasMobileWKWebView)
expect(row.data5).toBe('42.0');
else
expect(row.data5).toBe('42');
Expand All @@ -341,7 +341,7 @@ var mytests = function() {
expect(rs3.rows.length).toBe(1);

var row = rs3.rows.item(0);
if (isWebSql || isMac || isWKWebView)
if (isWebSql || isMac || hasMobileWKWebView)
expect(row.t1).toBe('real');
else
expect(row.t1).toBe('integer');
Expand Down Expand Up @@ -654,7 +654,7 @@ var mytests = function() {

// NOTE: big number stored in field with TEXT affinity with different conversion
// in case of plugin (certain platforms) vs. Android/iOS WebKit Web SQL
if (isWebSql || isMac || isWKWebView)
if (isWebSql || isMac || hasMobileWKWebView)
expect(row.test_text).toBe("1424174959894.0"); // ([Big] number inserted as string ok)
else
expect(row.test_text).toBe("1424174959894"); // (Big integer number inserted as string ok)
Expand All @@ -665,7 +665,7 @@ var mytests = function() {
expect(rs3.rows.length).toBe(1);

var row = rs3.rows.item(0);
if (isWebSql || isMac || isWKWebView)
if (isWebSql || isMac || hasMobileWKWebView)
expect(row.t1).toBe('real');
else
expect(row.t1).toBe('integer');
Expand Down
22 changes: 11 additions & 11 deletions spec/www/spec/sql-batch-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var isAndroid = !isWindows && /Android/.test(navigator.userAgent);
var isMac = /Macintosh/.test(navigator.userAgent);
var isAppleMobileOS = /iPhone/.test(navigator.userAgent) ||
/iPad/.test(navigator.userAgent) || /iPod/.test(navigator.userAgent);
var isWKWebView = isAppleMobileOS && !!window.webkit && !!window.webkit.messageHandlers;
var hasMobileWKWebView = isAppleMobileOS && !!window.webkit && !!window.webkit.messageHandlers;

// NOTE: While in certain version branches there is no difference between
// the default Android implementation and implementation #2,
Expand Down Expand Up @@ -113,22 +113,22 @@ var mytests = function() {
expect(rs.rows).toBeDefined();
expect(rs.rows.length).toBe(7);
expect(rs.rows.item(0).d1).toBe(101);
if (isMac || isWKWebView)
if (isMac || hasMobileWKWebView)
expect(rs.rows.item(0).t1).toBe('real');
else
expect(rs.rows.item(0).t1).toBe('integer');
expect(rs.rows.item(0).a1).toBe(101);
if (isMac || isWKWebView)
if (isMac || hasMobileWKWebView)
expect(rs.rows.item(0).u1).toBe('101.0');
else
expect(rs.rows.item(0).u1).toBe('101');
expect(rs.rows.item(1).d1).toBe(-101);
if (isMac || isWKWebView)
if (isMac || hasMobileWKWebView)
expect(rs.rows.item(1).t1).toBe('real');
else
expect(rs.rows.item(1).t1).toBe('integer');
expect(rs.rows.item(1).a1).toBe(101);
if (isMac || isWKWebView)
if (isMac || hasMobileWKWebView)
expect(rs.rows.item(1).u1).toBe('-101.0');
else
expect(rs.rows.item(1).u1).toBe('-101');
Expand All @@ -141,32 +141,32 @@ var mytests = function() {
expect(rs.rows.item(3).a1).toBe(123.456);
expect(rs.rows.item(3).u1).toBe('-123.456');
expect(rs.rows.item(4).d1).toBe(1234567890123);
if (isMac || isWKWebView)
if (isMac || hasMobileWKWebView)
expect(rs.rows.item(4).t1).toBe('real');
else
expect(rs.rows.item(4).t1).toBe('integer');
expect(rs.rows.item(4).a1).toBe(1234567890123);
if (isMac || isWKWebView)
if (isMac || hasMobileWKWebView)
expect(rs.rows.item(4).u1).toBe('1234567890123.0');
else
expect(rs.rows.item(4).u1).toBe('1234567890123');
expect(rs.rows.item(5).d1).toBe(-1234567890123);
if (isMac || isWKWebView)
if (isMac || hasMobileWKWebView)
expect(rs.rows.item(5).t1).toBe('real');
else
expect(rs.rows.item(5).t1).toBe('integer');
expect(rs.rows.item(5).a1).toBe(1234567890123);
if (isMac || isWKWebView)
if (isMac || hasMobileWKWebView)
expect(rs.rows.item(5).u1).toBe('-1234567890123.0');
else
expect(rs.rows.item(5).u1).toBe('-1234567890123');
expect(rs.rows.item(6).d1).toBe(0);
if (isMac || isWKWebView)
if (isMac || hasMobileWKWebView)
expect(rs.rows.item(6).t1).toBe('real');
else
expect(rs.rows.item(6).t1).toBe('integer');
expect(rs.rows.item(6).a1).toBe(0);
if (isMac || isWKWebView)
if (isMac || hasMobileWKWebView)
expect(rs.rows.item(6).u1).toBe('0.0');
else
expect(rs.rows.item(6).u1).toBe('0');
Expand Down

0 comments on commit 62767f6

Please sign in to comment.