Skip to content

Commit

Permalink
Merge pull request #255 from AdguardTeam/feature/issues/202
Browse files Browse the repository at this point in the history
Feature/issues/202
  • Loading branch information
Mizzick committed May 24, 2016
2 parents 012c646 + d01e18e commit b6fe054
Show file tree
Hide file tree
Showing 18 changed files with 163 additions and 90 deletions.
4 changes: 4 additions & 0 deletions Compiler/build.sh
Expand Up @@ -100,6 +100,10 @@ else
#safari
options="--version=$version --branch=$branch --dest=$destPath --name=AdguardDev --browser=safari --extensionId=com.adguard.safaridev"
java -classpath extension-compiler.jar com.adguard.compiler.Main ${options}

#edge
options="--version=$version --branch=$branch --dest=$destPath --name=edge --browser=edge"
java -classpath extension-compiler.jar com.adguard.compiler.Main ${options}

echo "Dev builds created"

Expand Down
5 changes: 5 additions & 0 deletions Compiler/src/main/java/com/adguard/compiler/Browser.java
Expand Up @@ -10,6 +10,11 @@ public enum Browser {
* Chrome-based (Chrome, Opera, YaBrowser)
*/
CHROMIUM("chrome"),

/**
* Microsoft edge
*/
EDGE("edge"),

/**
* Safari
Expand Down
3 changes: 3 additions & 0 deletions Compiler/src/main/java/com/adguard/compiler/FileUtil.java
Expand Up @@ -47,6 +47,9 @@ public static void copyFiles(File source, File dest, Browser browser) throws Exc
case CHROMIUM:
copyChromiumFiles(source, dest);
break;
case EDGE:
copyChromiumFiles(source, dest);
break;
case SAFARI:
copySafariFiles(source, dest);
break;
Expand Down
Expand Up @@ -96,6 +96,7 @@ public static void updateManifestFile(File dest, Browser browser, String version

switch (browser) {
case CHROMIUM:
case EDGE:
File manifestFile = new File(dest, "manifest.json");
String content = FileUtils.readFileToString(manifestFile, "utf-8").trim();
if (updateUrl != null) {
Expand Down
16 changes: 6 additions & 10 deletions Extension/browser/chrome/blockpopup.js
@@ -1,9 +1,3 @@
/* global RequestTypes */
/* global framesMap */
/* global BrowserTab */
/* global chrome */
/* global webRequestService */
/* global UrlUtils */
/**
* This file is part of Adguard Browser Extension (https://github.com/AdguardTeam/AdguardBrowserExtension).
*
Expand All @@ -20,9 +14,11 @@
* You should have received a copy of the GNU Lesser General Public License
* along with Adguard Browser Extension. If not, see <http://www.gnu.org/licenses/>.
*/

/* global browser, framesMap, BrowserTab, UrlUtils, RequestTypes, webRequestService */
var tabsLoading = Object.create(null);

chrome.webNavigation.onCreatedNavigationTarget.addListener(function (details) {
browser.webNavigation.onCreatedNavigationTarget.addListener(function (details) {

var sourceTab = new BrowserTab({id: details.sourceTabId});

Expand All @@ -44,7 +40,7 @@ chrome.webNavigation.onCreatedNavigationTarget.addListener(function (details) {
checkPopupBlockedRule(details.tabId, details.url, referrerUrl, sourceTab);
});

chrome.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) {
browser.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) {

if (!(tabId in tabsLoading)) {
return;
Expand All @@ -71,8 +67,8 @@ function checkPopupBlockedRule(tabId, requestUrl, referrerUrl, sourceTab) {

if (webRequestService.isRequestBlockedByRule(requestRule)) {
//remove popup tab
chrome.tabs.remove(tabId);
browser.tabs.remove(tabId);
//append log event and fix log event type from POPUP to DOCUMENT
webRequestService.postProcessRequest(sourceTab, requestUrl, referrerUrl, RequestTypes.DOCUMENT, requestRule);
}
}
}

0 comments on commit b6fe054

Please sign in to comment.