gecko-dev/xpcom/threads
Boris Zbarsky 081fa29a04 Bug 1536719. Fix handling of member method calls in the MOZ_CAN_RUN_SCRIPT analysis. r=andi
The old code for member method calls did the following:

 1) Find the member method calls.
 2) Look at their "this" expression.
 3) If the "this" is an operator call, check for any of the arguments of the
    operator call being invalid.
 4) Otherwise (if not an operator call) check for the "this" value being
    invalid.

This wasn't right, because the "is invalid" check checks the type and only
considers refcounted things.  So if the code looked something like
"foo[i]->call_method()", we would look at the types of "foo" and "i" and
determine that none of those are refcounted types so there is nothing invalid
here (since "foo" is some sort of array type and "i" is an integer).  The new
setup just checks whether the "this" value is invalid, which does the type
check on the "this" value itself; in the "foo[i]->call_method()" case on
"foo[i]".  We then adjust the exclusions in InvalidArg to consider operator->
on known-live things valid, to allow the thing that we were really trying to
accomplish with the "check for an operator call" bits:
"stackRefPtr->some_method()".

The test coverage being added for the made-up TArray type is meant to catch
things like the geolocation issue that was being hidden by the buggy behavior.
I'm not using nsTArray itself because some header included by nsTArray.h
tries to define operator new/delete bits inline and that triggers warnings that
then cause a clang-plugin test failure, because they're unexpected.

Differential Revision: https://phabricator.services.mozilla.com/D24117

