[Pkg-mozext-commits] [tabmixplus] 07/26: Don't insert new code before "use strict";
David Prévot
taffit at moszumanska.debian.org
Fri Mar 25 21:56:15 UTC 2016
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to tag 0.4.2.3pre.160319a1
in repository tabmixplus.
commit ec2a7ffea86c4072da95c68fa0af2fdc9e29d674
Author: onemen <tabmix.onemen at gmail.com>
Date: Sat Mar 12 15:23:16 2016 +0200
Don't insert new code before "use strict";
---
chrome/content/changecode.js | 11 +++++++++++
chrome/content/minit/tabView.js | 4 +---
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/chrome/content/changecode.js b/chrome/content/changecode.js
index 1e671d2..72b7026 100644
--- a/chrome/content/changecode.js
+++ b/chrome/content/changecode.js
@@ -32,6 +32,17 @@ Tabmix.changeCode = function(aParent, afnName, aOptions) {
ChangeCode.prototype = {
value: "", errMsg: "",
_replace: function TMP_utils__replace(substr, newString, aParams) {
+ // Don't insert new code before "use strict";
+ if (substr == "{") {
+ let re = /['|"]use strict['|"];/;
+ let result = re.exec(this.value);
+ if (result) {
+ if (!newString.startsWith("$&")) {
+ newString = newString.replace(substr, result[0] + "\n");
+ }
+ substr = result[0];
+ }
+ }
var silent;
if (typeof aParams != "undefined") {
let doReplace, flags;
diff --git a/chrome/content/minit/tabView.js b/chrome/content/minit/tabView.js
index cffab50..d696e41 100644
--- a/chrome/content/minit/tabView.js
+++ b/chrome/content/minit/tabView.js
@@ -136,7 +136,6 @@
this._original_reconstitute.apply(this, arguments);
};
- let fn = TabView._window.UI._original_reset = TabView._window.UI.reset;
if (window.hasOwnProperty("tabGroups")) {
// reconnect tabs that we disconnected in reconstitute
TabView._window.UI.reset = function() {
@@ -147,9 +146,8 @@
}
// add tab to the new group on tabs order not tabItem order
- let isStrict = (f) => f.toString().indexOf('"use strict";') > -1;
Tabmix.changeCode(TabView._window.UI, "TabView._window.UI.reset")._replace(
- isStrict(fn) ? '"use strict";' : '{',
+ '{',
'$&' +
'let win = TabView._window;' +
'let Trenches = win.Trenches;' +
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/tabmixplus.git
More information about the Pkg-mozext-commits
mailing list