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

Unified Diff: third_party/WebKit/LayoutTests/sensor/resources/sensor-helpers.js

Issue 2353493002: [Sensors] Allow Sensor API only on secure top-level browsing contexts and add frequency checks (Closed)
Patch Set: Comments from Tim Created 4 years, 3 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
Index: third_party/WebKit/LayoutTests/sensor/resources/sensor-helpers.js
diff --git a/third_party/WebKit/LayoutTests/sensor/resources/sensor-helpers.js b/third_party/WebKit/LayoutTests/sensor/resources/sensor-helpers.js
index 6eb0f8d66e8c09e3524722177911fe55abb161f9..34d523c3fc6b0c379c3c2aadc1cedabb66388569 100644
--- a/third_party/WebKit/LayoutTests/sensor/resources/sensor-helpers.js
+++ b/third_party/WebKit/LayoutTests/sensor/resources/sensor-helpers.js
@@ -49,10 +49,6 @@ function sensor_mocks(mojo) {
addConfiguration(configuration) {
assert_not_equals(configuration, null, "Invalid sensor configuration.");
- if (this.add_configuration_called_ != null) {
- this.add_configuration_called_(this);
- }
-
if (!this.start_should_fail_ && this.update_reading_function_ != null) {
let timeout = (1 / configuration.frequency) * 1000;
this.sensor_reading_timer_id_ = window.setTimeout(() => {
@@ -61,10 +57,13 @@ function sensor_mocks(mojo) {
this.client_.sensorReadingChanged();
}
}, timeout);
-
- this.active_sensor_configurations_.push(configuration);
}
+ this.active_sensor_configurations_.push(configuration);
+
+ if (this.add_configuration_called_ != null)
+ this.add_configuration_called_(this);
+
return sensorResponse(!this.start_should_fail_);
}

Powered by Google App Engine
This is Rietveld 408576698