<commit_before>/*!
{
  "name": "Custom protocol handler",
  "property": "customprotocolhandler",
  "authors": ["<NAME>"],
  "notes": [{
    "name": "WHATWG overview",
    "href": "http://developers.whatwg.org/timers.html#custom-handlers"
  },{
    "name": "MDN documentation",
    "href": "https://developer.mozilla.org/en-US/docs/Web/API/navigator.registerProtocolHandler"
  }],
  "warnings": [],
  "polyfills": []
}
!*/
/* DOC

Detects support for the `window.registerProtocolHandler()` API to allow web sites to register themselves as possible handlers for particular protocols.

*/
define(['Modernizr'], function( Modernizr ) {
  Modernizr.addTest('customprotocolhandler', !!navigator.registerProtocolHandler);
});
<commit_msg>improve custom-protocol-handler.js<commit_after>/*!
{
  "name": "Custom protocol handler",
  "property": "customprotocolhandler",
  "authors": ["<NAME>"],
  "notes": [{
    "name": "WHATWG overview",
    "href": "http://developers.whatwg.org/timers.html#custom-handlers"
  },{
    "name": "MDN documentation",
    "href": "https://developer.mozilla.org/en-US/docs/Web/API/navigator.registerProtocolHandler"
  }],
  "warnings": [],
  "polyfills": []
}
!*/
/* DOC

Detects support for the `window.registerProtocolHandler()` API to allow web
sites to register themselves as possible handlers for particular protocols.

*/
define(['Modernizr'], function( Modernizr ) {
  Modernizr.addTest('customprotocolhandler', function() {
    // early bailout where it doesn't exist at all
    if ( !navigator.registerProtocolHandler ) return false;

    // registerProtocolHandler was stubbed in webkit for a while, and didn't
    // actually do anything. We intentionally set it improperly to test for
    // the proper sort of failure
    try {
      navigator.registerProtocolHandler('thisShouldFail');
    }
    catch (e) {
      return e instanceof TypeError;
    }

    return false;
  });
});

{'fraction_non_alphanumeric': 0.15396659707724425, 'fraction_numerical': 0.0, 'mean_word_length': 4.112, 'pattern_counts': {'":': 20, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3388782', 'n_tokens_mistral': 604, 'n_tokens_neox': 567, 'n_words': 143}