Skip to content

Instantly share code, notes, and snippets.

@Treora
Treora / background-source.js
Created April 14, 2017 19:53
Returning a Promise of a BlockingRequest object does not work if the Promise object is provided by babel-runtime (Firefox 52.0.2). When using background-source.js instead of background.js in manifest.json redirection of example.org does work fine.
function failingListener() {
return Promise.resolve({
redirectUrl: 'http://mozilla.org'
})
}
function functioningListener() {
return {
redirectUrl: 'http://mozilla.org'
}
@Treora
Treora / background.js
Last active February 6, 2017 20:11
Proof of failure of a PouchDB live changes feed in a WebExtension. Try open this in two tabs (click the browser action button twice), add some items in one, and check if the other receives the changes.
chrome.browserAction.onClicked.addListener(() => {
chrome.tabs.create({url: '/testchanges.html'})
})
@Treora
Treora / TestPublishSubjectMapMany.java
Created June 3, 2013 15:37
These examples show that when subscribing a new observer to a PublishSubject while receiving a value from it, the PublishSubject unpredictably does or does not pass the current value to the new observer. Its behaviour presumably depends on the hashes of the subscriptions in the ConcurrentHashMap it uses. Changing the amount of (unrelated) subscr…
package testpublishsubject;
import rx.Observable;
import rx.observables.ConnectableObservable;
public class TestPublishSubjectMapMany {
private static int subscriptionCounter = 0;
public static void main(String[] args) {