diff --git a/.gitignore b/.gitignore
index 116124d..10a0191 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1 @@
-SOURCES/Rhino1_7R4_RELEASE.zip
+SOURCES/Rhino1_7R5_RELEASE.zip
diff --git a/.rhino.metadata b/.rhino.metadata
index e32562b..561bd8f 100644
--- a/.rhino.metadata
+++ b/.rhino.metadata
@@ -1 +1 @@
-f210e0a5868c1bbff1a19c8f83ca62dd439fff4e SOURCES/Rhino1_7R4_RELEASE.zip
+55904bc4d58af852f7ae59c25e6e587fc87cadb3 SOURCES/Rhino1_7R5_RELEASE.zip
diff --git a/SOURCES/rhino-1.7R3-crosslink.patch b/SOURCES/rhino-1.7R3-crosslink.patch
index 428632b..bc920eb 100644
--- a/SOURCES/rhino-1.7R3-crosslink.patch
+++ b/SOURCES/rhino-1.7R3-crosslink.patch
@@ -7,5 +7,5 @@ diff -up rhino1_7R3/build.xml~ rhino1_7R3/build.xml
               author="true"
 +             link="/usr/share/javadoc/java"
               windowtitle="${Name}" />
+     <zip destfile="${dist.dir}/javadoc.zip" basedir="${dist.dir}/javadoc"/>
    </target>
- 
diff --git a/SOURCES/rhino-1.7R4.pom b/SOURCES/rhino-1.7R4.pom
deleted file mode 100644
index c7ec588..0000000
--- a/SOURCES/rhino-1.7R4.pom
+++ /dev/null
@@ -1,34 +0,0 @@
-<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.mozilla</groupId>
-  <artifactId>rhino</artifactId>
-  <name>Mozilla Rhino</name>
-  <version>1.7R4</version>
-  <packaging>jar</packaging>
-  <description>Rhino is an open-source implementation of JavaScript written entirely in Java. It is typically embedded into Java applications to provide scripting to end users.</description>
-  <url>https://developer.mozilla.org/en/Rhino</url>
-
-  <licenses>
-    <license>
-      <name>Mozilla Public License, Version 2.0</name>
-      <url>http://www.mozilla.org/MPL/2.0/index.txt</url>
-    </license>
-  </licenses>
-
-  <parent>
-    <groupId>org.sonatype.oss</groupId>
-    <artifactId>oss-parent</artifactId>
-    <version>7</version>
-  </parent>
-
-  <scm>
-    <connection>scm:git:git@github.com:mozilla/rhino.git</connection>
-    <developerConnection>scm:git:git@github.com:mozilla/rhino.git</developerConnection>
-    <url>git@github.com:mozilla/rhino.git</url>
-  </scm>
-
-  <organization>
-    <name>The Mozilla Foundation</name>
-    <url>http://www.mozilla.org</url>
-  </organization>
-</project>
diff --git a/SOURCES/rhino-1.7R5.pom b/SOURCES/rhino-1.7R5.pom
new file mode 100644
index 0000000..d173bfd
--- /dev/null
+++ b/SOURCES/rhino-1.7R5.pom
@@ -0,0 +1,39 @@
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.sonatype.oss</groupId>
+    <artifactId>oss-parent</artifactId>
+    <version>7</version>
+  </parent>
+
+  <groupId>org.mozilla</groupId>
+  <artifactId>rhino</artifactId>
+  <name>Mozilla Rhino</name>
+  <version>1.7R5</version>
+
+  <packaging>jar</packaging>
+  <description>
+      Rhino is an open-source implementation of JavaScript written entirely in Java. It is typically
+      embedded into Java applications to provide scripting to end users.
+  </description>
+  <url>https://developer.mozilla.org/en/Rhino</url>
+
+  <licenses>
+    <license>
+      <name>Mozilla Public License, Version 2.0</name>
+      <url>http://www.mozilla.org/MPL/2.0/index.txt</url>
+    </license>
+  </licenses>
+
+  <scm>
+    <connection>scm:git:git@github.com:mozilla/rhino.git</connection>
+    <developerConnection>scm:git:git@github.com:mozilla/rhino.git</developerConnection>
+    <url>git@github.com:mozilla/rhino.git</url>
+  </scm>
+
+  <organization>
+    <name>The Mozilla Foundation</name>
+    <url>http://www.mozilla.org</url>
+  </organization>
+</project>
\ No newline at end of file
diff --git a/SOURCES/rhino-addOrbitManifest.patch b/SOURCES/rhino-addOrbitManifest.patch
index 0179c29..c9def89 100644
--- a/SOURCES/rhino-addOrbitManifest.patch
+++ b/SOURCES/rhino-addOrbitManifest.patch
@@ -4,10 +4,10 @@ diff -up rhino1_7R3/src/manifest.fixManifest rhino1_7R3/src/manifest
 @@ -1,6 +1,31 @@
  Manifest-Version: 1.0
  Main-Class: org.mozilla.javascript.tools.shell.Main
