gecko-dev/xpcom
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
..
base Bug 1536336. Change MOZ_CAN_RUN_SCRIPT analysis to allow const members of "this" in addition to stack refptrs. r=andi 2019-03-21 11:47:22 +00:00
build Bug 1535384 part 5. Eliminate MOZ_CAN_RUN_SCRIPT_BOUNDARY for mutation callbacks. r=mccr8 2019-03-19 15:14:11 +00:00
components Update configs. IGNORE BROKEN CHANGESETS CLOSED TREE NO BUG a=release ba=release 2019-03-18 11:01:13 +00:00
doc
ds Bug 1497299 - Avoid destroying nsHashPropertyBag when recording/replaying, r=mccr8. 2019-03-07 21:46:49 +00:00
glue Bug 1533344 - Stop reading Universal CRT forwarder DLLs ahead on Windows 10. r=froydnj 2019-03-07 22:14:35 +00:00
idl-parser Bug 1533617 part 3. Add a [can_run_script] xpidl annotation. r=nika 2019-03-11 15:16:57 +00:00
io Bug 1375863 - fold MOZ_CONTENT_SANDBOX and MOZ_GMP_SANDBOX into MOZ_SANDBOX; r=jld,firefox-build-system-reviewers 2019-03-18 22:31:59 +00:00
libxpt/xptcall
reflect Bug 1533521 - Avoid modifying the static empty header size field. r=mccr8 2019-03-07 23:09:58 +00:00
rust Bug 1530467 - Add Array<T> support to xpcom rust bindings, r=froydnj 2019-02-26 20:51:19 +00:00
string Bug 1536689 - Make AssertValidDependentString asserts more fatal. r=bholley 2019-03-20 23:13:14 +00:00
system Bug 1535124 part 3. Add MOZ_CAN_RUN_SCRIPT annotations to geolocation code as needed. r=jdm 2019-03-20 18:05:09 +00:00
tests Bug 1534878 - xpcom: Rename NS_InitXPCOM2() to NS_InitXPCOM(). r=froydnj 2019-03-14 23:38:09 -07:00
threads 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
windbgdlg Bug 1528651 - Fix some trivial warnings and re-enable warnings-as-errors on Windows in some directories. r=dmajor 2019-02-19 20:42:11 +09:00
xpidl Bug 1459721 - part 7 - remove dist_idl install manifest; r=chmanchester 2018-05-15 10:05:23 -04:00
moz.build Bug 1489340 - Remove xpcom/typelib r=froydnj 2018-09-07 13:55:38 +00:00
xpcom-config.h.in Bug 1523851 - Remove the dynamic_cast<void*> test. r=froydnj 2019-01-30 14:25:33 +00:00
xpcom-private.h.in