Permalink
Browse files

Initial version based on TACO v2.0. Licensed under the Apache License…

… 2.0.
  • Loading branch information...
0 parents commit 72ae218a1ba1a734255b62c7f3e246b606ce860e @jmhobbs committed Jun 16, 2010
Showing with 430 additions and 0 deletions.
  1. +29 −0 README.md
  2. +2 −0 chrome.manifest
  3. +148 −0 chrome/content/optout.js
  4. +14 −0 chrome/content/optout.xul
  5. BIN chrome/content/taco.png
  6. +211 −0 chrome/content/tacocookies.js
  7. +26 −0 install.rdf
@@ -0,0 +1,29 @@
+# What Is Beef Taco?
+
+[Targeted Advertising Cookie Opt-Out (TACO)](https://addons.mozilla.org/en-US/firefox/addon/11073/) is a Firefox plugin that jumped the shark. In 3.0 they introduced a ton of cruft and crap.
+
+To quote a review:
+
+> Unbelievable how this very good Add-on (TACO 2.0) could fall so deep. The new version (3.0.x) is a nightmare. It's bloated (up to 3MB), slow and has a terrible Preference-dialog (more like a christmas tree).
+>
+> You are well-advised to avoid the new version and go back to 2.0. "Nightly Tester Tools" or/ and "MR Tech Toolkit" will help you to make it compatible. Or do it manual.
+>
+> I'm desperately disappointed.
+
+Beef Taco is a fork of TACO v2.0, before the junk was added in, kept up to date with the most recent Firefox versions.
+
+# License
+
+TACO 2.0 is licensed with the Apache License, 2.0. Thus so are we.
+
+> Licensed under the Apache License, Version 2.0 (the "License");
+> you may not use this file except in compliance with the License.
+> You may obtain a copy of the License at
+>
+> <http://www.apache.org/licenses/LICENSE-2.0>
+>
+> Unless required by applicable law or agreed to in writing, software
+> distributed under the License is distributed on an "AS IS" BASIS,
+> WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+> See the License for the specific language governing permissions and
+> limitations under the License.
@@ -0,0 +1,2 @@
+content optout chrome/content/
+overlay chrome://browser/content/browser.xul chrome://optout/content/optout.xul
@@ -0,0 +1,148 @@
+/*
+ * Targeted Advertising Cookie Opt-Out
+ * Copyright 2009, Christopher Soghoian
+ * www.dubfire.net
+ *
+ *
+ * Based very loosely on the Advertising Cookie Opt-out Plugin.
+ * which was written by vali@google.com (Valentin Gheorghita)
+ * Available here: http://www.google.com/ads/preferences/plugin/
+ * That code is copyright 2009 Google Inc.
+ *
+ * Code since completely rewritten by Daniel Witte @ Mozilla
+ *
+ * Many thanks also to Sid Stamm @ Mozilla, for debugging assistance.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Install all of the opt-out cookies
+ */
+function Taco_OptOut()
+{
+ // Temporarily remove our cookie-changed observer, so we don't
+ // chase our tail
+ var os =
+ Components.classes['@mozilla.org/observer-service;1'].
+ getService(Components.interfaces.nsIObserverService);
+ os.removeObserver(Taco_CookieListener, 'cookie-changed');
+
+ var cm = Components.classes['@mozilla.org/cookiemanager;1'].
+ getService(Components.interfaces.nsICookieManager2);
+
+ const expires = (new Date("Jan 1, 3000")).getTime() / 1000;
+
+ for (var host in taco_opt_out_cookies)
+ {
+ var tacoCookies = taco_opt_out_cookies[host];
+ for each (tacoCookie in tacoCookies) {
+ cm.add(host, // host
+ tacoCookie.path, // path
+ tacoCookie.name, // name
+ tacoCookie.value, // value
+ false, // isSecure
+ false, // isHttpOnly
+ false, // isSession
+ expires);
+ }
+ }
+
+ os.addObserver(Taco_CookieListener, 'cookie-changed', false);
+}
+
+
+/**
+ * Set a single opt-out cookie
+*/
+function Taco_SetCookie(host, tacoCookie)
+{
+ var cm = Components.classes['@mozilla.org/cookiemanager;1'].
+ getService(Components.interfaces.nsICookieManager2);
+
+ const expires = (new Date("Jan 1, 3000")).getTime() / 1000;
+
+ cm.add(host, // host
+ tacoCookie.path, // path
+ tacoCookie.name, // name
+ tacoCookie.value, // value
+ false, // isSecure
+ false, // isHttpOnly
+ false, // isSession
+ expires);
+}
+
+/**
+ * Listener variable for cookie deleted.
+ */
+var Taco_CookieListener =
+{
+ observe: function(subject, topic, data) {
+ if (topic == 'cookie-changed') {
+ if (data == 'cleared') {
+ // entire cookie database cleared - reset everything
+ Taco_OptOut();
+ } else if (data == 'deleted' || data == 'changed') {
+ // single cookie deleted or changed - reset just what we need to
+ var cookie = subject.QueryInterface(Components.interfaces.nsICookie2);
+ var host = cookie.host;
+ var tacoCookies = taco_opt_out_cookies[host];
+ for each (tacoCookie in tacoCookies) {
+ if (tacoCookie.name == cookie.name) {
+ Taco_SetCookie(host, tacoCookie);
+ }
+ }
+ }
+ }
+ }
+};
+
+/**
+ * Load the extension.
+ */
+function Taco_Load() {
+
+ // Make sure we only register a single listener
+ var hiddenWindow =
+ Components.classes["@mozilla.org/appshell/appShellService;1"].
+ getService(Components.interfaces.nsIAppShellService).hiddenDOMWindow;
+ if (hiddenWindow.tacoInitialized) {
+ hiddenWindow.tacoInitialized++;
+ return;
+ }
+ hiddenWindow.tacoInitialized = 1;
+
+ var os =
+ Components.classes['@mozilla.org/observer-service;1'].
+ getService(Components.interfaces.nsIObserverService);
+ os.addObserver(Taco_CookieListener, 'cookie-changed', false);
+
+ Taco_OptOut();
+}
+
+/**
+ * Unload the extension.
+ */
+function Taco_Unload() {
+ var hiddenWindow =
+ Components.classes["@mozilla.org/appshell/appShellService;1"].
+ getService(Components.interfaces.nsIAppShellService).hiddenDOMWindow;
+ hiddenWindow.tacoInitialized--;
+ if (hiddenWindow.tacoInitialized > 0) return;
+
+ var os =
+ Components.classes['@mozilla.org/observer-service;1'].
+ getService(Components.interfaces.nsIObserverService);
+ os.removeObserver(Taco_CookieListener, 'cookie-changed');
+}
+
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<overlay id="optout"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+
+ <script type="application/x-javascript" src="chrome://optout/content/optout.js" />
+ <script type="application/x-javascript" src="chrome://optout/content/tacocookies.js" />
+
+ <window id="main-window">
+ <script type="application/x-javascript">
+ window.addEventListener("load", Taco_Load, false);
+ window.addEventListener("unload", Taco_Unload, false);
+ </script>
+ </window>
+</overlay>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.

0 comments on commit 72ae218

Please sign in to comment.