diff options
author | NateN1222 <nathannichols454@gmail.com> | 2017-10-28 10:38:20 -0500 |
---|---|---|
committer | NateN1222 <nathannichols454@gmail.com> | 2017-10-28 10:38:20 -0500 |
commit | da22a14cd285d6646db7b7d1ce1281689d01159f (patch) | |
tree | f2b14931e983086ea4546ba421e12e25650c87db /bundle.js | |
parent | f9bd00d49a9de977ecbf75b5fda6d0372483b2e2 (diff) |
cleaned up source and added license info
Diffstat (limited to 'bundle.js')
-rw-r--r-- | bundle.js | 43 |
1 files changed, 31 insertions, 12 deletions
@@ -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"); } |