forked from jsantell/firefox-patches
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1015665-dont-store-calls-callwatcheractor.patch
156 lines (141 loc) · 5.79 KB
/
1015665-dont-store-calls-callwatcheractor.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
From c3ac543f074b39a30f4d1c06b61ff4d60e9866b4 Mon Sep 17 00:00:00 2001
From: Jordan Santell <[email protected]>
Date: Tue, 1 Jul 2014 14:23:36 -0700
Subject: Bug 1015665 - Do not store function calls in CallWatcherActor unless needed. r=vp
diff --git a/browser/devtools/canvasdebugger/test/browser_canvas-actor-test-02.js b/browser/devtools/canvasdebugger/test/browser_canvas-actor-test-02.js
index b7f105e..31c83b4 100644
--- a/browser/devtools/canvasdebugger/test/browser_canvas-actor-test-02.js
+++ b/browser/devtools/canvasdebugger/test/browser_canvas-actor-test-02.js
@@ -9,17 +9,18 @@
function ifTestingSupported() {
let [target, debuggee, front] = yield initCallWatcherBackend(SIMPLE_CANVAS_URL);
let navigated = once(target, "navigate");
yield front.setup({
tracedGlobals: ["CanvasRenderingContext2D", "WebGLRenderingContext"],
startRecording: true,
- performReload: true
+ performReload: true,
+ storeCalls: true
});
ok(true, "The front was setup up successfully.");
yield navigated;
ok(true, "Target automatically navigated when the front was set up.");
// Allow the content to execute some functions.
yield waitForTick();
diff --git a/toolkit/devtools/server/actors/call-watcher.js b/toolkit/devtools/server/actors/call-watcher.js
index 98999c7..04cdbfa 100644
--- a/toolkit/devtools/server/actors/call-watcher.js
+++ b/toolkit/devtools/server/actors/call-watcher.js
@@ -271,26 +271,27 @@ let CallWatcherActor = exports.CallWatcherActor = protocol.ActorClass({
this.finalize();
},
/**
* Starts waiting for the current tab actor's document global to be
* created, in order to instrument the specified objects and become
* aware of everything the content does with them.
*/
- setup: method(function({ tracedGlobals, tracedFunctions, startRecording, performReload, holdWeak }) {
+ setup: method(function({ tracedGlobals, tracedFunctions, startRecording, performReload, holdWeak, storeCalls }) {
if (this._initialized) {
return;
}
this._initialized = true;
this._functionCalls = [];
this._tracedGlobals = tracedGlobals || [];
this._tracedFunctions = tracedFunctions || [];
this._holdWeak = !!holdWeak;
+ this._storeCalls = !!storeCalls;
this._contentObserver = new ContentObserver(this.tabActor);
on(this._contentObserver, "global-created", this._onGlobalCreated);
on(this._contentObserver, "global-destroyed", this._onGlobalDestroyed);
if (startRecording) {
this.resumeRecording();
}
@@ -298,17 +299,18 @@ let CallWatcherActor = exports.CallWatcherActor = protocol.ActorClass({
this.tabActor.window.location.reload();
}
}, {
request: {
tracedGlobals: Option(0, "nullable:array:string"),
tracedFunctions: Option(0, "nullable:array:string"),
startRecording: Option(0, "boolean"),
performReload: Option(0, "boolean"),
- holdWeak: Option(0, "boolean")
+ holdWeak: Option(0, "boolean"),
+ storeCalls: Option(0, "boolean")
},
oneway: true
}),
/**
* Stops listening for document global changes and puts this actor
* to hibernation. This method is called automatically just before the
* actor is destroyed.
@@ -536,17 +538,21 @@ let CallWatcherActor = exports.CallWatcherActor = protocol.ActorClass({
*/
_onContentFunctionCall: function(...details) {
// If the consuming tool has finalized call-watcher, ignore the
// still-instrumented calls.
if (this._finalized) {
return;
}
let functionCall = new FunctionCallActor(this.conn, details, this._holdWeak);
- this._functionCalls.push(functionCall);
+
+ if (this._storeCalls) {
+ this._functionCalls.push(functionCall);
+ }
+
this.onCall(functionCall);
}
});
/**
* The corresponding Front object for the CallWatcherActor.
*/
let CallWatcherFront = exports.CallWatcherFront = protocol.FrontClass(CallWatcherActor, {
diff --git a/toolkit/devtools/server/actors/canvas.js b/toolkit/devtools/server/actors/canvas.js
index 991e22e..79d8523 100644
--- a/toolkit/devtools/server/actors/canvas.js
+++ b/toolkit/devtools/server/actors/canvas.js
@@ -251,17 +251,18 @@ let CanvasActor = exports.CanvasActor = protocol.ActorClass({
}
this._initialized = true;
this._callWatcher = new CallWatcherActor(this.conn, this.tabActor);
this._callWatcher.onCall = this._onContentFunctionCall;
this._callWatcher.setup({
tracedGlobals: CANVAS_CONTEXTS,
tracedFunctions: ANIMATION_GENERATORS,
- performReload: reload
+ performReload: reload,
+ storeCalls: true
});
}, {
request: { reload: Option(0, "boolean") },
oneway: true
}),
/**
* Stops listening for function calls.
diff --git a/toolkit/devtools/server/actors/webaudio.js b/toolkit/devtools/server/actors/webaudio.js
index c7432ee..e882cc6 100644
--- a/toolkit/devtools/server/actors/webaudio.js
+++ b/toolkit/devtools/server/actors/webaudio.js
@@ -325,17 +325,18 @@ let WebAudioActor = exports.WebAudioActor = protocol.ActorClass({
this._initialized = true;
this._callWatcher = new CallWatcherActor(this.conn, this.tabActor);
this._callWatcher.onCall = this._onContentFunctionCall;
this._callWatcher.setup({
tracedGlobals: AUDIO_GLOBALS,
startRecording: true,
performReload: reload,
- holdWeak: true
+ holdWeak: true,
+ storeCalls: false
});
// Bind to the `global-destroyed` event on the content observer so we can
// unbind events between the global destruction and the `finalize` cleanup
// method on the actor.
// TODO expose these events on CallWatcherActor itself, bug 1021321
on(this._callWatcher._contentObserver, "global-destroyed", this._onGlobalDestroyed);
}, {
request: { reload: Option(0, "boolean") },
--
1.8.4.2