Skip to content

Commit

Permalink
Merge tag '1.11.1b0' into safari
Browse files Browse the repository at this point in the history
  • Loading branch information
el1t committed Feb 6, 2017
2 parents 7f613b6 + 48b3ba1 commit 93e07f2
Show file tree
Hide file tree
Showing 11 changed files with 87 additions and 34 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -8,6 +8,7 @@ env:
script: ./tools/make-${BROWSER}.sh all
deploy:
provider: releases
prerelease: true
# https://github.com/travis-ci/travis-ci/issues/6772
edge:
branch: releases-fix
Expand Down
2 changes: 1 addition & 1 deletion platform/chromium/manifest.json
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,

"name": "uBlock Origin",
"version": "1.10.7.103",
"version": "1.11.1.0",

"default_locale": "en",
"description": "__MSG_extShortDesc__",
Expand Down
4 changes: 2 additions & 2 deletions platform/firefox/install.rdf
Expand Up @@ -39,7 +39,7 @@
<r:Description>
<id>{{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}}</id>
<minVersion>2.21</minVersion>
<maxVersion>2.40.*</maxVersion>
<maxVersion>*</maxVersion>
</r:Description>
</targetApplication>

Expand All @@ -48,7 +48,7 @@
<r:Description>
<id>{{8de7fcbb-c55c-4fbe-bfc5-fc555c87dbc4}}</id>
<minVersion>25.0</minVersion>
<maxVersion>26.*</maxVersion>
<maxVersion>27.*</maxVersion>
</r:Description>
</targetApplication>

