mirror of
https://github.com/gorhill/uBlock.git
synced 2024-10-06 09:37:12 +02:00
Workaround for a messaging bug in Safari
This commit is contained in:
parent
5e99ead9ff
commit
5e587aa42f
@ -35,6 +35,12 @@ var messagingConnector = function(response) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (typeof listener === 'function') {
|
if (typeof listener === 'function') {
|
||||||
|
// Safari bug
|
||||||
|
// Deleting the response.requestId below (only in some cases, probably
|
||||||
|
// when frames are present on the page) will remove it from all the
|
||||||
|
// following messages too, however with the following line it won't
|
||||||
|
vAPI.safari && console.log;
|
||||||
|
|
||||||
delete vAPI.messaging.listeners[response.requestId];
|
delete vAPI.messaging.listeners[response.requestId];
|
||||||
delete response.requestId;
|
delete response.requestId;
|
||||||
listener(response.msg);
|
listener(response.msg);
|
||||||
@ -42,6 +48,7 @@ var messagingConnector = function(response) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (window.chrome) {
|
if (window.chrome) {
|
||||||
|
vAPI.chrome = true;
|
||||||
vAPI.messaging = {
|
vAPI.messaging = {
|
||||||
port: null,
|
port: null,
|
||||||
requestId: 0,
|
requestId: 0,
|
||||||
@ -95,6 +102,8 @@ if (window.chrome) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
} else if (window.safari) {
|
} else if (window.safari) {
|
||||||
|
vAPI.safari = true;
|
||||||
|
|
||||||
// relevant?
|
// relevant?
|
||||||
// https://developer.apple.com/library/safari/documentation/Tools/Conceptual/SafariExtensionGuide/MessagesandProxies/MessagesandProxies.html#//apple_ref/doc/uid/TP40009977-CH14-SW12
|
// https://developer.apple.com/library/safari/documentation/Tools/Conceptual/SafariExtensionGuide/MessagesandProxies/MessagesandProxies.html#//apple_ref/doc/uid/TP40009977-CH14-SW12
|
||||||
vAPI.messaging = {
|
vAPI.messaging = {
|
||||||
|
Loading…
Reference in New Issue
Block a user