libdot: improve handling of escapes with string embedding

The current logic does not take into account any embedded escapes which
can easily break things.  For example, it might turn '...\x1b[...' into:
  '...\x1' +
  'b[...' +
Which is invalid in JavaScript.

Change the logic to not wrap lines at all if it has an embedded escape
sequence, and delay the single quote escaping until after we break up
the line.  This latter part might make the line "too" long, but since
we're already admitting "best effort" here for style, it's not that big
of a deal.

Also document that we strip out newlines.  This isn't new behavior, it
just wasn't explicitly documented previously.

Finally while we're here, clean up the end of the string a bit so we
don't have to end every embedded resource with a dummy ''.

Change-Id: I80450959188573d0a608298982cb42b5caf34341
Reviewed-on: https://chromium-review.googlesource.com/889938
Reviewed-by: Brandon Gilmore <varz@google.com>
Tested-by: Mike Frysinger <vapier@chromium.org>
1 file changed
tree: 6167902b7e3230492ac7a51ebc92c5c88daa979d
  1. .clang-format
  2. .eslintrc.js
  3. .gitignore
  4. HACK.md
  5. LICENSE
  6. README.md
  7. hterm/
  8. libdot/
  9. nassh/
  10. package.json
  11. saltpig/
  12. ssh_client/
  13. wam/
  14. wash/
README.md

Hello

This repository contains the libdot JavaScript library and some web applications that make use of it.

The official copy of this repository is hosted at https://chromium.googlesource.com/apps/libapps.

There is also a mirror on github at https://github.com/libapps/libapps-mirror. A few subprojects are also extracted out into their own git repo and mirrored. Keep in mind that these mirrors may occasionally be behind the official repository.

All changes must go through the Gerrit code review server on https://chromium-review.googlesource.com. Github pull requests cannot be accepted. Please see the HACK.md document in this directory for the details.

Top level directories

  • libdot/ is a small set of JS libraries initially developed as part of hterm, now available as shared code.

  • hterm/ is a JS library that provides a terminal emulator. It is reasonably fast, reasonably correct, and reasonably portable across browsers.

  • nassh/ is the Secure Shell Chrome App (currently a “v1.5” app, soon to become a “v2” or platform app) that combines hterm with a NaCl build of OpenSSH to provide a PuTTY-like app for Chrome users.

  • ssh_client/ is the NaCl port of OpenSSH. It is used by nassh to create the Secure Shell App.

  • wash/ is a library for cross-origin virtual filesystems, similar to the Plan 9 filesystem. This directory also contains a simple bash-like shell environment for exploring these filesystems. The code in this directory is a work-in-progress.