You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2018/07/31 20:50:18 UTC

[GitHub] brodybits commented on a change in pull request #274: CB-14187: (ios) Change the InAppBrowser to allow custom schemes

brodybits commented on a change in pull request #274: CB-14187: (ios) Change the InAppBrowser to allow custom schemes
URL: https://github.com/apache/cordova-plugin-inappbrowser/pull/274#discussion_r206679000
 
 

 ##########
 File path: tests/tests.js
 ##########
 @@ -693,4 +698,29 @@ exports.defineManualTests = function (contentEl, createActionButton) {
             });
         });
     }, 'openHardwareBackDefaultAfterNo');
+
+    // Customscheme
+    createActionButton('customscheme', function () {
+        var ref = cordova.InAppBrowser.open('about:blank', '_blank', 'hidden=yes');
+        var openedCustomscheme = false;
+        ref.addEventListener('loadstop', function (e) {
+            // Avoid showing the alert twice on iOS, since loadstop is also being called after the customscheme event.
+            if (!openedCustomscheme) {
+                openedCustomscheme = true;
+                ref.executeScript({ code: 'window.location.replace("custom://test");' });
+            }
+        });
+        ref.addEventListener('customscheme', function (e) {
+            if (e && e.url === "custom://test") {
 
 Review comment:
   I just discovered today that `npm run eslint` has a few failures:
   
   ```
   /Users/brodybits/Documents/cordova/cordova-plugin-inappbrowser/tests/tests.js
     714:32  error  Strings must use singlequote                    quotes
     715:1   error  Expected indentation of 16 spaces but found 14  indent
     715:15  error  'alert' is not defined                          no-undef
     717:1   error  Expected indentation of 16 spaces but found 14  indent
     717:15  error  'alert' is not defined                          no-undef
     722:13  error  'alert' is not defined                          no-undef
   
   ✖ 6 problems (6 errors, 0 warnings)
     3 errors, 0 warnings potentially fixable with the `--fix` option.
   ```
   
   I can think of 2 possible solutions for `'alert' is not defined`:
   - use `// eslint-disable-line no-undef`
   - preferred: use `window.alert` (less ugly, more likely to work on Windows platform)
   
   A nice bonus would be to fix `alert` --> `window.alert` throughout `tests.js`.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org