aboutsummaryrefslogtreecommitdiff
path: root/bundle.js
diff options
context:
space:
mode:
Diffstat (limited to 'bundle.js')
-rw-r--r--bundle.js43
1 files changed, 31 insertions, 12 deletions
diff --git a/bundle.js b/bundle.js
index bf85765..721ec51 100644
--- a/bundle.js
+++ b/bundle.js
@@ -1,4 +1,24 @@
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
+/**
+* GNU LibreJS - A browser add-on to block nonfree nontrivial JavaScript.
+* *
+* Copyright (C) 2017 Nathan Nichols
+*
+* This file is part of GNU LibreJS.
+*
+* GNU LibreJS is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* GNU LibreJS is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with GNU LibreJS. If not, see <http://www.gnu.org/licenses/>.
+*/
var acorn_base = require("acorn");
var acorn = require('acorn/dist/acorn_loose');
@@ -1570,7 +1590,7 @@ var fname_data = {
"NodeList": true,
"StopIteration": true
};
-//************************Comes from HTML file index.html's script test.js****************************
+//************************this part can be tested in the HTML file index.html's script test.js****************************
function full_evaluate(script){
var res = true;
@@ -1654,6 +1674,9 @@ function full_evaluate(script){
}
}
}
+ }else if(toke.value !== undefined && operators[toke.value] !== undefined){
+ // It's just an operator. Javascript doesn't have operator overloading so it must be some
+ // kind of primitive (I.e. a number)
}else if(toke.value !== undefined){
var status = fname_data[toke.value];
if(status === true){ // is the identifier banned?
@@ -1663,13 +1686,11 @@ function full_evaluate(script){
}
}else if(status === false){// is the identifier not banned?
// Is there bracket suffix notation?
- if(operators[toke.value] === undefined){
- if(is_bsn(toke.end)){
- dbg_print("%c NONTRIVIAL: Bracket suffix notation on variable '"+toke.value+"'","color:red");
- if(DEBUG == false){
- return [false,"%c NONTRIVIAL: Bracket suffix notation on variable '"+toke.value+"'"];
- }
- }
+ if(is_bsn(toke.end)){
+ dbg_print("%c NONTRIVIAL: Bracket suffix notation on variable '"+toke.value+"'","color:red");
+ if(DEBUG == false){
+ return [false,"%c NONTRIVIAL: Bracket suffix notation on variable '"+toke.value+"'"];
+ }
}
}else if(status === undefined){// is the identifier user defined?
// Are arguments being passed to a user defined variable?
@@ -1696,8 +1717,6 @@ function full_evaluate(script){
}catch(e){
dbg_print("Denied script because it cannot be parsed.");
return [false,"NONTRIVIAL: Cannot be parsed."];
- console.warn("Continuing evaluation");
- error_count++;
}
}
@@ -1950,7 +1969,7 @@ function read_script(a){
var filter = webex.webRequest.filterResponseData(a.requestId);
var decoder = new TextDecoder("utf-8");
- var encoder = new TextEncoder(); // TODO: make sure this doesn't cause undeclared decoding
+ var encoder = new TextEncoder();
filter.ondata = event => {
var str = decoder.decode(event.data, {stream: true});
@@ -2079,7 +2098,7 @@ function read_document(a){
var str = "";
var filter = webex.webRequest.filterResponseData(a.requestId);
var decoder = new TextDecoder("utf-8");
- var encoder = new TextEncoder(); // TODO: make sure this doesn't cause undeclared decoding
+ var encoder = new TextEncoder();
filter.onerror = event => {
dbg_print("%c Error in getting document","color:red");
}