Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1163)

Unified Diff: breakpad.py

Issue 9145001: Make sure that direct call to SendStack() doesn't send a stack trace for non googler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/breakpad_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: breakpad.py
diff --git a/breakpad.py b/breakpad.py
index afe469c6c5128b3d3a4dce08609bb4c66c49e5f5..2db495483731061cb25113603f4946498fcd1c04 100644
--- a/breakpad.py
+++ b/breakpad.py
@@ -33,6 +33,12 @@ _TIME_STARTED = time.time()
_HOST_NAME = socket.getfqdn()
+# Skip unit tests and we don't want anything from non-googler.
+IS_ENABLED = (
+ not 'test' in getattr(sys.modules['__main__'], '__file__', '') and
+ not 'NO_BREAKPAD' in os.environ and
+ _HOST_NAME.endswith(('.google.com', '.chromium.org')))
+
def post(url, params):
"""HTTP POST with timeout when it's supported."""
@@ -75,6 +81,9 @@ def FormatException(e):
def SendStack(last_tb, stack, url=None, maxlen=50):
"""Sends the stack trace to the breakpad server."""
+ if not IS_ENABLED:
+ # Make sure to not send anything for non googler.
+ return
if not url:
url = DEFAULT_URL + '/breakpad'
print 'Sending crash report ...'
@@ -133,11 +142,7 @@ def Register():
atexit.register(CheckForException)
-# Skip unit tests and we don't want anything from non-googler.
-if (not 'test' in getattr(sys.modules['__main__'], '__file__', '') and
- not 'NO_BREAKPAD' in os.environ and
- (_HOST_NAME.endswith('.google.com') or
- _HOST_NAME.endswith('.chromium.org'))):
+if IS_ENABLED:
Register()
# Uncomment this line if you want to test it out.
« no previous file with comments | « no previous file | tests/breakpad_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698