--Implementation-Version: 1.7R4
--Implementation-Title: Mozilla Rhino 1.7R4
-+Implementation-Version: 1.7R4
-+Implementation-Title: Mozilla Rhino 1.7R4
+-Implementation-Version: 1.7R5
+-Implementation-Title: Mozilla Rhino 1.7R5
++Implementation-Version: 1.7R5
++Implementation-Title: Mozilla Rhino 1.7R5
  Implementation-Vendor: Mozilla Foundation
 -Implementation-URL: http://www.mozilla.org/rhino
 \ Chybí znak konce řádku na konci souboru
diff --git a/SOURCES/rhino-backout-686806.patch b/SOURCES/rhino-backout-686806.patch
new file mode 100644
index 0000000..0d4bc16
--- /dev/null
+++ b/SOURCES/rhino-backout-686806.patch
@@ -0,0 +1,371 @@
+diff --git a/src/org/mozilla/javascript/json/JsonParser.java b/src/org/mozilla/javascript/json/JsonParser.java
+index 5079502..0c06d26 100644
+--- a/src/org/mozilla/javascript/json/JsonParser.java
++++ b/src/org/mozilla/javascript/json/JsonParser.java
+@@ -86,23 +86,15 @@ public class JsonParser {
+     }
+ 
+     private Object readObject() throws ParseException {
+-        consumeWhitespace();
+         Scriptable object = cx.newObject(scope);
+-        // handle empty object literal case early
+-        if (pos < length && src.charAt(pos) == '}') {
+-            pos += 1;
+-            return object;
+-        }
+         String id;
+         Object value;
+         boolean needsComma = false;
++        consumeWhitespace();
+         while (pos < length) {
+             char c = src.charAt(pos++);
+             switch(c) {
+                 case '}':
+-                    if (!needsComma) {
+-                        throw new ParseException("Unexpected comma in object literal");
+-                    }
+                     return object;
+                 case ',':
+                     if (!needsComma) {
+@@ -136,21 +128,13 @@ public class JsonParser {
+     }
+ 
+     private Object readArray() throws ParseException {
+-        consumeWhitespace();
+-        // handle empty array literal case early
+-        if (pos < length && src.charAt(pos) == ']') {
+-            pos += 1;
+-            return cx.newArray(scope, 0);
+-        }
+         List<Object> list = new ArrayList<Object>();
+         boolean needsComma = false;
++        consumeWhitespace();
+         while (pos < length) {
+             char c = src.charAt(pos);
+             switch(c) {
+                 case ']':
+-                    if (!needsComma) {
+-                        throw new ParseException("Unexpected comma in array literal");
+-                    }
+                     pos += 1;
+                     return cx.newArray(scope, list.toArray());
+                 case ',':
+@@ -173,166 +157,108 @@ public class JsonParser {
+     }
+ 
+     private String readString() throws ParseException {
+-        /*
+-         * Optimization: if the source contains no escaped characters, create the
+-         * string directly from the source text.
+-         */
+-        int stringStart = pos;
++        StringBuilder b = new StringBuilder();
+         while (pos < length) {
+             char c = src.charAt(pos++);
+             if (c <= '\u001F') {
+                 throw new ParseException("String contains control character");
+-            } else if (c == '\\') {
+-                break;
+-            } else if (c == '"') {
+-                return src.substring(stringStart, pos - 1);
+             }
+-        }
+-
+-        /*
+-         * Slow case: string contains escaped characters.  Copy a maximal sequence
+-         * of unescaped characters into a temporary buffer, then an escaped
+-         * character, and repeat until the entire string is consumed.
+-         */
+-        StringBuilder b = new StringBuilder();
+-        while (pos < length) {
+-            assert src.charAt(pos - 1) == '\\';
+-            b.append(src, stringStart, pos - 1);
+-            if (pos >= length) {
+-                throw new ParseException("Unterminated string");
+-            }
+-            char c = src.charAt(pos++);
+-            switch (c) {
+-                case '"':
+-                    b.append('"');
+-                    break;
++            switch(c) {
+                 case '\\':
+-                    b.append('\\');
+-                    break;
+-                case '/':
+-                    b.append('/');
+-                    break;
+-                case 'b':
+-                    b.append('\b');
+-                    break;
+-                case 'f':
+-                    b.append('\f');
+-                    break;
+-                case 'n':
+-                    b.append('\n');
+-                    break;
+-                case 'r':
+-                    b.append('\r');
+-                    break;
+-                case 't':
+-                    b.append('\t');
+-                    break;
+-                case 'u':
+-                    if (length - pos < 5) {
+-                        throw new ParseException("Invalid character code: \\u" + src.substring(pos));
++                    if (pos >= length) {
++                        throw new ParseException("Unterminated string");
+                     }
+-                    int code = fromHex(src.charAt(pos + 0)) << 12
+-                             | fromHex(src.charAt(pos + 1)) << 8
+-                             | fromHex(src.charAt(pos + 2)) << 4
+-                             | fromHex(src.charAt(pos + 3));
+-                    if (code < 0) {
+-                        throw new ParseException("Invalid character code: " + src.substring(pos, pos + 4));
++                    c = src.charAt(pos++);
++                    switch (c) {
++                        case '"':
++                            b.append('"');
++                            break;
++                        case '\\':
++                            b.append('\\');
++                            break;
++                        case '/':
++                            b.append('/');
++                            break;
++                        case 'b':
++                            b.append('\b');
++                            break;
++                        case 'f':
++                            b.append('\f');
++                            break;
++                        case 'n':
++                            b.append('\n');
++                            break;
++                        case 'r':
++                            b.append('\r');
++                            break;
++                        case 't':
++                            b.append('\t');
++                            break;
++                        case 'u':
++                            if (length - pos < 5) {
++                                throw new ParseException("Invalid character code: \\u" + src.substring(pos));
++                            }
++                            try {
++                                b.append((char) Integer.parseInt(src.substring(pos, pos + 4), 16));
++                                pos += 4;
++                            } catch (NumberFormatException nfx) {
++                                throw new ParseException("Invalid character code: " + src.substring(pos, pos + 4));
++                            }
++                            break;
++                        default:
++                            throw new ParseException("Unexcpected character in string: '\\" + c + "'");
+                     }
+-                    pos += 4;
+-                    b.append((char) code);
+                     break;
++                case '"':
++                    return b.toString();
+                 default:
+-                    throw new ParseException("Unexpected character in string: '\\" + c + "'");
+-            }
+-            stringStart = pos;
+-            while (pos < length) {
+-                c = src.charAt(pos++);
+-                if (c <= '\u001F') {
+-                    throw new ParseException("String contains control character");
+-                } else if (c == '\\') {
++                    b.append(c);
+                     break;
+-                } else if (c == '"') {
+-                    b.append(src, stringStart, pos - 1);
+-                    return b.toString();
+-                }
+             }
+         }
+         throw new ParseException("Unterminated string literal");
+     }
+ 
+-    private int fromHex(char c) {
+-        return c >= '0' && c <= '9' ? c - '0'
+-                : c >= 'A' && c <= 'F' ? c - 'A' + 10
+-                : c >= 'a' && c <= 'f' ? c - 'a' + 10
+-                : -1;
+-    }
+-
+-    private Number readNumber(char c) throws ParseException {
+-        assert c == '-' || (c >= '0' && c <= '9');
+-        final int numberStart = pos - 1;
+-        if (c == '-') {
+-            c = nextOrNumberError(numberStart);
+-            if (!(c >= '0' && c <= '9')) {
+-                throw numberError(numberStart, pos);
+-            }
+-        }
+-        if (c != '0') {
+-            readDigits();
+-        }
+-        // read optional fraction part
+-        if (pos < length) {
+-            c = src.charAt(pos);
+-            if (c == '.') {
+-                pos += 1;
+-                c = nextOrNumberError(numberStart);
+-                if (!(c >= '0' && c <= '9')) {
+-                    throw numberError(numberStart, pos);
+-                }
+-                readDigits();
++    private Number readNumber(char first) throws ParseException {
++        StringBuilder b = new StringBuilder();
++        b.append(first);
++        while (pos < length) {
++            char c = src.charAt(pos);
++            if (!Character.isDigit(c)
++                    && c != '-'
++                    && c != '+'
++                    && c != '.'
++                    && c != 'e'
++                    && c != 'E') {
++                break;
+             }
++            pos += 1;
++            b.append(c);
+         }
+-        // read optional exponent part
+-        if (pos < length) {
+-            c = src.charAt(pos);
+-            if (c == 'e' || c == 'E') {
+-                pos += 1;
+-                c = nextOrNumberError(numberStart);
+-                if (c == '-' || c == '+') {
+-                    c = nextOrNumberError(numberStart);
+-                }
+-                if (!(c >= '0' && c <= '9')) {
+-                    throw numberError(numberStart, pos);
++        String num = b.toString();
++        int numLength = num.length();
++        try {
++            // check for leading zeroes
++            for (int i = 0; i < numLength; i++) {
++                char c = num.charAt(i);
++                if (Character.isDigit(c)) {
++                    if (c == '0'
++                            && numLength > i + 1
++                            && Character.isDigit(num.charAt(i + 1))) {
++                        throw new ParseException("Unsupported number format: " + num);
++                    }
++                    break;
+                 }
+-                readDigits();
+             }
+-        }
+-        String num = src.substring(numberStart, pos);
+-        final double dval = Double.parseDouble(num);
+-        final int ival = (int)dval;
+-        if (ival == dval) {
+-            return Integer.valueOf(ival);
+-        } else {
+-            return Double.valueOf(dval);
+-        }
+-    }
+-
+-    private ParseException numberError(int start, int end) {
+-        return new ParseException("Unsupported number format: " + src.substring(start, end));
+-    }
+-
+-    private char nextOrNumberError(int numberStart) throws ParseException {
+-        if (pos >= length) {
+-            throw numberError(numberStart, length);
+-        }
+-        return src.charAt(pos++);
+-    }
+-
+-    private void readDigits() {
+-        for (; pos < length; ++pos) {
+-            char c = src.charAt(pos);
+-            if (!(c >= '0' && c <= '9')) {
+-                break;
++            final double dval = Double.parseDouble(num);
++            final int ival = (int)dval;
++            if (ival == dval) {
++                return Integer.valueOf(ival);
++            } else {
++                return Double.valueOf(dval);
+             }
++        } catch (NumberFormatException nfe) {
++            throw new ParseException("Unsupported number format: " + num);
+         }
+     }
+ 
+diff --git a/testsrc/org/mozilla/javascript/tests/json/JsonParserTest.java b/testsrc/org/mozilla/javascript/tests/json/JsonParserTest.java
+index ee885ae..2783b50 100644
+--- a/testsrc/org/mozilla/javascript/tests/json/JsonParserTest.java
++++ b/testsrc/org/mozilla/javascript/tests/json/JsonParserTest.java
+@@ -196,66 +196,6 @@ public class JsonParserTest {
+         parser.parseValue("[1 ");
+     }
+ 
+-    @Test(expected = ParseException.class)
+-    public void shouldFailToParseIllegalUnicodeEscapeSeq() throws Exception {
+-        parser.parseValue("\"\\u-123\"");
+-    }
+-
+-    @Test(expected = ParseException.class)
+-    public void shouldFailToParseIllegalUnicodeEscapeSeq2() throws Exception {
+-        parser.parseValue("\"\\u006\u0661\"");
+-    }
+-
+-    @Test(expected = ParseException.class)
+-    public void shouldFailToParseIllegalUnicodeEscapeSeq3() throws Exception {
+-        parser.parseValue("\"\\u006١\"");
+-    }
+-
+-    @Test(expected = ParseException.class)
+-    public void shouldFailToParseTrailingCommaInObject1() throws Exception {
+-        parser.parseValue("{\"a\": 1,}");
+-    }
+-
+-    @Test(expected = ParseException.class)
+-    public void shouldFailToParseTrailingCommaInObject2() throws Exception {
+-        parser.parseValue("{,\"a\": 1}");
+-    }
+-
+-    @Test(expected = ParseException.class)
+-    public void shouldFailToParseTrailingCommaInObject3() throws Exception {
+-        parser.parseValue("{,}");
+-    }
+-
+-    @Test
+-    public void shouldParseEmptyObject() throws Exception {
+-        parser.parseValue("{}");
+-    }
+-
+-    @Test(expected = ParseException.class)
+-    public void shouldFailToParseTrailingCommaInArray1() throws Exception {
+-        parser.parseValue("[1,]");
+-    }
+-
+-    @Test(expected = ParseException.class)
+-    public void shouldFailToParseTrailingCommaInArray2() throws Exception {
+-        parser.parseValue("[,1]");
+-    }
+-
+-    @Test(expected = ParseException.class)
+-    public void shouldFailToParseTrailingCommaInArray3() throws Exception {
+-        parser.parseValue("[,]");
+-    }
+-
+-    @Test
+-    public void shouldParseEmptyArray() throws Exception {
+-        parser.parseValue("[]");
+-    }
+-
+-    @Test(expected = ParseException.class)
+-    public void shouldFailToParseIllegalNumber() throws Exception {
+-        parser.parseValue("1.");
+-    }
+-
+     private String str(char... chars) {
+         return new String(chars);
+     }
diff --git a/SPECS/rhino.spec b/SPECS/rhino.spec
index ce1ddf3..2726a45 100644
--- a/SPECS/rhino.spec
+++ b/SPECS/rhino.spec
@@ -28,14 +28,14 @@
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 #
 
-%define scm_version 1_7R4
+%define scm_version 1_7R5
 
 Name:           rhino
-# R3 doesn't mean a prerelease, but behind R there is a version of this implementation
+# R5 doesn't mean a prerelease, but behind R there is a version of this implementation
 # of Javascript version 1.7 (which is independent from this particular implementation,
 # e.g., there is C++ implementation in Spidermonkey)
-Version:        1.7R4
-Release:        5%{?dist}
+Version:        1.7R5
+Release:        1%{?dist}
 Summary:        JavaScript for Java
 License:        MPLv2.0 
 
@@ -50,6 +50,12 @@ Patch0:         %{name}-build.patch
 Patch1:         %{name}-addOrbitManifest.patch
 Patch2:         %{name}-1.7R3-crosslink.patch
 Patch3:         %{name}-shell-manpage.patch
+# Back out patch for Mozilla bug#686806 (JSONParser parses invalid JSON input).
+# This change made the JSONParser class more strict and will throw exceptions
+# for JSON that does not adhere to spec for a few cases, where no exception
+# was thrown previously. This patch reverts this change to preserve backward
+# compatibility.
+Patch4:         %{name}-backout-686806.patch
 
 URL:            http://www.mozilla.org/rhino/
 Group:          Development/Libraries
@@ -99,6 +105,7 @@ Javadoc for %{name}.
 %patch1 -p1 -b .fixManifest
 %patch2 -p1 -b .crosslink
 %patch3 -p1 -b .manpage
+%patch4 -p1 -b .backoutJsonFix
 
 # Fix build
 sed -i -e '/.*<get.*src=.*>$/d' build.xml testsrc/build.xml \
@@ -169,6 +176,11 @@ install -p -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_mavenpomdir}/JPP-%{name}.pom
 %doc %{_javadocdir}/%{name}
 
 %changelog
+* Tue Nov 01 2016 Elliott Baron <ebaron@redhat.com> - 1.7R5-1
+- Update to 1.7R5.
+- Add rhino-backout-686806.patch for backward compatibility.
+- Resolves: rhbz#1350331
+
 * Fri Aug 01 2014 Elliott Baron <ebaron@redhat.com> - 1.7R4-5
 - Update man page patch
 - Resolves: rhbz#948445