aboutsummaryrefslogtreecommitdiffstats
path: root/src/ajax/var/nonce.js
diff options
context:
space:
mode:
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>2020-02-24 19:10:03 +0100
committerGitHub <noreply@github.com>2020-02-24 19:10:03 +0100
commit22bf701fe1b21d883f58fd46c4709315825118ca (patch)
tree388b2a2ae300da3fecfd4378c48c844ba46bce9e /src/ajax/var/nonce.js
parent3dedc3f2d46d38296f6867ca69c970e512f87e16 (diff)
downloadjquery-22bf701fe1b21d883f58fd46c4709315825118ca.tar.gz
jquery-22bf701fe1b21d883f58fd46c4709315825118ca.zip
Core:Ajax: Align nonce & global with master, fix an AMD issue
This commit aligns the `3.x-stable` branch with `master` in two aspects: 1. It migrates the nonce module to return an object instead of a primitive variable. This had to be changed on `master` as in ES modules you export live read-only bindings to variables, meaning you can't increment the nonce directly. Also, the way it was done so far was working differently in AMD & the single built file - in the built file one nonce variable was declared, accessed and incremented. In AMD mode separate instances were create for each module that depend on the nonce module, creating unintended nonce clashes. 2. Whether the `noGlobal` parameter was set to `true` is now checked using the typeof operator to align with `master`. Closes gh-4612 Ref gh-4541 Ref d0ce00cdfa680f1f0c38460bc51ea14079ae8b07
Diffstat (limited to 'src/ajax/var/nonce.js')
-rw-r--r--src/ajax/var/nonce.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/ajax/var/nonce.js b/src/ajax/var/nonce.js
index 33d0cffb6..c0e4472ac 100644
--- a/src/ajax/var/nonce.js
+++ b/src/ajax/var/nonce.js
@@ -1,5 +1,5 @@
define( function() {
"use strict";
- return Date.now();
+ return { guid: Date.now() };
} );