--HG--
extra : moz-landing-system : lando
2019-03-21 11:48:33 +00:00
..
AbstractEventQueue.h Bug 1524006 - Add a medium-high priority queue between high and normal, r=froydnj 2019-02-28 22:38:53 +02:00
AbstractThread.cpp Bug 1523969 part 27 - Move method definition inline comments to new line in 'xpcom/'. r=froydnj 2019-02-25 16:14:01 -06:00
AbstractThread.h Bug 1529399 Remove unnecessary wrapper runnable from CreateDirectTaskDrainer() for stable state runnables r=padenot 2019-02-25 10:50:19 +00:00
BlockingResourceBase.cpp Bug 1536129 - Fix !MOZ_CALLSTACK_DISABLED blocking resource acquisition checking, r=erahm 2019-03-19 17:12:42 +00:00
BlockingResourceBase.h Bug 1536129 - Fix !MOZ_CALLSTACK_DISABLED blocking resource acquisition checking, r=erahm 2019-03-19 17:12:42 +00:00
components.conf Bug 1478124: Part 8e - Update XPCOM module to use a static component manifest. r=froydnj 2018-12-18 20:28:14 -08:00
CondVar.h Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre 2019-01-18 10:16:18 +01:00
CPUUsageWatcher.cpp Bug 1534878 - xpcom: Make some global functions static. r=erahm 2019-02-24 17:35:59 -08:00
CPUUsageWatcher.h Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre 2019-01-18 10:16:18 +01:00
DataMutex.h Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan 2019-01-21 14:49:22 +00:00
DeadlockDetector.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
EventQueue.cpp Bug 1522150: Rename EventPriority to EventQueuePriority to avoid name conflict with MacOS r=froyd 2019-01-26 12:18:05 -05:00
EventQueue.h Bug 1522150: Rename EventPriority to EventQueuePriority to avoid name conflict with MacOS r=froyd 2019-01-26 12:18:05 -05:00
IdleTaskRunner.cpp Bug 1522150: Add a DeferredTimers queue ahead of the normal Idle EventQueue r=froyd 2019-01-26 12:18:05 -05:00
IdleTaskRunner.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
InputEventStatistics.cpp Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
InputEventStatistics.h Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre 2019-01-18 10:16:18 +01:00
LazyIdleThread.cpp Bug 1522150: Add a DeferredTimers queue ahead of the normal Idle EventQueue r=froyd 2019-01-26 12:18:05 -05:00
LazyIdleThread.h Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre 2019-01-18 10:16:18 +01:00
LeakRefPtr.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
MainThreadIdlePeriod.cpp Bug 1523969 part 27 - Move method definition inline comments to new line in 'xpcom/'. r=froydnj 2019-02-25 16:14:01 -06:00
MainThreadIdlePeriod.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
MainThreadQueue.h Bug 1524006 - Add a medium-high priority queue between high and normal, r=froydnj 2019-02-28 22:38:53 +02:00
MainThreadUtils.h Bug 1490496 - implement XPCOM FFI for key-value storage r=nika,lina,mossop 2019-02-07 16:14:04 +00:00
Monitor.h Bug 1062533 - part 5 - add {Mutex,Monitor}::TryLock methods; r=mccr8 2019-01-09 11:09:24 -04:00
moz.build Bug 1532253 - Add NS_NewURIOnAnyThread r=baku 2019-03-19 15:11:31 +00:00
MozPromise.h Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre 2019-01-18 10:16:18 +01:00
Mutex.h Bug 1062533 - part 5 - add {Mutex,Monitor}::TryLock methods; r=mccr8 2019-01-09 11:09:24 -04:00
nsEnvironment.cpp Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
nsEnvironment.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
nsICancelableRunnable.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
nsIEnvironment.idl
nsIEventTarget.idl
nsIIdlePeriod.idl
nsIIdleRunnable.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
nsINamed.idl
nsIProcess.idl
nsIRunnable.idl Bug 1524006 - Add a medium-high priority queue between high and normal, r=froydnj 2019-02-28 22:38:53 +02:00
nsISerialEventTarget.idl
nsISupportsPriority.idl
nsIThread.idl Bug 1522150: Add a DeferredTimers queue ahead of the normal Idle EventQueue r=froyd 2019-01-26 12:18:05 -05:00
nsIThreadInternal.idl
nsIThreadManager.idl
nsIThreadPool.idl Bug 1535361 - Let stream transport service idle with 5 threads instead of only one to not create/kill threads in quick bursts; add option to thread pool to shorten the idle timeout progressively with number of idle thread to save memory, r=dragana 2019-03-19 14:35:12 +00:00
nsITimer.idl
nsMemoryPressure.cpp Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
nsMemoryPressure.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
nsProcess.h Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre 2019-01-18 10:16:18 +01:00
nsProcessCommon.cpp Bug 1523969 part 27 - Move method definition inline comments to new line in 'xpcom/'. r=froydnj 2019-02-25 16:14:01 -06:00
nsProxyRelease.cpp Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
nsProxyRelease.h Bug 1536719. Fix handling of member method calls in the MOZ_CAN_RUN_SCRIPT analysis. r=andi 2019-03-21 11:48:33 +00:00
nsThread.cpp Bug 1532253 - Add NS_NewURIOnAnyThread r=baku 2019-03-19 15:11:31 +00:00
nsThread.h Bug 1516277 - Add local execution mode to nsThread r=janv,froydnj 2019-03-06 16:26:07 +00:00
nsThreadManager.cpp Bug 1523969 part 27 - Move method definition inline comments to new line in 'xpcom/'. r=froydnj 2019-02-25 16:14:01 -06:00
nsThreadManager.h Bug 1518038 - Add nsIThread.hasPendingHighPriorityEvents, r=froydnj 2019-01-10 19:07:34 +02:00
nsThreadPool.cpp Bug 1535361 - Let stream transport service idle with 5 threads instead of only one to not create/kill threads in quick bursts; add option to thread pool to shorten the idle timeout progressively with number of idle thread to save memory, r=dragana 2019-03-19 14:35:12 +00:00
nsThreadPool.h Bug 1535361 - Let stream transport service idle with 5 threads instead of only one to not create/kill threads in quick bursts; add option to thread pool to shorten the idle timeout progressively with number of idle thread to save memory, r=dragana 2019-03-19 14:35:12 +00:00
nsThreadSyncDispatch.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
nsThreadUtils.cpp Bug 1524006 - Add a medium-high priority queue between high and normal, r=froydnj 2019-02-28 22:38:53 +02:00
nsThreadUtils.h Bug 1524006 - Add a medium-high priority queue between high and normal, r=froydnj 2019-02-28 22:38:53 +02:00
nsTimerImpl.cpp Bug 1534878 - xpcom: Make some global functions static. r=erahm 2019-02-24 17:35:59 -08:00
nsTimerImpl.h Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre 2019-01-18 10:16:18 +01:00
PerformanceCounter.cpp Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre 2019-01-18 10:16:18 +01:00
PerformanceCounter.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
PrioritizedEventQueue.cpp Bug 1524006 - Add a medium-high priority queue between high and normal, r=froydnj 2019-02-28 22:38:53 +02:00
PrioritizedEventQueue.h Bug 1524006 - Add a medium-high priority queue between high and normal, r=froydnj 2019-02-28 22:38:53 +02:00
Queue.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
RecursiveMutex.cpp Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre 2019-01-18 10:16:18 +01:00
RecursiveMutex.h Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre 2019-01-18 10:16:18 +01:00
ReentrantMonitor.h Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre 2019-01-18 10:16:18 +01:00
RWLock.cpp Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre 2019-01-18 10:16:18 +01:00
RWLock.h Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre 2019-01-18 10:16:18 +01:00
SchedulerGroup.cpp Bug 1523969 part 27 - Move method definition inline comments to new line in 'xpcom/'. r=froydnj 2019-02-25 16:14:01 -06:00
SchedulerGroup.h Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan 2019-02-15 08:15:57 +00:00
SharedThreadPool.cpp Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre 2019-01-18 10:16:18 +01:00
SharedThreadPool.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
StateMirroring.h Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre 2019-01-18 10:16:18 +01:00
StateWatching.h Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre 2019-01-18 10:16:18 +01:00
SynchronizedEventQueue.cpp Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
SynchronizedEventQueue.h Bug 1516277 - Add local execution mode to nsThread r=janv,froydnj 2019-03-06 16:26:07 +00:00
SyncRunnable.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
SystemGroup.cpp Bug 1523969 part 27 - Move method definition inline comments to new line in 'xpcom/'. r=froydnj 2019-02-25 16:14:01 -06:00
SystemGroup.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
TaskCategory.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
TaskDispatcher.h Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre 2019-01-18 10:16:18 +01:00
TaskQueue.cpp Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
TaskQueue.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
ThreadBound.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
ThreadDelay.cpp Bug 1534878 - xpcom: #include headers for global functions' declarations. r=erahm 2019-03-07 23:32:54 -08:00
ThreadDelay.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
ThreadEventQueue.cpp Bug 1524006 - Add a medium-high priority queue between high and normal, r=froydnj 2019-02-28 22:38:53 +02:00
ThreadEventQueue.h Bug 1516277 - Add local execution mode to nsThread r=janv,froydnj 2019-03-06 16:26:07 +00:00
ThreadEventTarget.cpp Bug 1522150: Rename EventPriority to EventQueuePriority to avoid name conflict with MacOS r=froyd 2019-01-26 12:18:05 -05:00
ThreadEventTarget.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
ThreadLocalVariables.cpp Bug 1532253 - Add NS_NewURIOnAnyThread r=baku 2019-03-19 15:11:31 +00:00
ThrottledEventQueue.cpp Bug 1522316, use medium high priority queue for worker->main thread control messages, r=baku 2019-03-05 18:47:05 +02:00
ThrottledEventQueue.h Bug 1522316, use medium high priority queue for worker->main thread control messages, r=baku 2019-03-05 18:47:05 +02:00
TimerThread.cpp Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre 2019-01-18 10:16:18 +01:00
TimerThread.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00