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

Unified Diff: node_modules/vulcanize/node_modules/whacko/node_modules/parse5/lib/jsdom/parsing_unit.js

Issue 800513006: Added vulcanize under third_party/npm_modules (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Created 6 years 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: node_modules/vulcanize/node_modules/whacko/node_modules/parse5/lib/jsdom/parsing_unit.js
diff --git a/node_modules/vulcanize/node_modules/whacko/node_modules/parse5/lib/jsdom/parsing_unit.js b/node_modules/vulcanize/node_modules/whacko/node_modules/parse5/lib/jsdom/parsing_unit.js
new file mode 100644
index 0000000000000000000000000000000000000000..852efa888244892781c2d96aed1982e3c58c9e84
--- /dev/null
+++ b/node_modules/vulcanize/node_modules/whacko/node_modules/parse5/lib/jsdom/parsing_unit.js
@@ -0,0 +1,53 @@
+'use strict';
+
+var ParsingUnit = module.exports = function (parser) {
+ this.parser = parser;
+ this.suspended = false;
+ this.parsingLoopLock = false;
+ this.callback = null;
+};
+
+ParsingUnit.prototype._stateGuard = function (suspend) {
+ if (this.suspended && suspend)
+ throw new Error('parse5: Parser was already suspended. Please, check your control flow logic.');
+
+ else if (!this.suspended && !suspend)
+ throw new Error('parse5: Parser was already resumed. Please, check your control flow logic.');
+
+ return suspend;
+};
+
+ParsingUnit.prototype.suspend = function () {
+ this.suspended = this._stateGuard(true);
+
+ return this;
+};
+
+ParsingUnit.prototype.resume = function () {
+ this.suspended = this._stateGuard(false);
+
+ //NOTE: don't enter parsing loop if it is locked. Without this lock _runParsingLoop() may be called
+ //while parsing loop is still running. E.g. when suspend() and resume() called synchronously.
+ if (!this.parsingLoopLock)
+ this.parser._runParsingLoop();
+
+ return this;
+};
+
+ParsingUnit.prototype.documentWrite = function (html) {
+ this.parser.tokenizer.preprocessor.write(html);
+
+ return this;
+};
+
+ParsingUnit.prototype.handleScripts = function (scriptHandler) {
+ this.parser.scriptHandler = scriptHandler;
+
+ return this;
+};
+
+ParsingUnit.prototype.done = function (callback) {
+ this.callback = callback;
+
+ return this;
+};

Powered by Google App Engine
This is Rietveld 408576698