Expand Down
10 changes: 5 additions & 5 deletions src/_locales/fy/messages.json
Expand Up @@ -40,7 +40,7 @@
"description":"appears as tab name in dashboard"
},
"advancedSettingsPageName":{
"message":"Advanced settings",
"message":"Avansearre ynstellingen",
"description":"Title for the advanced settings page"
},
"popupPowerSwitchInfo":{
Expand Down Expand Up @@ -212,7 +212,7 @@
"description":""
},
"settingsAdvancedUserSettings":{
"message":"advanced settings",
"message":"avansearre ynstellingen",
"description":"For the tooltip of a link which gives access to advanced settings"
},
"settingsPrefetchingDisabledPrompt":{
Expand Down Expand Up @@ -424,7 +424,7 @@
"description":"English: dynamic rule syntax and full documentation."
},
"whitelistPrompt":{
"message":"Jo list fan hostnammen wêrop uBlockútskeakele is. Ien per rigel ynjaan. Unjildige hostnammen wurde stil negearre.",
"message":"De whitelist-ynstruksjes skriuwe foar op hokker websiden uBlock Origin útskeakele wurde moat. Ien fermelding per rigel. Unjildige ynstruksjes wurde sûnder meidieling negearre en útskeakele.",
"description":"English: An overview of the content of the dashboard's Whitelist pane."
},
"whitelistImport":{
Expand Down Expand Up @@ -680,15 +680,15 @@
"description":"used as a prompt for the user to provide a custom device name"
},
"advancedSettingsWarning":{
"message":"Warning! Change these advanced settings at your own risk.",
"message":"Warskôging! Wizigje dizze avansearre ynstellingen op eigen risiko.",
"description":"A warning to users at the top of 'Advanced settings' page"
},
"genericSubmit":{
"message":"Ferstjoere",
"description":"for generic 'Submit' buttons"
},
"genericApplyChanges":{
"message":"Apply changes",
"message":"Wizigingen tapasse",
"description":"for generic 'Apply changes' buttons"
},
"genericRevert":{
Expand Down
2 changes: 1 addition & 1 deletion src/_locales/it/messages.json
Expand Up @@ -680,7 +680,7 @@
"description":"used as a prompt for the user to provide a custom device name"
},
"advancedSettingsWarning":{
"message":"Attenzione! Cambia queste impostazioni avanzate a tuo rischio e pericolo.",
"message":"Attenzione! Modifica queste impostazioni avanzate a tuo rischio e pericolo.",
"description":"A warning to users at the top of 'Advanced settings' page"
},
"genericSubmit":{
Expand Down
6 changes: 3 additions & 3 deletions src/_locales/pt_BR/messages.json
Expand Up @@ -8,7 +8,7 @@
"description":"this will be in the chrome web store: must be 132 characters or less"
},
"dashboardName":{
"message":"uBlock₀ — Painel",
"message":"uBlock₀ — Painel de controle",
"description":"English: uBlock₀ — Dashboard"
},
"settingsPageName":{
Expand Down Expand Up @@ -200,7 +200,7 @@
"description":"English: Make use of context menu where appropriate"
},
"settingsColorBlindPrompt":{
"message":"Cores amigáveis para daltônicos",
"message":"Modo Daltonismo",
"description":"English: Color-blind friendly"
},
"settingsCloudStorageEnabledPrompt":{
Expand Down Expand Up @@ -612,7 +612,7 @@
"description":"English: {{value}} days ago"
},
"showDashboardButton":{
"message":"Mostrar Painel",
"message":"Mostrar Painel de Controle",
"description":"Firefox\/Fennec-specific: Show Dashboard"
},
"showNetworkLogButton":{
Expand Down
6 changes: 3 additions & 3 deletions src/_locales/uk/messages.json
Expand Up @@ -84,7 +84,7 @@
"description":"Tooltip for the no-popups per-site switch"
},
"popupTipNoLargeMedia":{
"message":"Перемкнути блокування великих медіа елементів на цьому сайті",
"message":"Увімк\/Вимк блокування великих медіа елементів на цьому сайті",
"description":"Tooltip for the no-large-media per-site switch"
},
"popupTipNoCosmeticFiltering":{
Expand Down Expand Up @@ -292,7 +292,7 @@
"description":"This will cause uBO to ignore all generic cosmetic filters."
},
"3pIgnoreGenericCosmeticFiltersInfo":{
"message":"<p>Загальні косметичні фільтри — це косметичні фільтри, які повинні застосовуватися до всіх веб-сторінок.<p>Хоча uBlock і звертається з ними ефективно, вони все одно можуть вимагати значну кількість ресурсів на деяких, особливо великих, сторінках.<p>Увімкнення цього параметра знизить споживання ресурсів таких сторінок від застосування загальних косметичних фільтрів, а також знизить споживання пам'яті самого uBlock.<p>Рекомендується увімкнути цей параметр на слабких пристроях.",
"message":"<p>Загальні косметичні фільтри — це косметичні фільтри, які застосовуються до всіх веб-сторінок.<p>Хоча й uBlock обробує фільтри ефективно, вони все одно можуть вимагати значну кількість ресурсів на деяких, особливо навантаженних сторінках.<p>Увімкнення цього параметра знизить споживання ресурсів на таких сторінках від застосування загальних косметичних фільтрів, а також знизить споживання пам'яті самого uBlock.<p>Рекомендується увімкнути цей параметр на слабких пристроях.",
"description":"Describes the purpose of the 'Ignore generic cosmetic filters' feature."
},
"3pListsOfBlockedHostsHeader":{
Expand Down Expand Up @@ -424,7 +424,7 @@
"description":"English: dynamic rule syntax and full documentation."
},
"whitelistPrompt":{
"message":"Список тих доменів, для яких µBlock буде вимикатись. Один запис на рядок. Недопустимі назви будуть ігноруватись.",
"message":"Ваш список адрес сайтів, для яких µBlock буде неактивним. Додайте по одному запису на рядок. Невірні адреси будуть проігноровані без зауважень.",
"description":"English: An overview of the content of the dashboard's Whitelist pane."
},
"whitelistImport":{
Expand Down
2 changes: 1 addition & 1 deletion src/_locales/zh_CN/messages.json
Expand Up @@ -224,7 +224,7 @@
"description":"English: "
},
"settingsWebRTCIPAddressHiddenPrompt":{
"message":"防止 WebRTC 泄露本地IP地址",
"message":"避免 WebRTC 泄露本地IP地址",
"description":"English: "
},
"settingPerSiteSwitchGroup":{
Expand Down
16 changes: 12 additions & 4 deletions src/js/messaging.js
Expand Up @@ -793,6 +793,10 @@ var backupUserData = function(callback) {
var restoreUserData = function(request) {
var userData = request.userData;

var restart = function() {
vAPI.app.restart();
};

var onAllRemoved = function() {
µBlock.saveLocalSettings();
vAPI.storage.set(userData.userSettings);
Expand All @@ -811,13 +815,17 @@ var restoreUserData = function(request) {

// 'filterLists' is available up to uBO v1.10.4, not beyond.
// 'selectedFilterLists' is available from uBO v1.11 and beyond.
var listKeys;
if ( Array.isArray(userData.selectedFilterLists) ) {
µb.saveSelectedFilterLists(userData.selectedFilterLists);
listKeys = userData.selectedFilterLists;
} else if ( userData.filterLists instanceof Object ) {
µb.saveSelectedFilterLists(µb.newListKeysFromOldData(userData.filterLists));
listKeys = µb.newListKeysFromOldData(userData.filterLists);
}
if ( listKeys !== undefined ) {
µb.saveSelectedFilterLists(listKeys, restart);
} else {
restart();
}

vAPI.app.restart();
};

// https://github.com/chrisaljoudi/uBlock/issues/1102
Expand Down
10 changes: 7 additions & 3 deletions src/js/storage.js
Expand Up @@ -196,7 +196,11 @@
});
};

µBlock.saveSelectedFilterLists = function(newKeys, append) {
µBlock.saveSelectedFilterLists = function(newKeys, append, callback) {
if ( typeof append === 'function' ) {
callback = append;
append = false;
}
var oldKeys = this.selectedFilterLists.slice();
if ( append ) {
newKeys = newKeys.concat(oldKeys);
Expand All @@ -214,7 +218,7 @@
remoteBlacklists: this.oldDataFromNewListKeys(newKeys)
};
this.selectedFilterLists = newKeys;
vAPI.storage.set(bin);
vAPI.storage.set(bin, callback);
};

// TODO(seamless migration):
Expand Down Expand Up @@ -1117,7 +1121,7 @@
this.loadFilterLists();
}
if ( this.userSettings.autoUpdate ) {
this.scheduleAssetUpdater(this.hiddenSettings.assetAutoUpdatePeriod * 3600000 || 25200000);
this.scheduleAssetUpdater(this.hiddenSettings.autoUpdatePeriod * 3600000 || 25200000);
} else {
this.scheduleAssetUpdater(0);
}
Expand Down
62 changes: 51 additions & 11 deletions src/js/traffic.js
Expand Up @@ -443,17 +443,22 @@ var processCSP = function(pageStore, details) {
blockInlineScript = µb.isBlockResult(inlineScriptResult);
}

context.requestType = 'websocket';
µb.staticNetFilteringEngine.matchStringExactType(context, requestURL, 'websocket');
var websocketResult = µb.staticNetFilteringEngine.toResultString(loggerEnabled),
blockWebsocket = µb.isBlockResult(websocketResult);

// https://github.com/gorhill/uBlock/issues/2360
µb.staticNetFilteringEngine.matchStringExactType(context, 'blob:', 'script');
var workerResult = µb.staticNetFilteringEngine.toResultString(loggerEnabled),
blockWorker = µb.isBlockResult(workerResult);

var headersChanged;
if ( blockInlineScript || blockWebsocket ) {
if ( blockInlineScript || blockWebsocket || blockWorker ) {
headersChanged = foilWithCSP(
details.responseHeaders,
blockInlineScript,
blockWebsocket
blockWebsocket,
blockWorker
);
}

Expand All @@ -480,6 +485,17 @@ var processCSP = function(pageStore, details) {
context.pageHostname
);
}
if ( workerResult !== '' ) {
µb.logger.writeOne(
tabId,
'net',
workerResult,
'worker',
requestURL,
context.rootHostname,
context.pageHostname
);
}
}

