mirror of
https://github.com/gorhill/uMatrix.git
synced 2024-06-23 08:30:38 +12:00
minor code review
This commit is contained in:
parent
9afbbae8cf
commit
3d3160efdf
|
@ -1160,12 +1160,11 @@ var httpObserver = {
|
|||
// https://developer.mozilla.org/en-US/Firefox/Multiprocess_Firefox/Limitations_of_chrome_scripts
|
||||
tabIdFromChannel: function(channel) {
|
||||
var aWindow;
|
||||
|
||||
if ( channel.notificationCallbacks ) {
|
||||
try {
|
||||
var loadContext = channel
|
||||
.notificationCallbacks
|
||||
.getInterface(Ci.nsILoadContext);
|
||||
.notificationCallbacks
|
||||
.getInterface(Ci.nsILoadContext);
|
||||
if ( loadContext.topFrameElement ) {
|
||||
return vAPI.tabs.getTabId(loadContext.topFrameElement);
|
||||
}
|
||||
|
|
|
@ -150,6 +150,7 @@ var collapser = (function() {
|
|||
var srcProps = {
|
||||
'img': 'src'
|
||||
};
|
||||
var reURLplaceholder = /\{\{url\}\}/g;
|
||||
|
||||
var PendingRequest = function(target) {
|
||||
this.id = requestId++;
|
||||
|
@ -207,7 +208,9 @@ var collapser = (function() {
|
|||
if ( tagName === 'iframe' ) {
|
||||
target.setAttribute(
|
||||
'src',
|
||||
'data:text/html,' + encodeURIComponent(placeholders.iframe.replace('{{url}}', request.url))
|
||||
'data:text/html,' + encodeURIComponent(
|
||||
placeholders.iframe.replace(reURLplaceholder, request.url)
|
||||
)
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -67,8 +67,13 @@ var defaultLocalUserSettings = {
|
|||
'padding: 2px;',
|
||||
'white-space: nowrap;',
|
||||
'}',
|
||||
'a { ',
|
||||
'color: inherit;',
|
||||
'padding: 0 3px;',
|
||||
'text-decoration: none;',
|
||||
'}',
|
||||
'</style></head><body>',
|
||||
'{{url}}',
|
||||
'<a href="{{url}}" title="{{url}}" target="_blank">↑</a>{{url}}',
|
||||
'</body></html>'
|
||||
].join(''),
|
||||
placeholderImage: 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'
|
||||
|
@ -97,9 +102,9 @@ var onAllDone = function() {
|
|||
if ( defaultLocalUserSettings.hasOwnProperty(key) === false ) {
|
||||
continue;
|
||||
}
|
||||
if ( vAPI.localStorage.getItem(key) === null ) {
|
||||
//if ( vAPI.localStorage.getItem(key) === null ) {
|
||||
vAPI.localStorage.setItem(key, defaultLocalUserSettings[key]);
|
||||
}
|
||||
//}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue