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