context.dispose();
Expand Down Expand Up @@ -524,26 +540,38 @@ var foilLargeMediaElement = function(pageStore, details) {

/******************************************************************************/

var foilWithCSP = function(headers, noInlineScript, noWebsocket) {
var i = headerIndexFromName('content-security-policy', headers),
var foilWithCSP = function(headers, noInlineScript, noWebsocket, noWorker) {
var me = foilWithCSP,
i = headerIndexFromName('content-security-policy', headers),
before = i === -1 ? '' : headers[i].value.trim(),
after = before;

if ( noInlineScript ) {
after = foilWithCSPDirective(
after,
/script-src[^;]*;?\s*/,
me.reScriptSrc,
"script-src 'unsafe-eval' *",
/'unsafe-inline'\s*|'nonce-[^']+'\s*/g
me.reScriptSrcRemove
);
}

if ( noWebsocket ) {
after = foilWithCSPDirective(
after,
/connect-src[^;]*;?\s*/,
me.reConnectSrc,
'connect-src http:',
/wss?:[^\s]*\s*/g
me.reConnectSrcRemove
);
}

// https://www.w3.org/TR/CSP2/#directive-child-src
// https://www.w3.org/TR/CSP3/#directive-worker-src
if ( noWorker ) {
after = foilWithCSPDirective(
after,
me.reWorkerSrc,
'child-src http:',
me.reWorkerSrcRemove
);
}

Expand All @@ -556,9 +584,9 @@ var foilWithCSP = function(headers, noInlineScript, noWebsocket) {
// https://w3c.github.io/webappsec-csp/#directive-frame-src
after = foilWithCSPDirective(
after,
/frame-src[^;]*;?\s*/,
me.reFrameSrc,
'frame-src http:',
/data:[^\s]*\s*|blob:[^\s]*\s*/g
me.reFrameSrcRemove
);
}

Expand All @@ -573,6 +601,18 @@ var foilWithCSP = function(headers, noInlineScript, noWebsocket) {
return changed;
};

(function() {
var fn = foilWithCSP;
fn.reScriptSrc = /script-src[^;]*;?\s*/;
fn.reScriptSrcRemove = /'unsafe-inline'\s*|'nonce-[^']+'\s*/g;
fn.reConnectSrc = /connect-src[^;]*;?\s*/;
fn.reConnectSrcRemove = /wss?:[^\s]*\s*/g;
fn.reWorkerSrc = /child-src[^;]*;?\s*/;
fn.reWorkerSrcRemove = /blob:[^\s]*\s*/g;
fn.reFrameSrc = /frame-src[^;]*;?\s*/;
fn.reFrameSrcRemove = /data:[^\s]*\s*|blob:[^\s]*\s*/g;
})();

/******************************************************************************/

// Past issues to keep in mind:
Expand Down

0 comments on commit 93e07f2

Please sign in to comment.