Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[embedlite-components] Intent protocol handler. Fixes JB#50750 OMP#JO…
…LLA-164
- Loading branch information
Marko Kenttala
committed
Jun 14, 2021
1 parent
233509b
commit 2500b65
Showing
3 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
/** | ||
* IntentProtocolHandler.js | ||
*/ | ||
|
||
"use strict"; | ||
|
||
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components; | ||
|
||
Cu.import('resource://gre/modules/XPCOMUtils.jsm'); | ||
|
||
function IntentProtocolHandler() { | ||
} | ||
|
||
IntentProtocolHandler.prototype = { | ||
|
||
scheme: "intent", | ||
protocolFlags: Ci.nsIProtocolHandler.URI_LOADABLE_BY_ANYONE, | ||
|
||
newURI: function(aSpec, aOriginCharset, aBaseURI) { | ||
let ioService = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService); | ||
// Just replace intent scheme with https to fix Android google maps links | ||
let uri = ioService.newURI(aSpec.replace('intent:', 'https:'), null, null); | ||
return uri; | ||
}, | ||
|
||
classID: Components.ID("{878c8294-b764-48fd-87be-7d5e7a44faa9}"), | ||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIProtocolHandler]) | ||
}; | ||
|
||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([IntentProtocolHandler]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters