@@ -324,89 +324,6 @@ function Browser(window, document, $log, $sniffer) {
324
324
return href ? href . replace ( / ^ ( h t t p s ? \: ) ? \/ \/ [ ^ \/ ] * / , '' ) : '' ;
325
325
} ;
326
326
327
- //////////////////////////////////////////////////////////////
328
- // Cookies API
329
- //////////////////////////////////////////////////////////////
330
- var lastCookies = { } ;
331
- var lastCookieString = '' ;
332
- var cookiePath = self . baseHref ( ) ;
333
-
334
- function safeDecodeURIComponent ( str ) {
335
- try {
336
- return decodeURIComponent ( str ) ;
337
- } catch ( e ) {
338
- return str ;
339
- }
340
- }
341
-
342
- /**
343
- * @name $browser#cookies
344
- *
345
- * @param {string= } name Cookie name
346
- * @param {string= } value Cookie value
347
- *
348
- * @description
349
- * The cookies method provides a 'private' low level access to browser cookies.
350
- * It is not meant to be used directly, use the $cookie service instead.
351
- *
352
- * The return values vary depending on the arguments that the method was called with as follows:
353
- *
354
- * - cookies() -> hash of all cookies, this is NOT a copy of the internal state, so do not modify
355
- * it
356
- * - cookies(name, value) -> set name to value, if value is undefined delete the cookie
357
- * - cookies(name) -> the same as (name, undefined) == DELETES (no one calls it right now that
358
- * way)
359
- *
360
- * @returns {Object } Hash of all cookies (if called without any parameter)
361
- */
362
- self . cookies = function ( name , value ) {
363
- var cookieLength , cookieArray , cookie , i , index ;
364
-
365
- if ( name ) {
366
- if ( value === undefined ) {
367
- rawDocument . cookie = encodeURIComponent ( name ) + "=;path=" + cookiePath +
368
- ";expires=Thu, 01 Jan 1970 00:00:00 GMT" ;
369
- } else {
370
- if ( isString ( value ) ) {
371
- cookieLength = ( rawDocument . cookie = encodeURIComponent ( name ) + '=' + encodeURIComponent ( value ) +
372
- ';path=' + cookiePath ) . length + 1 ;
373
-
374
- // per http://www.ietf.org/rfc/rfc2109.txt browser must allow at minimum:
375
- // - 300 cookies
376
- // - 20 cookies per unique domain
377
- // - 4096 bytes per cookie
378
- if ( cookieLength > 4096 ) {
379
- $log . warn ( "Cookie '" + name +
380
- "' possibly not set or overflowed because it was too large (" +
381
- cookieLength + " > 4096 bytes)!" ) ;
382
- }
383
- }
384
- }
385
- } else {
386
- if ( rawDocument . cookie !== lastCookieString ) {
387
- lastCookieString = rawDocument . cookie ;
388
- cookieArray = lastCookieString . split ( "; " ) ;
389
- lastCookies = { } ;
390
-
391
- for ( i = 0 ; i < cookieArray . length ; i ++ ) {
392
- cookie = cookieArray [ i ] ;
393
- index = cookie . indexOf ( '=' ) ;
394
- if ( index > 0 ) { //ignore nameless cookies
395
- name = safeDecodeURIComponent ( cookie . substring ( 0 , index ) ) ;
396
- // the first value that is seen for a cookie is the most
397
- // specific one. values for the same cookie name that
398
- // follow are for less specific paths.
399
- if ( lastCookies [ name ] === undefined ) {
400
- lastCookies [ name ] = safeDecodeURIComponent ( cookie . substring ( index + 1 ) ) ;
401
- }
402
- }
403
- }
404
- }
405
- return lastCookies ;
406
- }
407
- } ;
408
-
409
-
410
327
/**
411
328
* @name $browser#defer
412
329
* @param {function() } fn A function, who's execution should be deferred.
0 commit comments