diff --git a/app/extensions/brave/about-about.html b/app/extensions/brave/about-about.html
index e90b98a39fd..ca5076f4474 100644
--- a/app/extensions/brave/about-about.html
+++ b/app/extensions/brave/about-about.html
@@ -9,8 +9,8 @@
-
-
+
+
diff --git a/app/extensions/brave/about-adblock.html b/app/extensions/brave/about-adblock.html
index d52b4355296..f1e9a026451 100644
--- a/app/extensions/brave/about-adblock.html
+++ b/app/extensions/brave/about-adblock.html
@@ -10,8 +10,8 @@
-
-
+
+
diff --git a/app/extensions/brave/about-autofill.html b/app/extensions/brave/about-autofill.html
index fa767761d04..afe7a2221ed 100644
--- a/app/extensions/brave/about-autofill.html
+++ b/app/extensions/brave/about-autofill.html
@@ -10,8 +10,8 @@
-
-
+
+
diff --git a/app/extensions/brave/about-blank.html b/app/extensions/brave/about-blank.html
index e69de29bb2d..c3f71c40259 100644
--- a/app/extensions/brave/about-blank.html
+++ b/app/extensions/brave/about-blank.html
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/extensions/brave/about-brave.html b/app/extensions/brave/about-brave.html
index e119160607e..157e5de98a6 100644
--- a/app/extensions/brave/about-brave.html
+++ b/app/extensions/brave/about-brave.html
@@ -9,8 +9,8 @@
-
-
+
+
diff --git a/app/extensions/brave/about-certerror.html b/app/extensions/brave/about-certerror.html
index b8527cd35b6..b8563fea72d 100644
--- a/app/extensions/brave/about-certerror.html
+++ b/app/extensions/brave/about-certerror.html
@@ -9,8 +9,8 @@
-
-
+
+
diff --git a/app/extensions/brave/about-downloads.html b/app/extensions/brave/about-downloads.html
index 57ea7387aa2..5b213b1c749 100644
--- a/app/extensions/brave/about-downloads.html
+++ b/app/extensions/brave/about-downloads.html
@@ -10,8 +10,8 @@
-
-
+
+
diff --git a/app/extensions/brave/about-error.html b/app/extensions/brave/about-error.html
index 4d0703ba6db..fe4c3b90522 100644
--- a/app/extensions/brave/about-error.html
+++ b/app/extensions/brave/about-error.html
@@ -10,8 +10,8 @@
-
-
+
+
diff --git a/app/extensions/brave/about-extensions.html b/app/extensions/brave/about-extensions.html
index 57a9604a028..12e410a3792 100644
--- a/app/extensions/brave/about-extensions.html
+++ b/app/extensions/brave/about-extensions.html
@@ -10,8 +10,8 @@
-
-
+
+
diff --git a/app/extensions/brave/about-flash.html b/app/extensions/brave/about-flash.html
index 887223333c2..bc6e4727b49 100644
--- a/app/extensions/brave/about-flash.html
+++ b/app/extensions/brave/about-flash.html
@@ -9,8 +9,8 @@
-
-
+
+
diff --git a/app/extensions/brave/about-history.html b/app/extensions/brave/about-history.html
index 8d7f0069eb3..86a25ba76fb 100644
--- a/app/extensions/brave/about-history.html
+++ b/app/extensions/brave/about-history.html
@@ -10,8 +10,8 @@
-
-
+
+
diff --git a/app/extensions/brave/about-newtab.html b/app/extensions/brave/about-newtab.html
index edd8bd695b2..b16e72c3ecc 100644
--- a/app/extensions/brave/about-newtab.html
+++ b/app/extensions/brave/about-newtab.html
@@ -8,8 +8,8 @@
-
-
+
+
diff --git a/app/extensions/brave/about-passwords.html b/app/extensions/brave/about-passwords.html
index 63c4f5a7912..b9c292d790d 100644
--- a/app/extensions/brave/about-passwords.html
+++ b/app/extensions/brave/about-passwords.html
@@ -10,8 +10,8 @@
-
-
+
+
diff --git a/app/extensions/brave/about-preferences.html b/app/extensions/brave/about-preferences.html
index 64029ae9b40..64b9df91171 100644
--- a/app/extensions/brave/about-preferences.html
+++ b/app/extensions/brave/about-preferences.html
@@ -10,8 +10,8 @@
-
-
+
+
diff --git a/app/extensions/brave/about-safebrowsing.html b/app/extensions/brave/about-safebrowsing.html
index 2a5f958fa7e..be869986839 100644
--- a/app/extensions/brave/about-safebrowsing.html
+++ b/app/extensions/brave/about-safebrowsing.html
@@ -9,8 +9,8 @@
-
-
+
+
diff --git a/app/extensions/brave/about-styles.html b/app/extensions/brave/about-styles.html
index 595f776f1df..1d5c7290e92 100644
--- a/app/extensions/brave/about-styles.html
+++ b/app/extensions/brave/about-styles.html
@@ -10,8 +10,8 @@
-
-
+
+
diff --git a/app/extensions/brave/index-dev.html b/app/extensions/brave/index-dev.html
index c95fea2b8c9..f8ede9f991c 100644
--- a/app/extensions/brave/index-dev.html
+++ b/app/extensions/brave/index-dev.html
@@ -9,8 +9,8 @@
Brave
-
-
+
+
diff --git a/app/extensions/brave/index.html b/app/extensions/brave/index.html
index 654c3153ace..f194be916e6 100644
--- a/app/extensions/brave/index.html
+++ b/app/extensions/brave/index.html
@@ -9,8 +9,8 @@
Brave
+
-
diff --git a/app/extensions/brave/js/about.js b/app/extensions/brave/js/about.js
deleted file mode 100644
index 94543e1991f..00000000000
--- a/app/extensions/brave/js/about.js
+++ /dev/null
@@ -1,63 +0,0 @@
-(function () {
- var queryString = window.location.search
- var portMatch = queryString && queryString.match(/devServerPort=([0-9]+)/)
- var devServerPort
- if (portMatch) {
- devServerPort = portMatch[1]
- }
-
- let aboutEntryPage = 'gen/aboutPages.entry.js'
- if (devServerPort) {
- var baseHref = 'http://localhost:' + devServerPort
- aboutEntryPage = baseHref + '/' + aboutEntryPage
- var baseNode = document.createElement('base')
- baseNode.href = baseHref
- document.getElementsByTagName('head')[0].appendChild(baseNode)
- }
-
- var getFavicon = function(){
- var favicon = undefined;
- var nodeList = document.getElementsByTagName("link");
- for (var i = 0; i < nodeList.length; i++)
- {
- if((nodeList[i].getAttribute("rel") == "icon") || (nodeList[i].getAttribute("rel") == "shortcut icon"))
- {
- favicon = nodeList[i].getAttribute("href");
- }
- }
- return favicon;
- }
-
- // set favicon as a data url because chrome-extension urls don't work correctly
- if (getFavicon()) {
- var img = new Image();
- img.onload = function(){
- var canvas = document.createElement('CANVAS');
- var ctx = canvas.getContext('2d');
- var dataURL;
- canvas.height = this.height;
- canvas.width = this.width;
- ctx.drawImage(this, 0, 0);
- dataURL = canvas.toDataURL();
- var docHead = document.getElementsByTagName('head')[0];
- var newLink = document.createElement('link');
- newLink.rel = 'shortcut icon';
- newLink.href = dataURL;
- docHead.appendChild(newLink);
- canvas = null;
- };
- img.src = 'img/favicon.ico';
- }
- chrome.ipc.on('language', (e, detail) => {
- document.l10n.requestLanguages([detail.langCode])
- document.getElementsByName('availableLanguages')[0].content = detail.languageCodes.join(', ')
- })
- window.addEventListener('load', function () {
- var po = document.createElement('script')
- po.async = true
- po.src = aboutEntryPage
- var s = document.getElementsByTagName('script')[0]
- s.parentNode.insertBefore(po, s)
- chrome.ipc.send('request-language')
- })
-})()
diff --git a/app/filtering.js b/app/filtering.js
index c2a7f074c2e..e494291f9fd 100644
--- a/app/filtering.js
+++ b/app/filtering.js
@@ -60,6 +60,8 @@ const registeredSessions = {}
*/
const permissionCallbacks = {}
+let entryPages = ['gen/app.entry.js', 'gen/webtorrentPage.entry.js', 'gen/aboutPages.entry.js']
+
module.exports.registerBeforeSendHeadersFilteringCB = (filteringFn) => {
beforeSendHeadersFilteringFns.push(filteringFn)
}
@@ -96,16 +98,16 @@ function registerForBeforeRequest (session, partition) {
return
}
- if (appUrlUtil.isTargetAboutUrl(details.url)) {
- if (process.env.NODE_ENV === 'development' && !details.url.match(/devServerPort/)) {
- // add webpack dev server port
- let url = details.url
- let urlComponents = url.split('#')
- urlComponents[0] = urlComponents[0] + '?devServerPort=' + (process.env.BRAVE_PORT || process.env.npm_package_config_port)
- cb({
- redirectURL: urlComponents.join('#')
- })
- return
+ if (process.env.NODE_ENV === 'development') {
+ for (let i = 0; i < entryPages.length; i++) {
+ let page = entryPages[i]
+ if (appUrlUtil.getBraveExtUrl(page) === details.url) {
+ let redirectURL = 'http://localhost:' + (process.env.BRAVE_PORT || process.env.npm_package_config_port) + '/' + page
+ cb({
+ redirectURL
+ })
+ return
+ }
}
}
diff --git a/js/about/entry.js b/js/about/entry.js
index a7eb2fe808c..75c48b73de1 100644
--- a/js/about/entry.js
+++ b/js/about/entry.js
@@ -1,3 +1,34 @@
+var getFavicon = function () {
+ let favicon
+ const nodeList = document.getElementsByTagName('link')
+ for (var i = 0; i < nodeList.length; i++) {
+ if ((nodeList[i].getAttribute('rel') === 'icon') || (nodeList[i].getAttribute('rel') === 'shortcut icon')) {
+ favicon = nodeList[i].getAttribute('href')
+ }
+ }
+ return favicon
+}
+
+// set favicon as a data url because chrome-extension urls don't work correctly
+if (getFavicon()) {
+ let img = new window.Image()
+ img.onload = function () {
+ let canvas = document.createElement('CANVAS')
+ const ctx = canvas.getContext('2d')
+ canvas.height = this.height
+ canvas.width = this.width
+ ctx.drawImage(this, 0, 0)
+ const dataURL = canvas.toDataURL()
+ const docHead = document.getElementsByTagName('head')[0]
+ const newLink = document.createElement('link')
+ newLink.rel = 'shortcut icon'
+ newLink.href = dataURL
+ docHead.appendChild(newLink)
+ canvas = null
+ }
+ img.src = 'img/favicon.ico'
+}
+
const ReactDOM = require('react-dom')
const {getSourceAboutUrl, getBaseUrl} = require('../lib/appUrlUtil')
const {ABOUT_COMPONENT_INITIALIZED} = require('../constants/messages')
@@ -5,6 +36,12 @@ const ipc = window.chrome.ipc
let element
+ipc.on('language', (e, detail) => {
+ document.l10n.requestLanguages([detail.langCode])
+ document.getElementsByName('availableLanguages')[0].content = detail.languageCodes.join(', ')
+})
+ipc.send('request-language')
+
switch (getBaseUrl(getSourceAboutUrl(window.location.href))) {
case 'about:about':
element = require('./about')