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

Unified Diff: Source/devtools/front_end/emulation/OverridesSupport.js

Issue 1313793005: Fixes a bug where touch device scripts were not cleared on exit of device mode in devtools. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Simplified logic for adding/removing touch emulation scripts for device mode. Created 5 years, 4 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/emulation/OverridesSupport.js
diff --git a/Source/devtools/front_end/emulation/OverridesSupport.js b/Source/devtools/front_end/emulation/OverridesSupport.js
index ddfd646967b9c4d1f89d1a6a420b8df30ee30eac..6ef155147b4b82de30e9320af28459c2405b996a 100644
--- a/Source/devtools/front_end/emulation/OverridesSupport.js
+++ b/Source/devtools/front_end/emulation/OverridesSupport.js
@@ -705,20 +705,18 @@ WebInspector.OverridesSupport.prototype = {
Object.defineProperty(recepients[j], touchEvents[i], { value: null, writable: true, configurable: true, enumerable: true });
}
}
- }
+ };
var symbol = WebInspector.OverridesSupport._touchEventsScriptIdSymbol;
- if (emulationEnabled && target[symbol] !== -1) {
- target[symbol] = -1;
- target.pageAgent().addScriptToEvaluateOnLoad("(" + injectedFunction.toString() + ")()", scriptAddedCallback);
- } else {
- if (typeof target[symbol] !== "undefined") {
- target.pageAgent().removeScriptToEvaluateOnLoad(target[symbol]);
- delete target[symbol];
- }
+ if (typeof target[symbol] !== "undefined") {
+ target.pageAgent().removeScriptToEvaluateOnLoad(target[symbol]);
+ delete target[symbol];
}
+ if (emulationEnabled)
+ target.pageAgent().addScriptToEvaluateOnLoad("(" + injectedFunction.toString() + ")()", scriptAddedCallback);
+
/**
* @param {?Protocol.Error} error
* @param {string} scriptId
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698