Skip to content

Instantly share code, notes, and snippets.

View ehsan's full-sized avatar

Ehsan Akhgari ehsan

View GitHub Profile
commit 6ede048523fe1ea3db963d04d5daec5df8d6f32b (HEAD -> baku)
Author: Ehsan Akhgari <ehsan@mozilla.com>
Date: Wed Jan 16 19:03:20 2019 -0500
x
diff --git a/devtools/client/responsive.html/browser/tunnel.js b/devtools/client/responsive.html/browser/tunnel.js
index bafd353c2ec14..c71345a7a3514 100644
--- a/devtools/client/responsive.html/browser/tunnel.js
+++ b/devtools/client/responsive.html/browser/tunnel.js
diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp
index 4064be7abc286..0f6e766afc4f9 100644
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -534,6 +534,11 @@ nsresult TabChild::Init(mozIDOMWindowProxy* aParent) {
nsCOMPtr<nsIDocShell> docShell = do_GetInterface(WebNavigation());
MOZ_ASSERT(docShell);
+ nsCOMPtr<nsIWebProgress> webProgress = do_QueryInterface(docShell);
+ webProgress->AddProgressListener(this,
@ehsan
ehsan / text
Last active January 4, 2019 01:10
As Heidegger says “We are too late for the gods and too early for Being.”
We are living in this transitional period...
... not headed to the future we had expected to see.
... cannot return to the past, which has now collapsed.
..The only way to resist is creativity really..
... as it makes room for new things(1)
And opens the mind to the concept of liberty..
_________
$ cat test.cpp
void NS_IMETHODIMP
nsDocShell::FirePageHideNotification(bool aIsUnload) {
}
NS_IMETHODIMP void
nsDocShell::FirePageHideNotification(bool aIsUnload) {
}
$ clang-format -style=Google test.cpp
void NS_IMETHODIMP nsDocShell::FirePageHideNotification(bool aIsUnload) {}
NS_IMETHODIMP void nsDocShell::FirePageHideNotification(bool aIsUnload) {}
$ cat test.cpp
ns_imethodimp
nsDocShell::FirePageHideNotification(bool aIsUnload) {
}
$ clang-format -style=Google test.cpp
ns_imethodimp nsDocShell::FirePageHideNotification(bool aIsUnload) {}
diff --git a/tools/clang-tidy/test/readability-misleading-indentation.cpp b/tools/clang-tidy/test/readability-misleading-indentation.cpp
index bd955026cf100..334904a64dad2 100644
--- a/tools/clang-tidy/test/readability-misleading-indentation.cpp
+++ b/tools/clang-tidy/test/readability-misleading-indentation.cpp
@@ -1,11 +1,9 @@
-void f()
-{
-}
+void f() {}
"{\n \"https://svcs.ebay.com\": [[32768, true, 1]],\n \"https://adservice.google.de\": [[8192, true, 1], [32768, true, 1]],\n \"https://rover.ebay.de\": [[32768, true, 1]],\n \"https://pulsar.ebay.de\": [[32768, true, 1]],\n \"https://gha.ebay.de\": [[32768, true, 1]],\n \"https://tpc.googlesyndication.com\": [[8192, true, 1], [32768, true, 1], [536870912, true, 6]],\n \"https://ocsrest.ebay.de\": [[32768, true, 1]],\n \"https://pagead2.googlesyndication.com\": [[8192, true, 1], [32768, true, 1]],\n \"https://googleads.g.doubleclick.net\": [[8192, true, 1], [32768, true, 1], [536870912, true, 4]],\n \"https://signin.ebay.de\": [[32768, true, 1]],\n \"https://de.ioam.de\": [[8192, true, 1], [32768, true, 1], [536870912, true, 2]],\n \"https://www.ebay.de\": [[32768, true, 1]],\n \"https://www.googletagservices.com\": [[8192, true, 1], [32768, true, 1]],\n \"https://securepubads.g.doubleclick.net\": [[8192, true, 1], [32768, true, 1], [536870912, true, 3]]\n}\n"
@ehsan
ehsan / x.diff
Created November 20, 2018 23:29
diff --git a/browser/base/content/browser-contentblocking.js b/browser/base/content/browser-contentblocking.js
index bf835969e84eb..d7b3a3afba6b2 100644
--- a/browser/base/content/browser-contentblocking.js
+++ b/browser/base/content/browser-contentblocking.js
@@ -474,6 +474,10 @@ var ContentBlocking = {
this.iconBox.removeAttribute("animate");
}
+ if (state & Ci.nsIWebProgressListener.STATE_COOKIES_LOADED) {
+ console.log("Observed a cookie!", gBrowser.currentURI.asciiSpec);
@ehsan
ehsan / x.diff
Created November 20, 2018 14:44
commit 18186d1a9ebfeb1dde7c402503979ebfbc5c636c
Author: Ehsan Akhgari <ehsan@mozilla.com>
Date: Tue Nov 20 09:40:42 2018 -0500
Bug 1508657 - Factor out the code used to parse the argument passed to nsIContentPermissionRequest::Allow(); r=baku
Differential Revision: https://phabricator.services.mozilla.com/D12428
diff --git a/dom/base/nsContentPermissionHelper.cpp b/dom/base/nsContentPermissionHelper.cpp
index f2d366af6af6e..2288ff00fa769 100644
//RefPtr<StorageAccessGrantPromise::Private> p = new StorageAccessGrantPromise::Private(__func__);
auto holder = MakeRefPtr<MozPromiseHolder<StorageAccessGrantPromise>>();
RefPtr<StorageAccessGrantPromise> p = holder->Ensure(__func__);
auto storePermission = [pwin, parentWindow, origin, trackingOrigin, holder = std::move(holder),
trackingURI, topLevelStoragePrincipal, aReason] {
nsIChannel* channel =
pwin->GetCurrentInnerWindow()->GetExtantDoc()->GetChannel();
pwin->NotifyContentBlockingState(blockReason, channel, false, trackingURI);